我想用AVPlayer播放YouTube视频。
这是我的代码:
let playerItem = AVPlayerItem(asset: AVAsset(url:URL(string: "https://www.youtube.com/watch?v=xxxxxxxxx")!))
player = AVPlayer(playerItem : playerItem)
playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.bounds
player.play()
AVPlayerItemStatus
传递失败并显示以下错误:
Error Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped" UserInfo={NSUnderlyingError=0x1702443e0 {Error Domain=NSOSStatusErrorDomain Code=-12939 "(null)"}, NSLocalizedFailureReason=The server is not correctly configured., NSLocalizedDescription=Operation Stopped}
有人可以帮我解决这个问题吗?
PS:当我将AVPlayer
更改为AVQueuePlayer
时,它会有效!