5.8. The NetStream and Stream Information Objects
The onStatus( ) method of a client-side NetStream or server-side Stream object is called and passed information objects as significant stream events occur. We've already made use of many of them throughout this chapter. The properties within the information object are more formally described in Table 5-2.
Property name | Description |
---|---|
clientid | A unique server-side ID for the client |
code | A dot-separated string code for the event such as "NetStream.Buffer.Empty" |
description | A longer description of the event than provided by the code property |
details | The name of the stream |
level | The type of messageeither "status" or "error" |
The code property values are described in detail in Table 5-3 (all codes start with "NetStream.", which is omitted from the code column). Each entry shows the level value and whether the code applies to the NetStream and/or Stream class.
Code | Level | NetStream | Stream | Comments |
---|---|---|---|---|
Buffer.Empty | status | X | The stream buffer is empty. An empty buffer can mean two things on a subscribing stream. If data is not arriving as quickly as it is being played , the buffer will empty and the stream will stop audibly or visually playing until the buffer refills. If the stream has come to the end of the server so that no more data is being sent, the buffer will eventually be emptied, indicating that the stream has finished playing. For a publishing stream, an empty buffer indicates that all the stream data that was waiting in the buffer to be sent to the server has been sent. | |
Buffer.Full | status | X | The stream buffer has reached or exceeded the stream buffer time value in seconds of data. On subscribing streams, a full buffer indicates that a stream has enough stream data in it to begin audibly or visually playing. On a publishing stream, a full buffer indicates that so much data is waiting in the buffer to be sent to the server that the buffer has reached or exceeded the stream's buffer time value. | |
Clear.Failed | error | X | At least one of the stream files to be deleted by application.clearStreams( ) could not be deleted. | |
Clear.Success | status | X | A recorded stream or streams were successfully cleared by the application.clearStreams( ) method. | |
Failed | error | X | X | An attempt to use a Stream or NetStream method failed for a reason not described by another code value. |
Pause.Notify | status | X | A subscribing stream has paused playback. See also Unpause.Notify. | |
Play.Failed | error | X | A play( ) request failed for a reason not described by another code value. | |
Play.PublishNotify | status | X | If a live stream is not immediately available when NetStream objects attempt to subscribe to it, they will wait until it is. When the stream is published, all waiting subscribers receive this message. | |
Play.Reset | status | X | All pending play( ) requests have been dropped and the playlist has been reset. | |
Play.Start | status | X | Stream data has started to arrive from the server. This message is received whenever the server starts sending data to a subscribing stream. Examples include when the stream first starts to play and when it begins to play after a seek or pause. | |
Play.Stop | status | X | Stream data has stopped arriving from the server. When subscribed to a recorded stream, this code indicates the server has come to the end of the stream and does not need to send more data. | |
Play.StreamNotFound | error | X | An attempt to subscribe to a recorded stream has failed because the stream file could not be found. This code value will not be returned if the subscribing stream attempts to play a live or recorded stream using a start parameter value of -2 or omits a start parameter value entirely. | |
Play.UnpublishNotify | status | X | When a live stream stops publishing, all subscribers receive this message. | |
Publish.BadName | error | X | X | The stream could not be published because a live stream with the same name is currently being published. |
Publish.Idle | status | X | The message is received by a publisher that has not sent any data on the stream for a long time. | |
Publish.Start | status | X | Informs the publisher that the stream is being successfully published to the server. | |
Record.Failed | error | X | X | The stream could not be recorded for a reason not described by another code value. |
Record.NoAccess | error | X | X | The publisher attempted to record a stream without write access. |
Record.Start | status | X | X | Recording has started. |
Record.Stop | status | X | X | Recording has stopped. |
Seek.Failed | error | X | A subscriber's attempt to seek to a time in a stream failed. | |
Seek.Notify | status | X | A subscriber's attempt to seek to a time in a stream has succeeded. | |
Unpause.Notify | status | X | The subscriber has resumed playing a paused stream. | |
Unpublish.Success | status | X | X | Notice to the publisher that the stream has stopped publishing. |