Seeking in a Streaming H264 mp4 to unbuffered section.
Hi everyone. I'm working on a video player for my company, and I need to get H.264 videos streaming. I've gotten the mp4 file playing and buffering, which is great, but when I try to seek ahead to a part that isnt buffered, the video stops, goes to the start of the video, and will no longer play. FLV files behave exactly as I would like them to, meaning they go to selection position and start buffering and playing from there. Here is my progressiveSeek function:
public function progressiveSeek(pos:Number):void {
log("progressiveSeek, pos: " + pos);
if (!keyFramesSeconds) {
return;
}
var index:Number = findMatchingKeyFrame(pos);
offsetBytes = keyFramesBytes[index];
offsetSeconds = keyFramesSeconds[index];
inSeek = true;
videoStream.stop();
videoStream.close();
videoStream = null;
getVideoStream().setAutoPlay(true);
getVideoStream().setTotalTime(totalTime);
getVideoStream().setSourcePath(getStreamUrl(offsetBytes));
}
keyFramesSeconds and keyFramesBytes are just arrays that hold the metadata for the seekpoints. This function, when called on the H264, goes to the beginning and stops the video, but when called on the FLV, does what I want. How can I do progressive seek for an H264? Can anyone help me?
Thanks,
Cyrus
