Agora Server Gateway SDK C++ API Reference
|
#include <NGIAgoraRtmpConnection.h>
Public Member Functions | |
~IRtmpConnection () | |
virtual int | connect (const char *url, aosl_ref_t ares=AOSL_REF_INVALID)=0 |
virtual int | disconnect (aosl_ref_t ares=AOSL_REF_INVALID)=0 |
virtual RtmpConnectionInfo | getConnectionInfo ()=0 |
virtual IRtmpLocalUser * | getRtmpLocalUser ()=0 |
virtual int | registerObserver (IRtmpConnectionObserver *observer, void(*safeDeleter)(IRtmpConnectionObserver *)=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0 |
virtual int | unregisterObserver (IRtmpConnectionObserver *observer)=0 |
The IRtmpConnection
class. You can use this class for managing the connection between the SDK and CDN.
Once connected, your app gets an IRtmpLocalUser object for pushing audio and video streams to the CDN.
Connecting to the CDN is done asynchronously, and your app can listen for the connection states or events through IRtmpConnectionObserver.
|
inline |
|
pure virtual |
Connects to the CDN.
When the method call succeeds, the connection state changes from STATE_DISCONNECTED(1)
to STATE_CONNECTING(2)
.
Depending on whether the connection is successful, the connection state changes as follows:
STATE_CONNECTED(3)
, and the SDK triggers the onConnected callback.STATE_FAILED(5)
, and the SDK triggers the onConnectionFailure callback.url | The address of the CDN streaming. The format is RTMP. The character length cannot exceed 1,024 bytes. Special characters such as Chinese characters are not supported. |
ares | This parameter is used for the SDK lifecycle protection. Fill in the default value. |
ERR_INVALID_ARGUMENT
): The parameter is invalid.ERR_INVALID_STATE
): The current connection state is not STATE_DISCONNECTED(1)
.
|
pure virtual |
Disconnects from the CDN.
When the method call succeeds, the connection state changes to STATE_DISCONNECTED(1)
, and the SDK triggers the onDisconnected callback.
ares | This parameter is used for the SDK lifecycle protection. Fill in the default value. |
|
pure virtual |
Gets the connection information.
|
pure virtual |
Gets a pointer to the local user object.
Each connection corresponds to only one local user.
|
pure virtual |
Registers the CDN connection observer.
You can call this method only after creating an IRtmpConnectionObserver
object.
observer | The pointer to the IRtmpConnectionObserver object. |
ares | This parameter is used for the SDK lifecycle protection. Fill in the default value. |
|
pure virtual |
Releases the registered CDN connection observer.
observer | The pointer to the IRtmpConnectionObserver object. |