Broccoli Products home | contact us | about us
(by Lou Burne, last updated 10-APRIL-2012)
Function Reference
Class Definitions
The following is a chart of the public functions and properties of each of the main Rtmp classes.
RtmpClient  
Public function RtmpClient Construct a new RtmpClient object.  Pass a reference to a Forms Control if you want the status change events to be invoked, otherwise pass null.
Public function CreateConnection Create a new RtmpConnection object which encapsulates a connection to an RTMP server.
Event StatusChanged An event to notify of changes to client, connection or stream. This event and its arguments are detailed below.

Note: It is more efficient to use the message preprocessing callback functions instead of Window messages.
Property EventsEnabled Set to true to enable StatusChanged events.

Setting to false if you are not using events will save computer resources.
RtmpConnection  
Property eBehaviourFlags The BehaviourFlags is set when the connection is created by calling RtmpClient.CreateConnection.

Values for can be one or more of the following:

DoNotSendHandshake Do not initialize the connection with the Rtmp handshake.

SendHandshakeButIgnoreHandshakeErrors Do the RTMP handshake, but do not throw an error if the returned data is not in the expected format.

AutoRespondToSetPeerBW Return a WindowsAckSize message for each SetPeerBW..

AutoChopUpAggregateMessages Automatic chopping up of aggregate messages as they are received.

AutoPingPong Sends back a pong for every ping received.

AutoRespondToBandwidthCheck When set, any request from the server to perform a bandwidth check is responded to, and a result message sent to the server after the bandwidth data has been received.

AutoDataAckReceivedData Enables sending of data acknowledgment messages.  These message are sent after a predefined amount of data has been received by the client.  It is one way that the server knows which clients are still listening.

AutoAdjustAggregatedMediaMsgTarget Automatic correction of message-targets in aggregated messages.  Some RTMP servers aggregate messages with a message target of zero, but with a valid message target in the aggreate message header.  Setting this property to true ensures zero message targets are replaced with the aggregate message target.

AutoAdjustAggregatedMediaTimestamps  Automatic correction of timestamps in aggregated messages for live streams.  See Bad Timestamps in Live Streams.
Property Timestamp A UInt32 property for getting the current client-side timestamp.

Used when creating your own messages.
Property ChunkSize A UInt32 property for getting the current chunk size.

Used when creating your own messages.
Property ResponseTimeout A UInt32 property for setting the time in milliseconds to wait for a "result" or "error" response form the server.
Public function Close Close the current connection. Closes all streams for this connection.
Public function IsValid Returns null if the stream is valid, otherwise returns a string description.
Public function SendMessageAndWait Send a message and wait for a response. The response expected will have the same message target as the sent message, will also have a string value for the first parameter (for example "_result" or "_onStatus"), and will be the same message type (for example, an Amf0 Command).
Public function SendMessage Send a message and return immediately.
Public function GetNextTransactionId Get the next transaction id, and increment the next transaction Id counter (2 - 0x7FFFFF).
Public function GetNextAmfStreamId Get the next Amf Stream id. Amf stream ids are rotated on the client-side (8 - 28).
Public function ConnectToApplication Connect to a streaming application on the server.
Public function CreateStream Create a new RtmpStream object.
Public function MountStream Mount a stream that has been opened by the server.

A mounted stream has an initial state of STREAMING.
Public function RegisterAutomaticStreamMountingCallback
  Register a function that will be called each time the connection begins a stream that has not been opened by the client.

Many Rtmp servers automatically begin stream 0 when a connection is made.  If the application wants to do something with that stream, it will need a reference to it.  This callback function provides that reference.

