Using MPMOVIEPLAYERVIEWCONTROLLER in SDK 3.2 for iPad

I have developed an iPhone application that already runs MPMoviePlayer (pre 3.2 SDK) without any problems. I know this is a newbie question, but how to play movies in the new MPMoviePlayerViewController. I only listen to music and want to learn a new view controller. I ported my entire application to the iPad, and everything else works normally except for videos. Can someone show an example with the movie view controller? Any help would be greatly appreciated.

Thanks,

NSURL* videoURL = [NSURL URLWithString:url];
MPMoviePlayerController moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayer prepareToPlay];
[moviePlayer play];
//For viewing partially.....
[moviePlayer.view setFrame:CGRectMake(50, 200, (self.view.frame.size.width)-100, 400)];
moviePlayer .view.backgroundColor = [UIColor grayColor];
[self.view addSubview:moviePlayer.view];

I developed a running MPMoviePlayer(pre 3.2 SDK) iPhone application, there is no problem. I know this is a newbie question, but how to play movies in the new MPMoviePlayerViewController. I only listen to music and hope to learn the new view controller. I ported my entire application On the iPad, everything else works fine except for videos. Can someone show an example with the movie view controller? Any help would be greatly appreciated.

Thank you,

NSURL* videoURL = [NSURL URLWithString:url]; 
MPMoviePlayerController moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayer prepareToPlay];
[moviePlayer play];
//For viewing partially.....< br />[moviePlayer.view setFrame:CGRectMake(50, 200, (self.view.frame.size.width)-100, 400)];
moviePlayer.view.backgroundColor = [UIColor grayColor];
[self.view addSubview:moviePlayer.view];

Leave a Comment

Your email address will not be published.