Cocoa touch SDK 3.2 - How to play video

Posted by teepusink on Stack Overflow See other posts from Stack Overflow or by teepusink
Published on 2010-04-28T19:50:28Z Indexed on 2010/06/08 3:02 UTC
Read the original article Hit count: 336

Filed under:

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

© Stack Overflow or respective owner

Related posts about ipad-sdk