开发者

How get how many video (in seconds) is buffered from MP4 file (Flash, AS3)

开发者 https://www.devze.com 2023-01-06 04:35 出处:网络
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 wa开发者_开发知识库nt t

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 wa开发者_开发知识库nt 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消