AVPlayerItem fails with AVStatusFailed and error code “Cannot Decode”

后端 未结 4 1466
悲&欢浪女
悲&欢浪女 2020-11-27 02:55

I\'m running into a strange issue, I hope someone can help.

In my iOS app I create a video with a custom soundtrack using MutableComposition by combini

4条回答
  •  悲&欢浪女
    2020-11-27 03:13

    OK, I figured out a solution, I hope this is helpful to anyone who may stumble on something similar to this problem.

    The solution in my case was to initialize the asset for the AVPlayer and the AVPlayerItem on the main thread and make sure I don't create the actual AVPlayerLayer before the playerItem and the player objects return with status "ReadyToPlay".

    This proved to be tricky to isolate and I still don't know why it worked the first 4 times and then failed consistently on the 5th time.

    Till, I couldn't really include the code, it wasn't a matter of one line or even a few functions. It was a complex problem that I couldn't isolate to begin with. Thanks for the comments though.

提交回复
热议问题