Flash video playback, how to determine seconds loaded?
I'm trying to accurately determine how many seconds of a video (NetStream) have been loaded so I can scrub/seek correctly. First I tried doing duration*(ns.bytesLoaded/ns.bytesTotal) but this is inaccurate by maybe 15%, ie if that calculation says 20 seconds is loaded and I scrub to 20 seconds ns.time will tell me it can't go past 17 seconds.
I think this is because the size of the file loaded doesn't map perfectly to the number of seconds loaded (obviously), ie as the video loads, some of th开发者_JAVA百科e bytes loaded aren't the actual video but are overhead of the container/file the video is in. So to load 1% of video you have to actually load 1.15% of the file's size.
Anybody know a work around to determine seconds loaded?
bufferLength
indicates the number of seconds currently in the buffer. You can use this with time
to determine how much in total has been loaded.
精彩评论