Previous Page
Next Page

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.


Previous Page
Next Page
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)