AVPlayerViewController不按网址播放视频

时间:2016-02-27 13:33:36

标签: ios swift avplayerviewcontroller

我尝试在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!)
    }
}

screenshot of videoplayer

1 个答案:

答案 0 :(得分:0)

也许您忘记了play视频?

destination.player?.play()