Flash Media Server |
|||
| Client-Side ActionScript Language Reference for Flash Media Server 2 > Client-Side ActionScript Language Reference > NetStream class > NetStream.receiveVideo() | |||
public receiveVideo(receive: Boolean| FPS: Number) : Void
receive A Boolean value that specifies whether incoming video plays on the specified stream (true) or not (false). The default value is true.
FPS A number that specifies the frame rate per second of the incoming video. The default rate is the frame rate of the FLV file or live stream being played.
Nothing.
Method; specifies whether incoming video will play on the specified stream, or specifies the frame rate of the video. This method is available only to clients subscribed to the specified stream, not to the stream's publisher.
You can call this method before or after you call the NetStream.play() method and actually begin receiving the stream. For example, you can attach these methods to a button the user presses to show or hide the incoming video stream.
To stop receiving video, pass 0 for FPS. (This has the same effect as passing false.) To determine the current frame rate, use NetStream.currentFps.
If you call NetStream.receiveVideo() with a frame rate after calling NetStream.receiveVideo(false), an implicit call to NetStream.receiveVideo(true) is issued.
If the specified stream contains only video data, then passing a value of false to this method stops NetStream.time from further incrementing.
If you pass the FPS parameter to limit the frame rate of the video, Flash Media Server attempts to reduce the frame rate while preserving the integrity of the video. The server sends the minimum number of frames needed to satisfy the desired rate between every two keyframes. Keep in mind, however, that i-frames (or intermediate frames) must be sent contiguously; otherwise, the video will be corrupted. Therefore, the desired number of frames is sent immediately and contiguously following a keyframe. Since the frames are not evenly distributed, the motion appears smooth in segments punctuated by stalls.
The following example opens a stream and specifies that the video play at a specified rate:
var my_ns:NetStream = new NetStream(my_nc); my_ns.receiveVideo(false); // Don't display video being published. // Later.... my_ns.receiveVideo(12); // Display video at 12 FPS.
NetStream.currentFps, NetStream.receiveAudio(), NetStream.time
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/fms/2/docs/00000591.html