Detecting UIWebView finish to play youtube video on iPad

后端 未结 4 1014
深忆病人
深忆病人 2020-12-08 06:13

I\'m using UIWebView to play YouTube videos in an iPad.

How can I detect when a YouTube video is finished playing? I see the play icon in the status ba

4条回答
  •  忘掉有多难
    2020-12-08 06:31

    Here's a Swift 3 answer

       NotificationCenter.default.addObserver(
        self,
        selector: #selector(self.videoEnded),
        name: .AVPlayerItemDidPlayToEndTime,
        object: nil)
    
    
    }
    
    func videoEnded(){
        print("video ended")
    }
    

提交回复
热议问题