The IRtmpConnection class.
With this class, an app can establish a connection to a RTMP server. Once connected, the app gets an RtmpUser object, which can publish media streams to the RTMP server.
Connecting to the server is done asynchronous, and apps can listen for the connection states or events with IRtmpConnectionObserver.
virtual int agora::rtc::IRtmpConnection::connect |
( |
const char * |
url | ) |
|
|
pure virtual |
Connects to a RTMP server.
When the method call succeeds, the RTMP connection state changes to STATE_CONNECTING(2).
Depending on the success or failure of the connection establishment, the RTMP connection will make a second state transition to either STATE_CONNECTED(3) or STATE_FAILED(5). You will also be notified with the either onConnected() or onDisconnected().
- Parameters
-
url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters. |
- Returns
- 0: Success.
- < 0: Failure.
- ERR_INVALID_ARGUMENT: The passed in argument is invalid.
- ERR_INVALID_STATE: The current connection state is not STATE_DISCONNECTED(3).