Examples of using this callback can be found in the sample project, LiveTv.
RtmpStream  
Property StreamId A UInt32 property for getting the stream id that was assigned to the stream by the RTMP server.
Property State An eState property for getting the current state. Values include Idle, Streaming, Reset, Paused, Stopped and Closed. Once a stream is closed, it cannot be re-opened.
Property AvailableAudioDataSize A UInt32 property for getting the amount of data collected in the audio data buffer.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Property AvailableVideoDataSize A UInt32 property for getting the amount of data collected in the video data buffer.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Property CollectAudioDataFlag A boolean property to enable the collecting of audio data in the audio data buffer.  Set to false by default.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Property CollectVideoDataFlag A boolean property to enable the collecting of video data in the video data buffer.  Set to false by default.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Property ForwardMetaDataFlag A boolean property which when enabled, sends a StatusChanged event when meta-data is received for this stream.
Public function IsValid Returns null if the stream is valid, otherwise returns a string description.
Public function Play Sends the play command for the stream.
Public function Pause Pause or resume streaming.
Public function Seek Seek to a time offset within the stream.
Public function Close Close the stream using the RTMP function "deleteStream".
Public function SetBufferSize Set the buffer size in milliseconds.
Public function ClearAudioCollector Clear the buffer of collected audio data.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Public function ClearVideoCollector Clear the buffer of collected video data.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Public function GetCollectedAudioData Grab collected audio data into the buffer provided.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Public function GetCollectedVideoData Grab collected video data into the buffer provided.

Note: It is more efficient to use the callback functions that the internal collector buffers.
Public function RegisterForPreProcessing Register a function as the pre-processing callback function for this stream. 

This is the most efficient method for processing data from the RtmpClient.

Requires the following:

fnCallback - The name of a callback function.

oParam - A parameter object, for the use of the parent application.

eCallbackFilterFlags - A filter identifying the types of messages to call back on.
RTMP messages
As message data is received it is translated into Rtmp messages.

Each RTMP message type has a corresponding class derived from RtmpMessage. Each message class has one or more properties for accessing the parameters of the message. Some of the message classes also have static helper functions to assist building commonly used messages.

RtmpMessage
This is an abstract top-level class. All of the message classes are based on this class.
Property AmfStreamId The Amf stream id for the message.
Property Timestamp The server-side timestamp.
Property MsgTarget The message target, which is either zero or a stream id.
Property MsgType An eMsgType property for getting the RTMP type of the message.
Property UseSmallestPossibleHeader If this property is true, the smallest possible header size is used when serializing the message to an array fo bytes.  The default value is true.
Public function ToBuffer Creates a buffer out of the message that can be sent over a socket connection.
Public function ToString Creates a string description of the message.
RtmpMessage_AudioData
The audio-data message.
Property Data A byte-array property containing the audio-data payload of the message.
Public function SetData Set the audio-data payload.
RtmpMessage_CommandAmf0     
An AMF0 command message.
Property Parameters A ParameterList property for getting a reference to the list of parameters.
Public function Static function Build_NetConnection_Connect    A static helper function for building a "connect" message.
Public function Static function Build_NetConnection_CreateStream    A static helper function for building a "createStream" message.
Public function Static function Build_NetStream_Play A static helper function for building a "play" message.
Public function Static function Build_NetStream_Pause A static helper function for building a "pause" message.
Public function Static function Build_NetStream_Seek A static helper function for building a "seek" message.
Public function Static function Build_NetStream_DeleteStream A static helper function for building a "deleteStream" message.
RtmpMessage_Control
A control-code message. Control messages are used for a variety of functions, each with their own parameter set.
Property ControlCode Set or get the ControlCode for the message, including STREAM_BEGIN, STREAM_EOF, STREAM_DRY, SET_BUFFER_SIZE, STREAM_IS_RECORDED, PING_REQUEST, PING_RESPONSE, SWFV_REQUEST,
SWFV_RESPONSE, UNKNOWN1 and UNKNOWN2.
Property StreamId The stream-id parameter for the stream control code messages.
Property PingTime The ping-time data in a ping request and returned in a ping response (a pong).
Property SetBufferLength Get and set the SetBufferLength parameter in milliseconds.
Property ResponseBuffer The response buffer for the SWFV_REQUEST and SWFV_RESPONSE control messages.
Public function Static function Build_SetBufferSize A static helper function for building a SET_BUFFER_SIZE message.
Public function Static function Build_Pong A static helper function for building a PING_RESPONSE message.
RtmpMessage_DataAck
A acknowledgement of received data.
Property Value Get or set a UInt32 value representing the amount of bytes received since the last DataAck message was sent.
Public function Static function Build A static helper function for building a DataAck message.
RtmpMessage_MetaDataAmf0
Meta-data that is streamed with the audio and video data.
Property Parameters A ParameterList property for getting a reference to the list of parameters.
RtmpMessage_SetChunkSize
A chunk-size value, sent from the RTMP server, specifying how message data will be chopped up.
Property Value A UInt32 property for getting and setting the new chunk size.
RtmpMessage_SetPeerBW
A SET_PEER_BW message.
Property eLimitType An eLimitValue property, including HARD, SOFT and DYNAMIC.
Property Value A UInt32 property for getting and setting the bandwidth value.
RtmpMessage_VideoData
The video-data message.
Property Data A byte array property containing the video-data payload of the message.
Public function SetData Set the video-data payload.
RtmpMessage_WindowAckSize
A specification of the Ack data size.
Property Value A UInt32 property for getting and setting the acknowledgement widow size in bytes.
Public function Static function Build A static helper function for building a Window-Ack-Size message.

