This is the very simple application . In this application we will see how to play video in the iPad.
Step 1: Create a View base application using template. Give the application name “VideoPlay_iPad”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.
Step 3: Xpand classes and notice Interface Builder created the VideoPlay_iPadViewController class for you. Expand Resources and notice the template generated a separate nib,VideoPlay_iPadViewController.xib, for the “VideoPlay_iPad”.
Step 4: We need to add MediaPlayer.framework in the Frameworks folder. Select-> Frameworks folder -> Add ->Existing Frameworks -> then select MediaPlayer.framework.
Step 5: In the VideoPlay_iPadViewController.h file, we have created instance of MPMoviePlayerController class, that manage the playback of a movie from a file or from the network, and create a instance of NSURL class . So make the following changes in the file.
#import <MediaPlayer/MediaPlayer.h>
@interface VideoPlay_iPadViewController : UIViewController {
MPMoviePlayerController *videoPlayer;
NSURL *videoURL;
}
Step 6: Open the VideoPlay_iPadViewController.m file and make the following changes in the file.
{
NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"3idiots.mov" ofType:nil];
NSURL *url = [NSURL fileURLWithPath:urlStr];
videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:videoPlayer.view];
videoPlayer.view.frame = CGRectMake(0, 0,768, 1000);
[videoPlayer play];
}
Step 7: Now compile and run the application in the Simulator.
You can Download SourceCode from here VideoPlay_iPad












This is awesome. Is there a way to add a picker view so that depending on what item you pick on the picker view, it will play a different video. Like a video juke box. Is that a lot more complicated. I’m trying to figure it out on my end, and I can’t get it.
Hi Everyone,
I am new iPhone Development. I want to develop the app called there are list of videos in a table and whenever we click on the row it will play the video from url and also it will play in certain frame in iPad.
Can u please anyone know how to play the movie from url in certain frame in iPad.
Plaese help me
Thanks in advance
Great Tutorial!!!!!
I have added the code to my project but when the video ends does not take me to the main view of the app.
I use the video as an entrance to the app.
On iPhone device i don’t have this problem.
Please help.
Thanks in advance