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

#include <NGIAgoraLocalUser.h>

Public Types

enum  USER_MEDIA_INFO { USER_MEDIA_INFO_MUTE_AUDIO = 0 , USER_MEDIA_INFO_MUTE_VIDEO = 1 , USER_MEDIA_INFO_ENABLE_VIDEO = 4 }
 
enum  REMOTE_USER_STATE { PEER_STATE_MUTE_AUDIO = (1 << 0) , PEER_STATE_MUTE_VIDEO = (1 << 1) , PEER_STATE_ENABLE_VIDEO = (1 << 4) , PEER_STATE_ENABLE_LOCAL_VIDEO = (1 << 8) }
 

Public Member Functions

virtual ~ILocalUserObserver ()
 
virtual void onAudioTrackPublishSuccess (agora_refptr< ILocalAudioTrack > audioTrack)=0
 
virtual void onLocalAudioTrackStateChanged (agora_refptr< rtc::ILocalAudioTrack > audioTrack, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR errorCode)=0
 
virtual void onLocalAudioTrackStatistics (const LocalAudioStats &stats)=0
 
virtual void onRemoteAudioTrackStatistics (agora_refptr< rtc::IRemoteAudioTrack > audioTrack, const RemoteAudioTrackStats &stats)=0
 
virtual void onUserAudioTrackSubscribed (user_id_t userId, agora_refptr< rtc::IRemoteAudioTrack > audioTrack)=0
 
virtual void onUserAudioTrackStateChanged (user_id_t userId, agora_refptr< rtc::IRemoteAudioTrack > audioTrack, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)=0
 
virtual void onVideoTrackPublishSuccess (agora_refptr< ILocalVideoTrack > videoTrack)=0
 
virtual void onLocalVideoTrackStateChanged (agora_refptr< rtc::ILocalVideoTrack > videoTrack, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR errorCode)=0
 
virtual void onLocalVideoTrackStatistics (agora_refptr< rtc::ILocalVideoTrack > videoTrack, const LocalVideoTrackStats &stats)=0
 
virtual void onUserVideoTrackSubscribed (user_id_t userId, VideoTrackInfo trackInfo, agora_refptr< rtc::IRemoteVideoTrack > videoTrack)=0
 
virtual void onUserVideoTrackStateChanged (user_id_t userId, agora_refptr< rtc::IRemoteVideoTrack > videoTrack, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)=0
 
virtual void onFirstRemoteVideoFrameRendered (user_id_t userId, int width, int height, int elapsed)=0
 
virtual void onRemoteVideoTrackStatistics (agora_refptr< rtc::IRemoteVideoTrack > videoTrack, const RemoteVideoTrackStats &stats)=0
 
virtual void onAudioSubscribeStateChanged (const char *channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)=0
 
virtual void onVideoSubscribeStateChanged (const char *channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)=0
 
virtual void onAudioPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)=0
 
virtual void onVideoPublishStateChanged (const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)=0
 
virtual void onFirstRemoteAudioFrame (user_id_t userId, int elapsed)=0
 
virtual void onFirstRemoteAudioDecoded (user_id_t userId, int elapsed)=0
 
virtual void onFirstRemoteVideoDecoded (user_id_t userId, int width, int height, int elapsed)=0
 
virtual void onUserInfoUpdated (user_id_t userId, USER_MEDIA_INFO msg, bool val)
 
virtual void onIntraRequestReceived ()
 
virtual void onStreamMessage (user_id_t userId, int streamId, const char *data, size_t length)
 
virtual void onUserStateChanged (user_id_t userId, uint32_t state)
 

Detailed Description

The ILocalUserObserver class.

Member Enumeration Documentation

◆ REMOTE_USER_STATE

The remote user state information.

Enumerator
PEER_STATE_MUTE_AUDIO 

The remote user has muted the audio.

PEER_STATE_MUTE_VIDEO 

The remote user has muted the video.

