tags:

views:

625

answers:

2

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

A: 

I got it to work

Here is how

NSURL* videoURL = [NSURL URLWithString:url]; MPMoviePlayerController moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; [moviePlayer prepareToPlay]; [moviePlayer play]; [self.view addSubview:moviePlayer.view];

Thanks,
Tee

teepusink
A: 

MPMoviePlayerController doesn't work on the iPad anymore - only audio is played. You have to use MPMoviePlayerViewController to get the correct functionality

http://stackoverflow.com/questions/2218158/using-mpmovieplayerviewcontroller-in-sdk-3-2-for-ipad

Thanks for the update Apple :(

stinkbutt