views:

628

answers:

3

Hi all

I am using MPMoviePlayerController in Ipad application. Video is not showing but audio comes, same code working well for Iphone

NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"video" ofType:@"mp4"];

movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
  [IntroMovie play];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlaybackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:nil]; 

Please suggest me

Thanks Miraaj

+1  A: 

Is your iPad application a separate target from the iPhone application?

If so, did you remember to add the video to the resources copied into the iPad-application bundle?

If you didn't, drag it into the “Copy Bundle Resources” build phase within the iPad-application target.

Peter Hosey
+1  A: 

In the new SDK you need to use a MPMoviePlayerViewController to present the video, not just a MPMoviePlayerController:

iPhone Dev Center

ckrames1234
+2  A: 

You must add the movie view to an existing view like this within view controller for sample:

[self.view addSubview:IntroMovie.view]

Rindra