Client-Side Communication ActionScript > NetStream.seek

 

NetStream.seek

Availability

Flash Player 6.

Flash Communication Server MX.

Usage

myRecordedStream.seek(numberOfSeconds)

Parameters

numberOfSeconds The number of seconds to move forward or backward in a recorded stream or playlist.

To return to the beginning of the stream or playlist, pass 0 for numberOfSeconds.

To seek forward from the beginning of the stream or playlist, pass the number of seconds you want to advance. For example, to position the playhead at 15 seconds from the beginning, use myStream.seek(15).

To seek relative to the current position, pass mystream.time + n or mystream.time - n to seek n seconds forward or backward, respectively, from the current position. For example, to rewind 20 seconds from the current position, use myStream.seek(mystream.time - 20).

Returns

Nothing.

Description

Method; seeks the specified number of seconds into the recorded stream that is currently playing, either from the beginning of the stream or from the current position. This method is available only to clients subscribed to the specified stream, not to the stream's publisher.

If you require an accurate return value from seeking, you may need to change the Application.xml file's "Enhanced seeking" flag at the server.

"Enhanced seeking" is a Boolean flag in the Application.xml file. By default, this flag is set to false. When a seek occurs, the server seeks to the closest video keyframe possible and starts from that keyframe. For example, if you want to seek to time 15, and there are keyframes only at time 11 and time 17, seeking actually starts from time 17 instead of time 15. This is an approximate seeking method that works well with compressed streams.

If the flag is set to true, some compression is invoked on the server. Using the example above, if the flag is set to true, then the server creates a keyframe—based on the preexisting keyframe at time 11—for each keyframe from 11 through 15. Even though a keyframe does not exist at the seek time, the server generates a keyframe. This, of course, involves some processing time on the server.

See also

NetStream.play, NetStream.time