0

在点击我的视频网址时,我得到的回应是:

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
}

我被困在过去的两天里,找不到出路。

4

1 回答 1

0

使用以下代码播放 URL 视频。这对您有用。

如果是视频 URL,则为“message?.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()
        })         

    }

谢谢!!

于 2017-06-30T12:38:38.060 回答