PEER_STATE_ENABLE_VIDEO 

The remote user has enabled the video, which includes video capturing and encoding.

PEER_STATE_ENABLE_LOCAL_VIDEO 

The remote user has enabled the local video capturing.

◆ USER_MEDIA_INFO

The media information of a specified user.

Enumerator
USER_MEDIA_INFO_MUTE_AUDIO 

0: The user has muted the audio.

USER_MEDIA_INFO_MUTE_VIDEO 

1: The user has muted the video.

USER_MEDIA_INFO_ENABLE_VIDEO 

4: The user has enabled the video, which includes video capturing and encoding.

Constructor & Destructor Documentation

◆ ~ILocalUserObserver()

virtual agora::rtc::ILocalUserObserver::~ILocalUserObserver ( )
inlinevirtual

Member Function Documentation

◆ onAudioPublishStateChanged()

virtual void agora::rtc::ILocalUserObserver::onAudioPublishStateChanged ( const char *  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
pure virtual

Occurs when the audio publish state changed.

Parameters
channelThe channel name of user joined.
oldStateThe old state of the audio stream publish : STREAM_PUBLISH_STATE.
newStateThe new state of the audio stream publish : STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ onAudioSubscribeStateChanged()

virtual void agora::rtc::ILocalUserObserver::onAudioSubscribeStateChanged ( const char *  channel,
user_id_t  userId,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
pure virtual

Occurs when the audio subscribe state changed.

Parameters
channelThe channel name of user joined.
userIdThe remote string user ID that is subscribed to.
oldStateThe old state of the audio stream subscribe : STREAM_SUBSCRIBE_STATE.
newStateThe new state of the audio stream subscribe : STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ onAudioTrackPublishSuccess()

virtual void agora::rtc::ILocalUserObserver::onAudioTrackPublishSuccess ( agora_refptr< ILocalAudioTrack audioTrack)
pure virtual

Occurs when the first packet of the local audio track is sent, indicating that the local audio track is successfully published.

Parameters
audioTrackThe pointer to ILocalAudioTrack.

◆ onFirstRemoteAudioDecoded()

virtual void agora::rtc::ILocalUserObserver::onFirstRemoteAudioDecoded ( user_id_t  userId,
int  elapsed 
)
pure virtual

Occurs when the SDK decodes the first remote audio frame for playback.

Parameters
userIdUser ID of the remote user sending the audio stream.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onFirstRemoteAudioFrame()

virtual void agora::rtc::ILocalUserObserver::onFirstRemoteAudioFrame ( user_id_t  userId,
int  elapsed 
)
pure virtual

Occurs when the first remote audio frame is received.

Parameters
userIdID of the remote user.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onFirstRemoteVideoDecoded()

virtual void agora::rtc::ILocalUserObserver::onFirstRemoteVideoDecoded ( user_id_t  userId,
int  width,
int  height,
int  elapsed 
)
pure virtual

Occurs when the SDK decodes the first remote video frame for playback.

Parameters
userIdID of the remote user.
widthWidth (px) of the video stream.
heightHeight (px) of the video stream.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onFirstRemoteVideoFrameRendered()

virtual void agora::rtc::ILocalUserObserver::onFirstRemoteVideoFrameRendered ( user_id_t  userId,
int  width,
int  height,
int  elapsed 
)
pure virtual

Occurs when the first remote video frame is rendered.

Parameters
userIdthe ID of the remote user.
widthWidth (px) of the video frame.
heightHeight (px) of the video stream.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onIntraRequestReceived()

virtual void agora::rtc::ILocalUserObserver::onIntraRequestReceived ( )
inlinevirtual

Occurs when the intra request is received from a remote user.

The method notifies the local user to encode a key frame.

◆ onLocalAudioTrackStateChanged()

virtual void agora::rtc::ILocalUserObserver::onLocalAudioTrackStateChanged ( agora_refptr< rtc::ILocalAudioTrack audioTrack,
LOCAL_AUDIO_STREAM_STATE  state,
LOCAL_AUDIO_STREAM_ERROR  errorCode 
)
pure virtual

Occurs when the state of a local audio track changes.

Parameters
audioTrackThe pointer to ILocalAudioTrack.
stateThe state of the local audio track.
errorCodeThe error information for a state failure: LOCAL_AUDIO_STREAM_ERROR.

◆ onLocalAudioTrackStatistics()

virtual void agora::rtc::ILocalUserObserver::onLocalAudioTrackStatistics ( const LocalAudioStats stats)
pure virtual

Reports the statistics of a local audio track.

Parameters
statsThe reference to the statistics of the local audio track.

◆ onLocalVideoTrackStateChanged()

virtual void agora::rtc::ILocalUserObserver::onLocalVideoTrackStateChanged ( agora_refptr< rtc::ILocalVideoTrack videoTrack,
LOCAL_VIDEO_STREAM_STATE  state,
LOCAL_VIDEO_STREAM_ERROR  errorCode 
)
pure virtual

Occurs when the state of a local video track changes.

Note
When you receive error from this callback, the corresponding track is in error state. To make the track recover from error state, we highly recommend that you disable the track and try re-enabling it again.
Parameters
videoTrackThe pointer to ILocalVideoTrack.
stateThe state of the local video track.
errorCodeThe error information.

◆ onLocalVideoTrackStatistics()

virtual void agora::rtc::ILocalUserObserver::onLocalVideoTrackStatistics ( agora_refptr< rtc::ILocalVideoTrack videoTrack,
const LocalVideoTrackStats stats 
)
pure virtual

Reports the statistics of a local video track.

Parameters
videoTrackThe pointer to ILocalVideoTrack.
statsThe statistics of the local video track.

◆ onRemoteAudioTrackStatistics()

virtual void agora::rtc::ILocalUserObserver::onRemoteAudioTrackStatistics ( agora_refptr< rtc::IRemoteAudioTrack audioTrack,
const RemoteAudioTrackStats stats 
)
pure virtual

Reports the statistics of a remote audio track.

Parameters
audioTrackThe pointer to IRemoteAudioTrack.
statsThe statistics of the remote audio track.

◆ onRemoteVideoTrackStatistics()

virtual void agora::rtc::ILocalUserObserver::onRemoteVideoTrackStatistics ( agora_refptr< rtc::IRemoteVideoTrack videoTrack,
const RemoteVideoTrackStats stats 
)
pure virtual

Reports the statistics of a remote video track.

Parameters
videoTrackThe pointer to IRemoteVideoTrack.
statsThe statistics of the remote video track.

◆ onStreamMessage()

virtual void agora::rtc::ILocalUserObserver::onStreamMessage ( user_id_t  userId,
int  streamId,
const char *  data,
size_t  length 
)
inlinevirtual

Occurs when the local user receives the data stream from the remote user.

The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.

Parameters
userIdThe ID of the remote user sending the message.
streamIdThe stream ID of the received message.
dataThe data received.
lengthThe data length (byte).

◆ onUserAudioTrackStateChanged()

virtual void agora::rtc::ILocalUserObserver::onUserAudioTrackStateChanged ( user_id_t  userId,
agora_refptr< rtc::IRemoteAudioTrack audioTrack,
REMOTE_AUDIO_STATE  state,
REMOTE_AUDIO_STATE_REASON  reason,
int  elapsed 
)
pure virtual

Occurs when the state of a remote audio track changes.

Parameters
userIdThe ID of the remote user whose audio track state has changed.
audioTrackThe pointer to IRemoteAudioTrack.
stateThe current state of the audio track.
reasonThe reason for the state change.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onUserAudioTrackSubscribed()

virtual void agora::rtc::ILocalUserObserver::onUserAudioTrackSubscribed ( user_id_t  userId,
agora_refptr< rtc::IRemoteAudioTrack audioTrack 
)
pure virtual

Occurs when the first remote audio frame is received.

This callback indicates that the local user has subscribed to a specified remote audio track, and the first frame of this audio track has been received.

Parameters
userIdThe ID of the remote user whose audio frame is received.
audioTrackThe pointer to IRemoteAudioTrack.

◆ onUserInfoUpdated()

virtual void agora::rtc::ILocalUserObserver::onUserInfoUpdated ( user_id_t  userId,
USER_MEDIA_INFO  msg,
bool  val 
)
inlinevirtual

Occurs when the user media information is updated.

Parameters
userIdThe ID of the user.
msgThe media information of the user. See USER_MEDIA_INFO.
valWhether the user is muted.

◆ onUserStateChanged()

virtual void agora::rtc::ILocalUserObserver::onUserStateChanged ( user_id_t  userId,
uint32_t  state 
)
inlinevirtual

Occurs when the remote user state is updated.

Parameters
userIdThe uid of the remote user.
stateThe remote user state.

◆ onUserVideoTrackStateChanged()

virtual void agora::rtc::ILocalUserObserver::onUserVideoTrackStateChanged ( user_id_t  userId,
agora_refptr< rtc::IRemoteVideoTrack videoTrack,
REMOTE_VIDEO_STATE  state,
REMOTE_VIDEO_STATE_REASON  reason,
int  elapsed 
)
pure virtual

Occurs when the state of a remote video track changes.

Parameters
userIdThe ID of the remote user whose video track state has changed.
videoTrackThe pointer to IRemoteVideoTrack.
stateThe current state of the video track.
reasonThe reason for the state change.
elapsedThe time (ms) since the user connects to an Agora channel.

◆ onUserVideoTrackSubscribed()

virtual void agora::rtc::ILocalUserObserver::onUserVideoTrackSubscribed ( user_id_t  userId,
VideoTrackInfo  trackInfo,
agora_refptr< rtc::IRemoteVideoTrack videoTrack 
)
pure virtual

Occurs when the first remote video frame is received.

This callback indicates that the local user has subscribed to a specified remote video track, and the first frame of this video track has been received.

Parameters
userIdThe ID of the remote user whose video frame is received.
trackInfoThe information of the remote video track.
videoTrackThe pointer to IRemoteVideoTrack.

◆ onVideoPublishStateChanged()

virtual void agora::rtc::ILocalUserObserver::onVideoPublishStateChanged ( const char *  channel,
STREAM_PUBLISH_STATE  oldState,
STREAM_PUBLISH_STATE  newState,
int  elapseSinceLastState 
)
pure virtual

Occurs when the video publish state changed.

Parameters
channelThe channel name of user joined.
oldStateThe old state of the video stream publish : STREAM_PUBLISH_STATE.
newStateThe new state of the video stream publish : STREAM_PUBLISH_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ onVideoSubscribeStateChanged()

virtual void agora::rtc::ILocalUserObserver::onVideoSubscribeStateChanged ( const char *  channel,
user_id_t  userId,
STREAM_SUBSCRIBE_STATE  oldState,
STREAM_SUBSCRIBE_STATE  newState,
int  elapseSinceLastState 
)
pure virtual

Occurs when the video subscribe state changed.

Parameters
channelThe channel name of user joined.
userIdThe remote string user ID that is subscribed to.
oldStateThe old state of the video stream subscribe : STREAM_SUBSCRIBE_STATE.
newStateThe new state of the video stream subscribe : STREAM_SUBSCRIBE_STATE.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ onVideoTrackPublishSuccess()

virtual void agora::rtc::ILocalUserObserver::onVideoTrackPublishSuccess ( agora_refptr< ILocalVideoTrack videoTrack)
pure virtual

Occurs when the first packet of a local video track is sent, indicating that the local video track is successfully published.

Parameters
videoTrackThe pointer to ILocalVideoTrack.

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