且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置contentURL时,在iPhone 4.3模拟器中再次调用MPMoviePlayerPlaybackDidFinishNotification

更新时间:2023-10-20 23:44:16

我遇到了同样的问题。并以这种方式解决了:

I had the same problem. and solved it this way:

我创建了一种跳过视频的新方法

I created a new method to skip a video

- (void) skipVideo {
    [_moviePlayer stop];
}

停止播放器 skipVideo 将导致 MPMovieFinishReasonPlaybackEnded 通知(在模拟器和设备上)。当现在设置播放器的contentUrl时,不会导致其他 MPMovieFinishReasonPlaybackEnded 通知,因此 moviePlayBackDidFinish 仅被调用一次;

Stopping the player in skipVideo will cause a MPMovieFinishReasonPlaybackEnded notification (in simulator and on device). When setting contentUrl of player now, no other MPMovieFinishReasonPlaybackEnded notification is caused, so moviePlayBackDidFinish is called only once;

在播放下一个视频之前(在 playNextVideo 中)你必须致电

Before playing next video (in playNextVideo) you have to call

[_moviePlayer prepareToPlay];

这对我来说没问题!