我想在按下showSponsorsButton时在外部屏幕上显示视频。
我还希望该视频循环播放/重复播放,直到用户取消。
我应该在外部View中使用什么代码?
我尝试添加subView。
// VIDEO SLIDES
@IBAction func showSponsorsButton(_ sender: UIButton) {
if let path = Bundle.main.path(forResource: "Sponsors", ofType: "MOV")
{
let sponsorsVideo = AVPlayer(url: URL(fileURLWithPath: path))
let videoPlayer = AVPlayerViewController()
videoPlayer.player = sponsorsVideo
present(videoPlayer, animated: true, completion:
{
sponsorsVideo.play()
})
}
}