Recipe 16.10. Pausing and Resuming Video


Problem

You want to pause or resume video playback.

Solution

Use the pause( ) method of the NetStream class.

Discussion

The pause( ) method of the NetStream class allows you to pause and resume playback of a video. When you call the method without parameters, it toggles the pause state of the video (pauses if it's playing and resumes if it's already paused):

videoStream.pause(  );

If you pass the method a true value, the video pauses if it's currently playing, and nothing occurs if the video is already paused:

videoStream.pause(true);

Likewise, if you call the method with a false value, it resumes if the video is paused, and nothing occurs if the video is already playing:

videoStream.pause(false);

Although it's a common mistake, you should not use the play( ) method to resume playback of a paused video. The play( ) method is only used to load and start the initial playback of a video.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net