The NetStream object is a one-way streaming connection between the Flash player and the Flash Communication Server. The NetConnection is used with multiple one-way streams either from the Flash player or from the Flash Communication Server. A NetStream can handle video, audio, a combination, or broadcast messages. It can be used to send or receive live or recorded streams. The server can handle the NetStream object with its Stream object. To enable Code Hints and Code Completion in the Flash MX ActionScript Editor, use the suffix _ns in the name of the NetStream variable. NetStream MethodsNetStream.attachAudio(source)Publishes an audio stream to the Flash Communication Server. This method can be used with the .attachVideo method to send synchronized audio and video on one stream.
NetStream.attachVideo(source null [, snapShotMilliseconds])Publishes a video stream to the Flash Communication Server. This method can be used with the .attachAudio method to send synchronized audio and video on one stream.
NetStream.close()Destroys the stream and all publishing or subscripting activities. NetStream.pause(pauseResume)Pauses toggle a subscribed playback stream.
NetStream.play(whatToPlay false [,start [, length [, flushPlaylists]]])Plays a subscribed (received) stream from the Flash Communication Server. This method starts the feed of video and audio to the targets as determined in attachVideo and attachAudio. Calling NetStream.play() also starts the client listening for broadcast (send) messages sent in the stream.
NetStream.publish(whatToPublish false [, howToPublish])Starts or stops publishing a stream of audio, video, and broadcast messages to the server.
NetStream.receiveAudio(receive)Toggles the audio subscription of a stream.
NetStream.receiveVideo(receive FPS)Toggles the video subscription of a stream.
NetStream.seek(numberOfSeconds)Plays the movie forward or backward relative to its current play position. This method is only available with recorded streams.
NetStream.send(handlerName [,p1, ,pN])Broadcasts a message or calls a handler (function) defined on the client within the stream instance. This is a one-way broadcast and cannot handle returned objects.
NetStream.setBufferTime(numberOfSeconds)The length of time or memory reserved for an incoming (subscribed) stream before it starts playing. In the case of an outgoing (published) stream, this method allocates the length of time before frames are dropped to compensate for a slower connection.
NetStream PropertiesNetStream.bufferLength returns the number of seconds currently loaded within the stream buffer. NetStream.bufferTime returns the number of seconds available to the buffer set by NetStream.setBufferTime . NetStream.currentFps returns the frame rate, as a value of frames per second, on the publish or the subscription stream. NetStream.time is the number of seconds a stream has been playing or publishing. NetStream EventsNetStream.onStatus is invoked when the status of the NetStream changes. This event handles a NetConnection Information object described in Appendix C.Challenges to the Information object allow you to inform your user about the status of a stream or take appropriate actions in your code. |