AVPlayer not switching between progressive download and streaming

 ̄綄美尐妖づ 提交于 2019-12-12 08:04:33

问题


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:


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.



来源:https://stackoverflow.com/questions/10839061/avplayer-not-switching-between-progressive-download-and-streaming

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