MPMoviePlayerController - Exit, detect movie play and iAd

守給你的承諾、 提交于 2019-12-24 11:27:52

问题


I have successfully integrated a working movie player with a pre-roll iAd video! Thanks to @Daniel Storm. However, I want information on how to exit the movie when the movie is finished or when the ad is finished. (exit means remove from the view), Also detect if the user has watched the ad. If there is internet connection failure or iAd failure, how can i detect if the pre-roll ad did not play.

I am making a game, and if a user decides to get more coins, that person must watch an ad. If they click on the watch ad button, I want to detect if the ad loaded successfully so that person can get coins after they watch the ad. Once the ad finishes I want to dismiss the MPMoviePlayerController view.

Thank you for your help!


Edit:

Is this correct? :

Is it ok to remove the MPMoviePlayerViewController from the view after it is played like this?: Is this the correct way to remove it?

moviePlayer.playPrerollAdWithCompletionHandler { (error) -> Void in
            NSLog("\(error)")



            self.moviePlayer.view.removeFromSuperview()

I am supposing this is correct because it removes the view, but is this what apple intends us to do?

来源:https://stackoverflow.com/questions/32186245/mpmovieplayercontroller-exit-detect-movie-play-and-iad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!