MPMoviePlayerPlaybackDidFinishNotification gets called when it shouldn't

前端 未结 4 475
走了就别回头了
走了就别回头了 2021-02-06 13:19

According to Apple\'s MPMoviePlayerController doc:

MPMoviePlayerPlaybackDidFinishNotification - This notification is not sent in cases where the movie player is displayi

4条回答
  •  自闭症患者
    2021-02-06 13:56

    Here is how you check the MPMoviePlayerPlaybackDidFinishReasonUserInfoKey which is part of the notification of MPMoviePlayerPlaybackDidFinishNotification

    - (void) playbackDidFinish:(NSNotification*)notification {
        int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
        if (reason == MPMovieFinishReasonPlaybackEnded) {
            //movie finished playin
        }else if (reason == MPMovieFinishReasonUserExited) {
            //user hit the done button
        }else if (reason == MPMovieFinishReasonPlaybackError) {
            //error
        }
    }
    

提交回复
热议问题