在点击我的视频网址时,我得到的回复是:
Error Domain = AVFoundationErrorDomain
Code = -11853 "Playlist not received, See -[AVPlayerItem errorLog] for 2 events"
UserInfo = {
NSUnderlyingError = 0x600000251670
{
Error Domain = CoreMediaErrorDomain
Code=-12884 "Playlist File not received"
UserInfo = {NSDescription = Playlist File not received}
},
NSLocalizedFailureReason = This data is damaged, incomplete, or incompatible.,
NSDebugDescription = Playlist not received,
See -[AVPlayerItem errorLog] for 2 events,
NSLocalizedDescription = Cannot Parse
}
过去两天我被困住了,无法想出办法。
答案 0 :(得分:0)
使用以下代码播放网址视频。这适合您。
如果视频网址是“消息?.link”。 handlePlay()函数调用点击按钮播放视频。
var playerLayer: AVPlayerLayer?
var player: AVPlayer?
func handlePlay() {
if let videoUrlString = message?.link {
let videoURL = URL(string: videoUrlString)
self.player = AVPlayer(url: videoURL!)
let playerViewController = AVPlayerViewController()
playerViewController.player = ChatMessageCell.player
nav.present(playerViewController, animated: true, completion: {
self.player?.play()
})
}
谢谢!