我尝试在AVPlayerViewController中通过url播放视频。 AVPlayerViewController在我的故事板中设置,并且segue连接正常工作,但播放按钮被划掉,视频将无法播放。那我该怎么办?我已经测试过以编程方式创建AVPlayerViewController并添加了“允许任意加载”。仍然没有工作。
performSegueWithIdentifier("videoImpression", sender: self)
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "videoImpression") {
let destination = segue.destinationViewController as! AVPlayerViewController
let url = NSURL(string: "http://download.wavetlan.com/SVV/Media/HTTP/H264/Other_Media/H264_test8_voiceclip_mov_480x320.mov")
destination.player = AVPlayer(URL: url!)
}
}
答案 0 :(得分:0)
也许您忘记了play
视频?
destination.player?.play()