AVPlayerViewController black screen when swiping on iOS 11

六月ゝ 毕业季﹏ 提交于 2019-12-05 06:22:20

Okay I found the mistake: To close the Airplay video playback when pressing "Done" I used this code:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    if avPlayerController?.isBeingDismissed ?? false {
        avPlayerController?.player = nil
    }
}

But with iOS 11, Apple added a feature to close the Video Player via a swipe gesture. So when I swipe, the viewWillAppear function gets called. Putting this code inside viewDidAppear fixed this and preserved the AirPlay-Fix.

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