Devarshi
Devarshi

Reputation: 16758

Some problem with MPMoviePlayerController using in ipad application

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

Upvotes: 4

Views: 1547

Answers (3)

Rindra
Rindra

Reputation: 46

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

[self.view addSubview:IntroMovie.view]

Upvotes: 3

conradev
conradev

Reputation: 1074

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

iPhone Dev Center

Upvotes: 1

Peter Hosey
Peter Hosey

Reputation: 96333

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.

Upvotes: 1

Related Questions