问题
Good day!
I've faced one problem when developing my video player in AS3. I use HTTP pseudostreaming for FLV and MP4 (here is a description of pseudostreaming: http://flowplayer.org/plugins/streaming/pseudostreaming.html)
The problem: The size distribution over flv/mp4 file is not linear, so seeking based on (stream.bytesLoaded / stream.bytesTotal) * video.duration is not accurate.
My solution
For this solution we need to have keypoints\seekpoints in video file (you will need the anyway) at the beginning of the file.
User clicks on seek bar, we calculate target seek time in seconds
We check if target time is already buffered: 2.1. if so -- just seek using NetStream.seek() 2.2. if target time is not loaded -- found neares seekpoint using table of keypoints in file metadata and perform switch to the new URL with added
?start=...
Using this technique I can get accurate seek, but the overall approach is a bit tricky.
Is there any better way?
回答1:
Just in case anybody needs help on this topic, here is osmf plugin you can use to accomplish pseudostreaming using flex's videoplayer:
Github link
来源:https://stackoverflow.com/questions/7498482/accurate-seek-when-using-http-pseudostreaming-in-flash