kiri
kiri

Reputation: 2007

Audio is playing but video is not playing in mpmovieplayercontroller in iPad

I have a video file of in server of size 10MB, I want to play that video in iPad using mpmovieplayercontroller.

NSURL* url = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

NSLog(@"%@",url);

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];


[mp play];

The above is the code i used I am able to play the audio but not able get video in iPad simulator.

Can any one help me

Thanks

Upvotes: 0

Views: 450

Answers (2)

Till
Till

Reputation: 27597

You need to add the MoviePlayerController's view as a subview to the currently visible view like this:

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
mp.view.frame = CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f);
[self.view addSubview:mp.view];
[mp play];

Upvotes: 1

Zepplock
Zepplock

Reputation: 29175

most likely the video format is not supported. The supported video formats are: H.264, MPEG-4

Upvotes: 0

Related Questions