AVPlayer fails with AVPlayerItemStatusFailed (OSStatus error -12983)

时光总嘲笑我的痴心妄想 提交于 2019-12-04 02:18:20

The problem is that this line is unconditional:

[self.layer addSublayer:avPlayerLayer];

Thus you are adding a new player layer every time. Thus you are piling up many player layers. This is wrong. There must be only one. Keep a reference to the old player layer and remove it before adding a player layer, or, if this is the same player as before and it has the associated player layer in the interface already, do nothing.

Create a sharedInstance of AVPlayer with playerItem = nil. Next time only replaceThePlayerItem.

It sometimes happened in iOS simulator,
try to restart simulator again may will work. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!