我正在使用 AVPlayerViewController 来在我的项目中播放 .mov 文件 (TeethingFinal.mov)。有趣的是,我的功能可以与同一个 ViewController 上的其他两个按钮完美配合,但由于某种原因无法启动 AVPlayer!正在识别轻击手势,因为按下时我可以看到按钮突出显示但没有任何反应。我会发布错误消息,但没有!
@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)
}