I have a video player that I have been working on recently. I now have everything working except for one thing. I have a buffering icon that shows up when the player tells me that it is buffering. It works. The problem that I am having is that the MediaPlayer element doesn't always tell me when it stalls out that it is buffering. Worse, it doesn't always start playing again in this sort of situation. To determine what is going on with the player, I am creating an event listener for the MEDIA_PLAYER_STATE_CHANGE event. This is what I am currently using to determine if I should show the buffering icon or not.
On a related note, it seems that the MediaPlayer element is lying to me about what it really has buffered. The first time that I play a video, it seems to be telling the truth. By checking bufferLength, I seem to get an accurate view of when it is going to stall out because (if it is going to stall) my time slider shows the end of the buffer staying at the same location that the the player eventually stalls. The second time that my player plays, bufferLength is consistantly reporting five seconds of buffered video but I can see from my network activity that it isn't downloading anything. I have set bufferTime to be five seconds.
My questions are:
* Is there a way to get an accurate representation of what is in the buffer?
* How can I determine what is going on with the player without resorting to creating a timer that checks if the player is playing and if it is, seeing if it is actually progressing to determine if the buffering icon should show up?
based on the general presentation of the problem, here are my answers:
1. the bufferLength is telling you the truth. It's the netstream buffer it's presenting, not another buffer that you might have at another level (in your case, in the browser)
2. use somehing like: mediaPlayer.addEventListener(BufferEvent.BUFFERING_CHANGE,onBufferChange);
Please provide more detalis about the video and the code you're using if you need more detailed help.
Europe, Middle East and Africa