[英]AVPlayerViewController - UIButton not triggering video
I am using AVPlayerViewController in order to play a .mov file (TeethingFinal.mov) in my project. 我正在使用AVPlayerViewController来在项目中播放.mov文件(TeethingFinal.mov)。 The funny thing is, I have the feature working perfectly with two other buttons on the same ViewController but for some reason will not launch the AVPlayer!
有趣的是,我具有与同一ViewController上的其他两个按钮完美配合的功能,但由于某种原因无法启动AVPlayer! The tap gesture is being recognized, because I can see the button highlight when pressed but nothing happens.
正在识别轻击手势,因为按下后我可以看到按钮高亮显示,但什么也没发生。 I would post error message but there is not one!
我会发布错误消息,但没有一个!
@IBAction func sugarBugPlay(sender: UIButton) {
let moviePlayerController = AVPlayerViewController()
let path = NSBundle.mainBundle().pathForResource("TeethingFinal", ofType:"mov")
let url = NSURL.fileURLWithPath(path!)
let playerVC = AVPlayerViewController()
var player: AVPlayer = AVPlayer()
playerVC.player = AVPlayer(URL: url)
self.presentViewController(playerVC, animated: true, completion: nil)
}
So sometimes Xcode is funny. 因此,有时Xcode很有趣。 I created a completely new ViewController the exact same way and reattached all of my outlets and it worked!
我以完全相同的方式创建了一个全新的ViewController,然后重新连接了所有的插座,并且一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.