views:

67

answers:

1

Good day!

I'm trying to determine how much of video is loaded (in seconds). When I try something (stream.bytesLoaded / stream.bytesTotal) * video.duration the result is not accurate because distribution of video stream size is not uniform inside the file.

For example if video starts with static part with video title or blank screen, the size of this part is much less (in other words compressed better) than other video with fast movements. As far as I understand MP4 is adaptive and the more movement is in the video the more space it will take.

I tried to use seek points (time + offset) defined in mp4 and it works and is really accurate, but I don't really want to depend on them.

Thanks for any advices!

A: 

You are correct video loaded may vary according to compression.

A better way to handle this might be to instead display a buffer and show the user how much of the buffer has been loaded.

Otherwise, you might need to fix the videos so that they are a constant bit rate so that you can estimate how much of your video has loaded.

Henry
The main problem, that buffer time, accessed by `NetStream.bufferLength` is always less or equal to buffer size set by `NetStream.bufferTime`. So, for example if `bufferTime = 3`, `bufferLength` can't be more than ~ 3 seconds even if 60 seconds of video are already loaded.For now I stick to use seekpoints for all calculations, I will post my solution here if nobody will come up with better solution.
artvolk