[英]AVPlayerViewController does not play Videos by url
I tried to play a video by url in an AVPlayerViewController.我试图在 AVPlayerViewController 中通过 url 播放视频。 The AVPlayerViewController is set in my storyboard and the segue connection is working properly, but the play button is crossed out and the video will not be played.
AVPlayerViewController 设置在我的storyboard 中并且segue 连接正常工作,但是播放按钮被划掉并且视频不会播放。 So what can i do?
那我能做什么? I already tested creating the AVPlayerViewController programmatically and added "Allow Arbitrary Loads".
我已经测试了以编程方式创建 AVPlayerViewController 并添加了“允许任意加载”。 Still not working.
还是行不通。
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!)
}
}
也许你忘了play
视频?
destination.player?.play()
I had the same problem before. 我之前也遇到过同样的问题。 use this darling, hope be useful
用这个宝贝,希望有用
https://stackoverflow.com/a/56822494/11654755 https://stackoverflow.com/a/56822494/11654755
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.