Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVPlayerItem strange buffer observer

I'm using AVPlayer to play streamed network audio. I observer status of the streamed item as this post:

ios avplayer trigger streaming is out of buffer

Work seems well, but I encounter a strange problem. I meet the key "playbackLikelyToKeepUp" before the key "playbackBufferEmpty". I placed a log

NSLog(@"___path: %@", path)

in the first line of the function

observeValueForKeyPath.....

and the log I received is:

...
2012-10-29 17:24:35.412 NhacSo[236:907] ___path: rate
2012-10-29 17:24:35.413 NhacSo[236:907] ___path: playbackLikelyToKeepUp
2012-10-29 17:24:35.415 NhacSo[236:907] ___path: playbackBufferEmpty
2012-10-29 17:24:35.416 NhacSo[236:907] ___path: rate
...

Do you know why I receive "playbackLikelyToKeepUp" before "playbackBufferEmpty"? Thank you!!!

like image 583
vietstone Avatar asked Dec 30 '25 22:12

vietstone


1 Answers

You receive playbackLikelyToKeepUp first because that property changes first. What I believe is confusing you is that it changes from YES to NO and not the other way around - that is, playback will no longer be able to keep up.

like image 195
emidander Avatar answered Jan 01 '26 14:01

emidander