Done button event MPMoviePlayerController

前端 未结 7 774
闹比i
闹比i 2020-12-06 09:20

On my iPhone i\'m playing video/audio files in fullscreen mode. When the video/audio file reached its end then the following method is triggered:

- (void) mo         


        
7条回答
  •  醉酒成梦
    2020-12-06 09:40

    Apple's documentation is very poor on this matter. It suggests to listen for MPMoviePlayerDidExitFullscreenNotification (or WillExit...) and NOT for MPMoviePlayerDidFinishNotification as it doesn't fire when the user taps Done. This is entirely not true! I've just tested it on Xcode 6.0 with iPad Simulator (iOS 7.1 + 8.0) and only MPMoviePlayerDidFinishNotification is fired when DONE is tapped.

    My compliments to user523234 who got it right on one of the comments above.

    Register the following observer

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(playbackStateChanged:)
                                            name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:_mpc];
    

提交回复
热议问题