I have an app that handles streaming video. Starting with a .m3u8 playlist, it creates an array of AVAssets, and flips through them by
[player replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithAsset:[assetItems objectAtIndex:index]]]
This works fine, but before that I want to air a short mp4 video using progressive downloading. I load the AVPlayer using
AVAsset *prerollAsset = [AVAsset assetWithURL:prerollURL];
[player replaceCurrentItemWithPlayerItem:[AVPlayerItem playerItemWithAsset:prerollAsset]];
It plays, but when I continue with the streaming video as before, I get a status of AVPlayerStatusFailed, with the error in AVPlayerItem of The operation could not be completed
For it to work, I need to create an AVPlayer object for the (progressive download) preroll, and then a completely new AVPlayer object to start playing the streaming video.
Is it possible that a single AVPlayer instance isn't capable of playing progressive download video followed by streaming video? Or might there be something else I am doing wrong?
This bug is a known issue, and purportedly fixed in the next major release of iOS.
In the interim, creating a new AVPlayer object is the only known workaround.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With