Cocoa touch SDK 3.2 - How to play video
- by teepusink
Hi,
How do I play video on SDK 3.2 (iPad)?
Read many questions here but they talked mostly for iPhone.
For example, the MoviePlayer example here http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/Introduction/Intro.html
That works on 3.1.3 but when I run it on 3.2, it doesn't work.
So basically I'm able to play a video on 3.1.3 using this code but the same code won't run on 3.2
NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.mp4"];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
moviePlayer.movieControlMode = MPMovieControlModeDefault;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer play];
Thanks,
Tee