开发者

MPMoviePlayer keeps playing after stream is done

开发者 https://www.devze.com 2023-01-26 00:03 出处:网络
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 su

We have an MPMoviePlayer which plays a stream. This works well, but we have 2 problems:

  1. 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.
  2. 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];
}
开发者_如何学Go

What are we missing?

Thanks in advance!


Add "pause" before "stop" like this :

[player pause];
[player stop];
0

精彩评论

暂无评论...
验证码 换一张
取 消