AVPlayerItem does not play videos, even its status is `readyToPlay` and` isPlaybackLiciousToKeepUp` is true

I play live video with AVPlayerand AVPlayerItem. I observe AVPlayerItem status, isPlaybackLikelyToKeepUpand AVPlayerItemPlaybackStalled. I am also watching AVPlayer rate.

While I was testing, I discovered that something strange had really happened.

While AVPlayerplaying the video normally ( AVPlayerItem.status == readyToPlayand AVPlayerItem.isPlaybackLikelyToKeepUp == true), if I press the "home" button, AVPlayer.rateit becomes 0.0. This means that the player stops playing.

When the application returned to the foreground, and I press the play button, it is still AVPlayerItem.status == readyToPlayand AVPlayerItem.isPlaybackLikelyToKeepUp == true, but suspended, and after a while it starts to play.

I want to know that the player is stopped or is playing. In this case, even the player does not play the video, the status indicates that it is playing. ( AVPlayerItem.status == readyToPlay, AVPlayerItem.isPlaybackLikelyToKeepUp == true, AVPlayer.rate == 1.0)

I checked AVPlayerItem loadedTimeRangesand item.loadedTimeRanges.firstis not equal to nil (at zagruzhennogoTimeRanges there is only one element), and it startand durationare not equal to 0.

What should I check?

I add a little more.

This symptom only occurs when streaming (m3u8) not with vod (mp4).

, , . , , . , , - , isPlaybackLikelyToKeepUp == true, AVPlayerItem.status == readyToPlay. , , AVPlayer , .

, AVPlayerItem , .

, , , .

, .

https://github.com/trick14/SLPlayer

- , - VOD. , , . , , .

+4
1

-. , "". , .

, .

0

Source: https://habr.com/ru/post/1659466/


All Articles