public pause([ flag:Boolean]) : Void
Pauses or resumes playback of a stream. This method is available only to clients subscribed to the specified stream, not to the stream's publisher.
The first time you call this method on a given playlist (without sending a parameter), it pauses the playlist; the next time, it resumes play. You might want to attach this method to a button that the user clicks to pause or resume playback.
Starting with Flash Player 9 Update 3, Flash Player no longer clears the buffer when NetStream.pause() is called. Before Flash Player 9 Update 3, Flash Player waited for the buffer to fill up before resuming playback, which often caused a delay.
For a single pause, the NetStream.bufferLength property has a limit of either 60 seconds or two times the value of NetStream.bufferTime, whichever value is higher. For example, if bufferTime is 20 seconds, Flash Player buffers until NetStream.bufferLength is the higher value of either 20 *2 (40), or 60, so in this case it buffers until bufferLength is 60. If bufferTime is 40 seconds, Flash Player buffers until bufferLength is the higher value of 40 *2 (80), or 60, so in this case it buffers until bufferLength is 80 seconds.
The bufferLength property also has an absolute limit. If any call to pause() causes bufferLength to increase more than 600 seconds or the value of bufferTime * 2, whichever is higher, Flash Player flushes the buffer and resets bufferLength to 0. For example, if bufferTime is 120 seconds, Flash Player flushes the buffer if bufferLength reaches 600 seconds; if bufferTime is 360 seconds, Flash Player flushes the buffer if bufferLength reaches 720 seconds.
You can use NetStream.pause() in code to buffer data while viewers are watching a commercial, for example, and then unpause when the main video starts.For more information about the new pause behavior, see http://www.adobe.com/go/learn_fms_smartpause_en.
Flash Communication Server 1.0; Flash Player 6.
flag Optional: A Boolean value specifying whether to pause play (true) or resume play (false). If you omit this parameter, NetStream.pause() acts as a toggle: the first time it is called on a specified stream, it pauses play; the next time it is called, it resumes play.
The following examples illustrate some uses of this method:
my_ns.pause(); // pauses play first time issued my_ns.pause(); // resumes play my_ns.pause(false); // no effect, play continues my_ns.pause(); // pauses play
In the following example, suppose that you have a playlist of three recorded streams:
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://localhost/appName/appInstance");
// Create a NetStream for playing back in a Video object named my_video.
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
// to play record1
my_ns.play("record1", 0, -1, false);
// to play record2
my_ns.play("record2", 0, -1, false);
// to play record3
my_ns.play("record3", 0, -1, false);
// You click a button to pause while record2 is playing.
my_ns.pause();
// Later, you want to resume the play.
my_ns.pause();
// Later, you want to start a new playlist.
// to play record4
my_ns.play("record4", 0, -1, true);
// to play record5
my_ns.play("record5", 0, -1, false);
// to play record6
my_ns.play("record6", 0, -1, false);