I have a custom video player I’ve built and have been adding a seek function to it lately.
I ran into an issue where seeking backward in the timeline stalled my timecode. I could seek forward and my timecode updated as expected, but seeking backward, my timecode would stall at the current time before the seek was requested.
I run a function on netStream.time() in order to set my timecode.
This is a simplified version of how I solved the issue:
var stream:NetStream = new NetStream();
stream.play(uri);
stream.seek(seekToTime);
function streamStatus(evt:NetStatusEvent):void
{
switch (evt.info.code)
{
case "NetStream.Seek.Notify":
stream.play(uri, seekToTime);
break;
}
}
In a nutshell, I use seek to initialize the change in time, listen for “NetStream.Seek.Notify”, then tell the stream to play the same file at the requested seek time.
It works like a charm. However, I’m curious if there is a drawback to doing this? Also, seek only moves to keyframes. Play seems to be able to move directly to a time. Is this also true?