AVPlayer not switching between progressive downloa

2019-03-28 05:43发布

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?

1条回答
姐就是有狂的资本
2楼-- · 2019-03-28 06:02

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.

查看更多
登录 后发表回答