views:

31

answers:

1

Good day!

I can get which part of file in bytes is loaded using netstream.bytesLoaded, netstream.bytesTotal, I can get the current playing position using netstream.time. But I want to know how many seconds of video are already loaded (not the length of buffer, which remains constant).

The loaded size in bytes is not directly proportional to running time of the video.

Any help is really appriciated!

+1  A: 

It depends on the video codec / compression strategy used. I would do something naive and estimate it based on:

var secondsOfBuffer:Number = duration * (bytesLoaded/bytesTotal) - playPosition;

this would give you a rough estimate assuming the video has been encoded in a streaming format.

Jotham
For my mp4 files size is not proportional to length in seconds, I suppose that's because mp4 is adaptive. So for now I use seekpoints to estimate how much of video was loaded (in seconds).
artvolk
right, that's why i said it depends on the codec / compression strategy.
Jotham