Done button event MPMoviePlayerController

前端 未结 7 748
闹比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 10:03

    Swift version, for anyone who's interested:

    NSNotificationCenter.defaultCenter().addObserver(self, selector: "moviePlayerDoneButtonClicked:", name: MPMoviePlayerPlaybackDidFinishNotification, object: nil)
    

    Notification handler:

    func moviePlayerDoneButtonClicked(note: NSNotification) {
    
        let reason = note.userInfo?[MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]
        if (MPMovieFinishReason(rawValue: reason as! Int) == MPMovieFinishReason.UserExited) {
            self.exitVideo()
        }
    }
    
    0 讨论(0)
提交回复
热议问题