Reputation: 27
I have tried the following code but this is not working. only a black screen is coming out as output.
NSURL *url_vdo=[[NSURL alloc] initWithString:@"url"];
moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:url_vdo];
[moviePlayer.view setFrame: self.view.bounds];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDonePressed:) name:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer];
moviePlayer.controlStyle=MPMovieControlStyleFullscreen;
[moviePlayer play];
[moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
Upvotes: 1
Views: 277
Reputation: 2407
Try to change this line:
[moviePlayer.view setFrame: self.view.bounds];
With this line:
[moviePlayer.view setFrame: self.view.frame];
Upvotes: 0
Reputation: 347
NSURL *movieURL = [NSURL URLWithString:@"http://url.m3u8"];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
if (mp)
{
mp.view.frame = self.view.bounds;
[self.view addSubview:mp.view];
// save the movie player object
[mp setFullscreen:YES];
// Play the movie!
[mp play];
self.moviePlayer = mp;
}
Upvotes: 1