There is one further message class, and this one does not correspond to an RTMP message type.

RtmpMessage_Raw
An Rtmp message with header and payload.
Property Payload A byte array property for accessing the payload buffer.
Public function SetPayload Set the payload buffer.

Messages that are not translated into one of the RTMP message type classes are encapsulated as a raw message, RtmpMessage_Raw.

Reasons why a message would not be translated include the following:

The message had a corrupt payload.
The messages caused the RtmpClient library to throw an exception during translation.
The message is of a type not currently supported by the RtmpClient library, including Meta Data AMF3, AMF3 Commands, Shared Object AMF0, and Abort.
The message contained parameters not currently supported by the RtmpClient library, including MovieClip, Referencer, LongString, Unsupported, Recordset, XmlDocuments and TypedObject.

When a message cannot be translated, a StatusChanged event is fired with the CannotTranslateMsg flag, and a reference to the message.

By combining StatusChanged event monitoring and message pre-processing, and using the RtmpMessage class to create your own message, any RTMP message transaction can be achieved by an external application, even if not directly supported by the RtmpClient library.
StatusChanged Events
StatusChanged events can be accessed using the RtmpClient::StatusChanged event handler.

Note: The EventsEnabled flag must be set to true to enable StatusChanged events.

The event argument for the StatusChanged event is of type RtmpEventArgs. The members of this class are detailed as follows:

PropertyHint A property of type RtmpEventArgs::eHint, describing the status change that raised the event. A table of possible values for the Hint is detailed below.

Note that eHint is an attributes flag, and can combine more than one value.
Property Stream A reference to the RtmpStream object for this event.
Property Msg A reference to the RtmpMessage for this event.

Possible values for RtmpEventArgs::eHint are as follows:

ConnectionOpened A new connection has been created.
ConnectionClosed An existing connection has been closed.
StreamOpened A new stream has been opened. The Stream property of the RtmpEventArgs will have a reference to the new stream.
StreamClosed An existing stream has been closed. The Stream property of the RtmpEventArgs will have a reference to the closed stream.
CannotTranslateMsg     A message has been received from the RTMP server that cannot be translated. The Message property of the RtmpEventArgs will have a reference to a raw message class.
AudioDataAvailable Some audio data has been stored in the stream's audio data collector. This event is only sent when the collector was previously empty. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
VideoDataAvailable See the description for AudioDataAvailable.
StreamBegin Streaming has begun. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
StreamPaused A stream has been paused. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
StreamReset A stream has been reset. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
StreamStopped A stream has stopped. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
IncomingMetaData A meta-data message has been received. The Stream property of the RtmpEventArgs will have a reference to the stream on which the data was received.
ParserTripped During translation of a received RTMP message, the RtmpClient library code fell over, and there can be no more translation of messages. This is a fatal error.
PingsExchanged A ping request was received, and a response was sent.
ReceivedDataAck A DataAck message was sent to acknowledge received data.
Contact form 
Use the contact form to send comments and requests for information to Broccoli Products.
Topic:
Message:
Email:
Broccoli Products Ltd © 1998-2012 Broccoli Products Ltd
Reg Number: 2895355
Reg Office: 27 Old Gloucester Street, London. WC1N 3AX
Privacy Policy
Copyright Notice
Liability Disclaimer
Contact Us