Agora Server Gateway SDK C++ API Reference
Public Member Functions | List of all members
agora::rtc::IRtmpConnection Class Referenceabstract

#include <NGIAgoraRtmpConnection.h>

Public Member Functions

 ~IRtmpConnection ()
 
virtual int connect (const char *url)=0
 
virtual int disconnect ()=0
 
virtual RtmpConnectionInfo getConnectionInfo ()=0
 
virtual IRtmpLocalUsergetRtmpLocalUser ()=0
 
virtual int registerObserver (IRtmpConnectionObserver *observer, void(*safeDeleter)(IRtmpConnectionObserver *)=NULL)=0
 
virtual int unregisterObserver (IRtmpConnectionObserver *observer)=0
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~IRtmpConnection()

agora::rtc::IRtmpConnection::~IRtmpConnection ( )
inline

Member Function Documentation

◆ connect()

virtual int agora::rtc::IRtmpConnection::connect ( const char *  url)
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:

  • Success: The connection state changes to STATE_CONNECTED(3), and the SDK triggers the onConnected callback.
  • Failure: The connection state changes to STATE_FAILED(5), and the SDK triggers the onConnectionFailure callback.
Parameters
urlThe address of the media push. The format is RTMP. The character length cannot exceed 1,024 bytes. Special characters such as Chinese characters are not supported.
Returns
  • 0: Success.
  • < 0: Failure.
    • -2(ERR_INVALID_ARGUMENT): The parameter is invalid.
    • -8(ERR_INVALID_STATE): The current connection state is not STATE_DISCONNECTED(1).

◆ disconnect()

virtual int agora::rtc::IRtmpConnection::disconnect ( )
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.

Returns
  • 0: Success.
  • < 0: Failure.

◆ getConnectionInfo()

virtual RtmpConnectionInfo agora::rtc::IRtmpConnection::getConnectionInfo ( )
pure virtual

Gets the connection information.

Returns

◆ getRtmpLocalUser()

virtual IRtmpLocalUser * agora::rtc::IRtmpConnection::getRtmpLocalUser ( )
pure virtual

Gets a pointer to the local user object.

Each connection corresponds to only one local user.

Returns
  • A pointer to the IRtmpLocalUser object: Success.
  • A null pointer: Failure.

◆ registerObserver()

virtual int agora::rtc::IRtmpConnection::registerObserver ( IRtmpConnectionObserver observer,
void(*)(IRtmpConnectionObserver *)  safeDeleter = NULL 
)
pure virtual

Registers the CDN connection observer.

You can call this method only after creating an IRtmpConnectionObserver object.

Parameters
observerThe pointer to the IRtmpConnectionObserver object.
Returns
  • 0: Success.
  • < 0: Failure.

◆ unregisterObserver()

virtual int agora::rtc::IRtmpConnection::unregisterObserver ( IRtmpConnectionObserver observer)
pure virtual

Releases the registered CDN connection observer.

Parameters
observerThe pointer to the IRtmpConnectionObserver object.
Returns
  • 0: Success.
  • < 0: Failure.

The documentation for this class was generated from the following file: