ProblemYou want to control the playback of a video. SolutionUse the seek( ) method of the NetStream object. DiscussionAlthough you may assume you can set the playback time by assigning a value to the time property of the NetStream object that controls the video, that won't work. As mentioned in Recipe 16.3, the time property is read-only. Rather, you must use the seek( ) method. The seek( ) method requires one parameter to specify the number of seconds from the start of the video to which you want to move the playback. The following example seeks five seconds from the start of the video before starting the playback: videoStream.seek(5); When using seek( ) with progressive download video, you can seek to only a part of the video that has downloaded. For example, if half of a 60-second video has downloaded, you can seek to 10 seconds, but you cannot seek to 50 seconds. When you use seek( ), Flash Player jumps to the nearest video keyframe to the value you specify. Videos are encoded with different keyframe rates. Higher keyframe rates have larger bandwidth requirements than lower keyframe rates. However, higher keyframe rates enables greater granularity when seeking. See AlsoRecipe 16.12 |