We have an MPMoviePlayer which plays a stream. This works well, but we have 2 problems:
- The player keeps playing after a movie is done, so the player closes and goes back to the app, but all of a sudden the we hear the audio of the movie again.
- On the simulator, the movie plays fully, but on the device the screen freezes when the last segment is started. (the stream is a m3u8 stream file with fragments)
We have implemented the following method:
- (void) movieFinishedCallback:(NSNotification*) aNotification
{
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player stop];
[[UIApplication sharedApplication] setStatusBarHidden:NO];
self.view.hidden = YES;
[player release];
}
开发者_如何学GoWhat are we missing?
Thanks in advance!
Add "pause" before "stop" like this :
[player pause];
[player stop];
精彩评论