Public Types

typedef unsigned int WindowIDType
 
typedef HWND WindowIDType
 

Public Member Functions

virtual int initialize (const RtcEngineContext &context)=0
 
virtual void release (bool sync=false)=0
 
virtual int setChannelProfile (CHANNEL_PROFILE_TYPE profile)=0
 
virtual int setClientRole (CLIENT_ROLE_TYPE role)=0
 
virtual int joinChannel (const char *token, const char *channelId, const char *info, uid_t uid)=0
 
virtual int switchChannel (const char *token, const char *channelId)=0
 
virtual int leaveChannel ()=0
 
virtual int renewToken (const char *token)=0
 
virtual int queryInterface (INTERFACE_ID_TYPE iid, void **inter)=0
 
virtual int registerLocalUserAccount (const char *appId, const char *userAccount)=0
 
virtual int joinChannelWithUserAccount (const char *token, const char *channelId, const char *userAccount)=0
 
virtual int getUserInfoByUserAccount (const char *userAccount, UserInfo *userInfo)=0
 
virtual int getUserInfoByUid (uid_t uid, UserInfo *userInfo)=0
 
virtual int startEchoTest ()=0
 
virtual int startEchoTest (int intervalInSeconds)=0
 
virtual int stopEchoTest ()=0
 
virtual int enableVideo ()=0
 
virtual int disableVideo ()=0
 
virtual int setVideoProfile (VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight)=0
 
virtual int setVideoEncoderConfiguration (const VideoEncoderConfiguration &config)=0
 
virtual int setCameraCapturerConfiguration (const CameraCapturerConfiguration &config)=0
 
virtual int setupLocalVideo (const VideoCanvas &canvas)=0
 
virtual int setupRemoteVideo (const VideoCanvas &canvas)=0
 
virtual int startPreview ()=0
 
virtual int setRemoteUserPriority (uid_t uid, PRIORITY_TYPE userPriority)=0
 
virtual int stopPreview ()=0
 
virtual int enableAudio ()=0
 
virtual int enableLocalAudio (bool enabled)=0
 
virtual int disableAudio ()=0
 
virtual int setAudioProfile (AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario)=0
 
virtual int muteLocalAudioStream (bool mute)=0
 
virtual int muteAllRemoteAudioStreams (bool mute)=0
 
virtual int setDefaultMuteAllRemoteAudioStreams (bool mute)=0
 
virtual int muteRemoteAudioStream (uid_t userId, bool mute)=0
 
virtual int muteLocalVideoStream (bool mute)=0
 
virtual int enableLocalVideo (bool enabled)=0
 
virtual int muteAllRemoteVideoStreams (bool mute)=0
 
virtual int setDefaultMuteAllRemoteVideoStreams (bool mute)=0
 
virtual int muteRemoteVideoStream (uid_t userId, bool mute)=0
 
virtual int setRemoteVideoStreamType (uid_t userId, REMOTE_VIDEO_STREAM_TYPE streamType)=0
 
virtual int setRemoteDefaultVideoStreamType (REMOTE_VIDEO_STREAM_TYPE streamType)=0
 
virtual int enableAudioVolumeIndication (int interval, int smooth, bool report_vad)=0
 
virtual int startAudioRecording (const char *filePath, AUDIO_RECORDING_QUALITY_TYPE quality)=0
 
virtual int startAudioRecording (const char *filePath, int sampleRate, AUDIO_RECORDING_QUALITY_TYPE quality)=0
 
virtual int stopAudioRecording ()=0
 
virtual int startAudioMixing (const char *filePath, bool loopback, bool replace, int cycle)=0
 
virtual int stopAudioMixing ()=0
 
virtual int pauseAudioMixing ()=0
 
virtual int resumeAudioMixing ()=0
 
virtual int adjustAudioMixingVolume (int volume)=0
 
virtual int adjustAudioMixingPlayoutVolume (int volume)=0
 
virtual int getAudioMixingPlayoutVolume ()=0
 
virtual int adjustAudioMixingPublishVolume (int volume)=0
 
virtual int getAudioMixingPublishVolume ()=0
 
virtual int getAudioMixingDuration ()=0
 
virtual int getAudioMixingCurrentPosition ()=0
 
virtual int setAudioMixingPosition (int pos)=0
 
virtual int getEffectsVolume ()=0
 
virtual int setEffectsVolume (int volume)=0
 
virtual int setVolumeOfEffect (int soundId, int volume)=0
 
virtual int playEffect (int soundId, const char *filePath, int loopCount, double pitch, double pan, int gain, bool publish=false)=0
 
virtual int stopEffect (int soundId)=0
 
virtual int stopAllEffects ()=0
 
virtual int preloadEffect (int soundId, const char *filePath)=0
 
virtual int unloadEffect (int soundId)=0
 
virtual int pauseEffect (int soundId)=0
 
virtual int pauseAllEffects ()=0
 
virtual int resumeEffect (int soundId)=0
 
virtual int resumeAllEffects ()=0
 
virtual int enableSoundPositionIndication (bool enabled)=0
 
virtual int setRemoteVoicePosition (uid_t uid, double pan, double gain)=0
 
virtual int setLocalVoicePitch (double pitch)=0
 
virtual int setLocalVoiceEqualization (AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain)=0
 
virtual int setLocalVoiceReverb (AUDIO_REVERB_TYPE reverbKey, int value)=0
 
virtual int setLocalVoiceChanger (VOICE_CHANGER_PRESET voiceChanger)=0
 
virtual int setLocalVoiceReverbPreset (AUDIO_REVERB_PRESET reverbPreset)=0
 
virtual int setLogFile (const char *filePath)=0
 
virtual int setLogFilter (unsigned int filter)=0
 
virtual int setLogFileSize (unsigned int fileSizeInKBytes)=0
 
virtual int setLocalRenderMode (RENDER_MODE_TYPE renderMode)=0
 
virtual int setRemoteRenderMode (uid_t userId, RENDER_MODE_TYPE renderMode)=0
 
virtual int setLocalVideoMirrorMode (VIDEO_MIRROR_MODE_TYPE mirrorMode)=0
 
virtual int enableDualStreamMode (bool enabled)=0
 
virtual int setExternalAudioSource (bool enabled, int sampleRate, int channels)=0
 
virtual int setExternalAudioSink (bool enabled, int sampleRate, int channels)=0
 
virtual int setRecordingAudioFrameParameters (int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall)=0
 
virtual int setPlaybackAudioFrameParameters (int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall)=0
 
virtual int setMixedAudioFrameParameters (int sampleRate, int samplesPerCall)=0
 
virtual int adjustRecordingSignalVolume (int volume)=0
 
virtual int adjustPlaybackSignalVolume (int volume)=0
 
virtual int enableWebSdkInteroperability (bool enabled)=0
 
virtual int setLocalPublishFallbackOption (STREAM_FALLBACK_OPTIONS option)=0
 
virtual int setRemoteSubscribeFallbackOption (STREAM_FALLBACK_OPTIONS option)=0
 
virtual int switchCamera ()=0
 
virtual int switchCamera (CAMERA_DIRECTION direction)=0
 
virtual int setDefaultAudioRouteToSpeakerphone (bool defaultToSpeaker)=0
 
virtual int setEnableSpeakerphone (bool speakerOn)=0
 
virtual int setInEarMonitoringVolume (int volume)=0
 
virtual bool isSpeakerphoneEnabled ()=0
 
virtual int setAudioSessionOperationRestriction (AUDIO_SESSION_OPERATION_RESTRICTION restriction)=0
 
virtual int enableLoopbackRecording (bool enabled, const char *deviceName=NULL)=0
 
virtual int startScreenCaptureByDisplayId (unsigned int displayId, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
 
virtual int startScreenCaptureByScreenRect (const Rectangle &screenRect, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
 
virtual int startScreenCaptureByWindowId (view_t windowId, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
 
virtual int setScreenCaptureContentHint (VideoContentHint contentHint)=0
 
virtual int updateScreenCaptureParameters (const ScreenCaptureParameters &captureParams)=0
 
virtual int updateScreenCaptureRegion (const Rectangle &regionRect)=0
 
virtual int stopScreenCapture ()=0
 
virtual int startScreenCapture (WindowIDType windowId, int captureFreq, const Rect *rect, int bitrate)=0
 
virtual int updateScreenCaptureRegion (const Rect *rect)=0
 
virtual int getCallId (agora::util::AString &callId)=0
 
virtual int rate (const char *callId, int rating, const char *description)=0
 
virtual int complain (const char *callId, const char *description)=0
 
virtual const char * getVersion (int *build)=0
 
virtual int enableLastmileTest ()=0
 
virtual int disableLastmileTest ()=0
 
virtual int startLastmileProbeTest (const LastmileProbeConfig &config)=0
 
virtual int stopLastmileProbeTest ()=0
 
virtual const char * getErrorDescription (int code)=0
 
virtual int setEncryptionSecret (const char *secret)=0
 
virtual int setEncryptionMode (const char *encryptionMode)=0
 
virtual int registerPacketObserver (IPacketObserver *observer)=0
 
virtual int createDataStream (int *streamId, bool reliable, bool ordered)=0
 
virtual int sendStreamMessage (int streamId, const char *data, size_t length)=0
 
virtual int addPublishStreamUrl (const char *url, bool transcodingEnabled)=0
 
virtual int removePublishStreamUrl (const char *url)=0
 
virtual int setLiveTranscoding (const LiveTranscoding &transcoding)=0
 
virtual int addVideoWatermark (const RtcImage &watermark)=0
 
virtual int addVideoWatermark (const char *watermarkUrl, const WatermarkOptions &options)=0
 
virtual int clearVideoWatermarks ()=0
 
virtual int setBeautyEffectOptions (bool enabled, BeautyOptions options)=0
 
virtual int addInjectStreamUrl (const char *url, const InjectStreamConfig &config)=0
 
virtual int startChannelMediaRelay (const ChannelMediaRelayConfiguration &configuration)=0
 
virtual int updateChannelMediaRelay (const ChannelMediaRelayConfiguration &configuration)=0
 
virtual int stopChannelMediaRelay ()=0
 
virtual int removeInjectStreamUrl (const char *url)=0
 
virtual bool registerEventHandler (IRtcEngineEventHandler *eventHandler)=0
 
virtual bool unregisterEventHandler (IRtcEngineEventHandler *eventHandler)=0
 
virtual CONNECTION_STATE_TYPE getConnectionState ()=0
 
virtual int registerMediaMetadataObserver (IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type)=0
 

Protected Member Functions

virtual ~IRtcEngine ()
 

Detailed Description

IRtcEngine is the base interface class of the Agora SDK that provides the main Agora SDK methods invoked by your application.

Enable the Agora SDK's communication functionality through the creation of an IRtcEngine object, then call the methods of this object.

Member Typedef Documentation

◆ WindowIDType [1/2]

◆ WindowIDType [2/2]

Constructor & Destructor Documentation

◆ ~IRtcEngine()

virtual agora::rtc::IRtcEngine::~IRtcEngine ( )
inlineprotectedvirtual

Member Function Documentation

◆ initialize()

virtual int agora::rtc::IRtcEngine::initialize ( const RtcEngineContext context)
pure virtual

Initializes the Agora SDK service.

Ensure that you call the createAgoraRtcEngine and initialize methods before calling any other API.

Parameters
contextPointer to the RTC engine context. See RtcEngineContext.
Returns
  • 0: Success.
  • < 0: Failure.

◆ release()

virtual void agora::rtc::IRtcEngine::release ( bool  sync = false)
pure virtual

Releases all IRtcEngine resources.

Parameters
sync
  • true: (Synchronous call) The result returns after the IRtcEngine resources are released. The application should not call this method in the SDK generated callbacks. Otherwise, the SDK must wait for the callbacks to return to recover the associated IRtcEngine resources, resulting in a deadlock. The SDK automatically detects the deadlock and converts this method into an asynchronous call, causing the test to take additional time.
  • false: (Asynchronous call) The result returns immediately, even when the IRtcEngine resources have not been released. The SDK releases all resources.
Note
Do not immediately uninstall the SDK's dynamic library after the call, or it may cause a crash due to the SDK clean-up thread not quitting.

◆ setChannelProfile()

virtual int agora::rtc::IRtcEngine::setChannelProfile ( CHANNEL_PROFILE_TYPE  profile)
pure virtual

Sets the channel profile.

The SDK needs to know the application scenario to set the appropriate channel profile to apply different optimization methods.

Note
  • This method applies only to the Live-broadcast profile.
  • Users in the same channel must use the same channel profile.
  • Before calling this method to set a new channel profile, release the current engine and create a new engine using createAgoraRtcEngine() and initialize.
  • Call this method before a user joins a channel because you cannot configure the channel profile when the channel is in use.
  • In the Communication profile, the Agora SDK supports encoding only in raw data, not in texture.
Parameters
profileSets the channel profile. See CHANNEL_PROFILE_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setClientRole()

virtual int agora::rtc::IRtcEngine::setClientRole ( CLIENT_ROLE_TYPE  role)
pure virtual

Sets the role of the user, such as a host or an audience (default), before joining a channel in a live broadcast.

This method can be used to switch the user role in a live broadcast after the user joins a channel.

In the Live Broadcast profile, when a user switches user roles after joining a channel, a successful setClientRole method call triggers the following callbacks:

Note
This method applies only to the Live-broadcast profile.
Parameters
roleSets the role of the user. See CLIENT_ROLE_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ joinChannel()

virtual int agora::rtc::IRtcEngine::joinChannel ( const char *  token,
const char *  channelId,
const char *  info,
uid_t  uid 
)
pure virtual

Allows a user to join a channel.

Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.

You must call the leaveChannel method to exit the current call before entering another channel.

A successful joinChannel method call triggers the following callbacks:

  • The local client: onJoinChannelSuccess
  • The remote client: onUserJoined , if the user joining the channel is in the Communication profile, or is a BROADCASTER in the Live Broadcast profile.

When the connection between the client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the onRejoinChannelSuccess callback on the local client.

Note
A channel does not accept duplicate uids, such as two users with the same uid. If you set uid as 0, the system automatically assigns a uid. If you want to join a channel from different devices, ensure that each device has a different uid.
Warning
Ensure that the App ID used for creating the token is the same App ID used by the initialize method for initializing the RTC engine. Otherwise, the CDN live streaming may fail.
Parameters
tokenPointer to the token generated by the application server. In most circumstances, a static App ID suffices. For added security, use a Channel Key.
  • If the user uses a static App ID, token is optional and can be set as NULL.
  • If the user uses a Channel Key, Agora issues an additional App Certificate for you to generate a user key based on the algorithm and App Certificate for user authentication on the server.
channelIdPointer to the unique channel name for the Agora RTC session in the string format smaller than 64 bytes. Supported characters:
  • The 26 lowercase English letters: a to z
  • The 26 uppercase English letters: A to Z
  • The 10 numbers: 0 to 9
  • The space
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
info(Optional) Pointer to additional information about the channel. This parameter can be set to NULL or contain channel related information. Other users in the channel will not receive this message.
uid(Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to 232-1. The uid must be unique. If a uid is not assigned (or set to 0), the SDK assigns and returns a uid in the onJoinChannelSuccess callback. Your application must record and maintain the returned uid since the SDK does not do so.
Returns

◆ switchChannel()

virtual int agora::rtc::IRtcEngine::switchChannel ( const char *  token,
const char *  channelId 
)
pure virtual

Switches to a different channel.

This method allows the audience of a Live-broadcast channel to switch to a different channel.

After the user successfully switches to another channel, the onLeaveChannel and onJoinChannelSuccess callbacks are triggered to indicate that the user has left the original channel and joined a new one.

Note
This method applies to the audience role in a Live-broadcast channel only.
Parameters
tokenThe token generated at your server:
  • For low-security requirements: You can use the temporary token generated in Dashboard. For details, see Get a temporary token.
  • For high-security requirements: Use the token generated at your server. For details, see Get a token.
channelIdUnique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
  • The 26 lowercase English letters: a to z.
  • The 26 uppercase English letters: A to Z.
  • The 10 numbers: 0 to 9.
  • The space.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
Returns
  • 0: Success.
  • <0: Failure.

◆ leaveChannel()

virtual int agora::rtc::IRtcEngine::leaveChannel ( )
pure virtual

Allows a user to leave a channel, such as hanging up or exiting a call.

After joining a channel, the user must call the leaveChannel method to end the call before joining another channel.

This method returns 0 if the user leaves the channel and releases all resources related to the call.

This method call is asynchronous, and the user has not left the channel when the method call returns. Once the user leaves the channel, the SDK triggers the onLeaveChannel callback.

A successful leaveChannel method call triggers the following callbacks:

  • The local client: onLeaveChannel
  • The remote client: onUserOffline , if the user leaving the channel is in the Communication channel, or is a BROADCASTER in the Live Broadcast profile.
Note
  • If you call the release method immediately after the leaveChannel method, the leaveChannel process interrupts, and the onLeaveChannel callback is not triggered.
  • If you call the leaveChannel method during a CDN live streaming, the SDK triggers the removePublishStreamUrl method.
Returns
  • 0: Success.
  • < 0: Failure.

◆ renewToken()

virtual int agora::rtc::IRtcEngine::renewToken ( const char *  token)
pure virtual

Gets a new token when the current token expires after a period of time.

The token expires after a period of time once the token schema is enabled when:

The application should call this method to get the new token. Failure to do so will result in the SDK disconnecting from the server.

Parameters
tokenPointer to the new token.
Returns
  • 0: Success.
  • < 0: Failure.

◆ queryInterface()

virtual int agora::rtc::IRtcEngine::queryInterface ( INTERFACE_ID_TYPE  iid,
void **  inter 
)
pure virtual

Retrieves the pointer to the device manager object.

Parameters
iidID of the interface.
interPointer to the DeviceManager object.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerLocalUserAccount()

virtual int agora::rtc::IRtcEngine::registerLocalUserAccount ( const char *  appId,
const char *  userAccount 
)
pure virtual

Registers a user account.

Once registered, the user account can be used to identify the local user when the user joins the channel. After the user successfully registers a user account, the SDK triggers the onLocalUserRegistered callback on the local client, reporting the user ID and user account of the local user.

To join a channel with a user account, you can choose either of the following:

The difference between the two is that for the former, the time elapsed between calling the joinChannelWithUserAccount method and joining the channel is shorter than the latter.

Note
  • Ensure that you set the userAccount parameter. Otherwise, this method does not take effect.
  • Ensure that the value of the userAccount parameter is unique in the channel.
  • To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
Parameters
appIdThe App ID of your project.
userAccountThe user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  • The 26 lowercase English letters: a to z.
  • The 26 uppercase English letters: A to Z.
  • The 10 numbers: 0 to 9.
  • The space.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
Returns
  • 0: Success.
  • < 0: Failure.

◆ joinChannelWithUserAccount()

virtual int agora::rtc::IRtcEngine::joinChannelWithUserAccount ( const char *  token,
const char *  channelId,
const char *  userAccount 
)
pure virtual

Joins the channel with a user account.

After the user successfully joins the channel, the SDK triggers the following callbacks:

Note
To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
Parameters
tokenThe token generated at your server:
  • For low-security requirements: You can use the temporary token generated at Dashboard. For details, see Get a temporary toke.
  • For high-security requirements: Set it as the token generated at your server. For details, see Get a token.
channelIdThe channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: The 26 lowercase English letters: a to z.
  • The 26 uppercase English letters: A to Z.
  • The 10 numbers: 0 to 9.
  • The space.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
userAccountThe user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
  • The 26 lowercase English letters: a to z.
  • The 26 uppercase English letters: A to Z.
  • The 10 numbers: 0 to 9.
  • The space.
  • "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
Returns
  • 0: Success.
  • < 0: Failure.

◆ getUserInfoByUserAccount()

virtual int agora::rtc::IRtcEngine::getUserInfoByUserAccount ( const char *  userAccount,
UserInfo userInfo 
)
pure virtual

Gets the user information by passing in the user account.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (userInfo), and triggers the onUserInfoUpdated callback on the local client.

After receiving the oonUserInfoUpdated callback, you can call this method to get the user ID of the remote user from the userInfo object by passing in the user account.

Parameters
userAccountThe user account of the user. Ensure that you set this parameter.
[in/out]userInfo A userInfo object that identifies the user:
  • Input: A userInfo object.
  • Output: A userInfo object that contains the user account and user ID of the user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getUserInfoByUid()

virtual int agora::rtc::IRtcEngine::getUserInfoByUid ( uid_t  uid,
UserInfo userInfo 
)
pure virtual

Gets the user information by passing in the user ID.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (userInfo), and triggers the onUserInfoUpdated callback on the local client.

After receiving the onUserInfoUpdated callback, you can call this method to get the user account of the remote user from the userInfo object by passing in the user ID.

Parameters
uidThe user ID of the remote user. Ensure that you set this parameter.
[in/out]userInfo A userInfo object that identifies the user:
  • Input: A userInfo object.
  • Output: A userInfo object that contains the user account and user ID of the user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startEchoTest() [1/2]

virtual int agora::rtc::IRtcEngine::startEchoTest ( )
pure virtual

DEPRECATED Starts an audio call test.

This method is deprecated as of v2.4.0.

This method starts an audio call test to check whether the audio devices (for example, headset and speaker) and the network connection are working properly.

To conduct the test:

  • The user speaks and the recording is played back within 10 seconds.
  • If the user can hear the recording within 10 seconds, the audio devices and network connection are working properly.
Note
  • After calling this method, always call the stopEchoTest method to end the test. Otherwise, the application cannot run the next echo test.
  • In the Live-broadcast profile, only the hosts can call this method. If the user switches from the Communication to Live-broadcast profile, the user must call the setClientRole method to change the user role from the audience (default) to the host before calling this method.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startEchoTest() [2/2]

virtual int agora::rtc::IRtcEngine::startEchoTest ( int  intervalInSeconds)
pure virtual

Starts an audio call test.

This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.

In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.

Note
  • Call this method before joining a channel.
  • After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or call the joinChannel method.
  • In the Live-broadcast profile, only a host can call this method.
Parameters
intervalInSecondsThe time interval (s) between when you speak and when the recording plays back.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopEchoTest()

virtual int agora::rtc::IRtcEngine::stopEchoTest ( )
pure virtual

Stops the audio call test.

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

◆ enableVideo()

virtual int agora::rtc::IRtcEngine::enableVideo ( )
pure virtual

Enables the video module.

Call this method either before joining a channel or during a call. If this method is called before joining a channel, the call starts in the video mode. If this method is called during an audio call, the audio mode switches to the video mode. To disable the video module, call the disableVideo method.

A successful enableVideo method call triggers the onUserEnableVideo (true) callback on the remote client.

Note
  • This method affects the internal engine and can be called after the leaveChannel method.
  • This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the video engine modules separately:
Returns
  • 0: Success.
  • < 0: Failure.

◆ disableVideo()

virtual int agora::rtc::IRtcEngine::disableVideo ( )
pure virtual

Disables the video module.

This method can be called before joining a channel or during a call. If this method is called before joining a channel, the call starts in audio mode. If this method is called during a video call, the video mode switches to the audio mode. To enable the video module, call the enableVideo method.

A successful disableVideo method call triggers the onUserEnableVideo (false) callback on the remote client.

Note
  • This method affects the internal engine and can be called after the leaveChannel method.
  • This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the video engine modules separately:
Returns
  • 0: Success.
  • < 0: Failure.

◆ setVideoProfile()

virtual int agora::rtc::IRtcEngine::setVideoProfile ( VIDEO_PROFILE_TYPE  profile,
bool  swapWidthAndHeight 
)
pure virtual

DEPRECATED Sets the video profile.

This method is deprecated as of v2.3. Use the setVideoEncoderConfiguration method instead.

Each video profile includes a set of parameters, such as the resolution, frame rate, and bitrate. If the camera device does not support the specified resolution, the SDK automatically chooses a suitable camera resolution, keeping the encoder resolution specified by the setVideoProfile method.

Note
  • If you do not need to set the video profile after joining the channel, call this method before the enableVideo method to reduce the render time of the first video frame.
  • Always set the video profile before calling the joinChannel or startPreview method.
Parameters
profileSets the video profile. See VIDEO_PROFILE_TYPE.
swapWidthAndHeightSets whether to swap the width and height of the video stream:
  • true: Swap the width and height.
  • false: (Default) Do not swap the width and height. The width and height of the output video are consistent with the set video profile.
Note
Since the landscape or portrait mode of the output video can be decided directly by the video profile, We recommend setting swapWidthAndHeight to false (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ setVideoEncoderConfiguration()

virtual int agora::rtc::IRtcEngine::setVideoEncoderConfiguration ( const VideoEncoderConfiguration config)
pure virtual

Sets the video encoder configuration.

Each video encoder configuration corresponds to a set of video parameters, including the resolution, frame rate, bitrate, and video orientation.

The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.

Note
If you do not need to set the video encoder configuration after joining the channel, you can call this method before the enableVideo method to reduce the render time of the first video frame.
Parameters
configSets the local video encoder configuration. See VideoEncoderConfiguration.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setCameraCapturerConfiguration()

virtual int agora::rtc::IRtcEngine::setCameraCapturerConfiguration ( const CameraCapturerConfiguration config)
pure virtual

Sets the camera capture configuration.

For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capturer settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capturer configuration:

  • If the resolution or frame rate of the captured raw video data are higher than those set by setVideoEncoderConfiguration, processing video frames requires extra CPU and RAM usage and degrades performance. We recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to avoid such problems.
  • If you do not need local video preview or are willing to sacrifice preview quality, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1 to optimize CPU and RAM usage.
  • If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW = 2.
Note
Call this method before enabling the local camera. That said, you can call this method before calling joinChannel, enableVideo, or enableLocalVideo, depending on which method you use to turn on your local camera.
Parameters
configSets the camera capturer configuration. See CameraCapturerConfiguration.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setupLocalVideo()

virtual int agora::rtc::IRtcEngine::setupLocalVideo ( const VideoCanvas canvas)
pure virtual

Sets the local video view and configures the video display settings on the local machine.

The application calls this method to bind each video window (view) of the local video streams and configures the video display settings. Call this method after initialization to configure the local video display settings before joining a channel. The binding is still valid after the user leaves the channel, which means that the window still displays. To unbind the view, set the view in VideoCanvas to NULL.

Parameters
canvasPointer to the local video view and settings. See VideoCanvas.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setupRemoteVideo()

virtual int agora::rtc::IRtcEngine::setupRemoteVideo ( const VideoCanvas canvas)
pure virtual

Sets the remote video view.

This method binds the remote user to the video display window (sets the view for the remote user by the specified uid in VideoCanvas).

The application specifies the uid of the remote video in this method before the remote user joins the channel.

If the remote uid is unknown to the application, set it after the application receives the onUserJoined callback.

If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. If your application does not recognize the dummy client, bind the remote user to the view when the SDK triggers the onFirstRemoteVideoDecoded callback.

To unbind the remote user from the view, set the view in VideoCanvas to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user.

Parameters
canvasPointer to the remote video view and settings. See VideoCanvas.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startPreview()

virtual int agora::rtc::IRtcEngine::startPreview ( )
pure virtual

Starts the local video preview before joining the channel.

Before calling this method, you must:

  • Call the setupLocalVideo method to set up the local preview window and configure the attributes.
  • Call the enableVideo method to enable video.
Note
Once the startPreview method is called to start the local video preview, if you leave the channel by calling the leaveChannel method, the local video preview remains until you call the stopPreview method to disable it.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteUserPriority()

virtual int agora::rtc::IRtcEngine::setRemoteUserPriority ( uid_t  uid,
PRIORITY_TYPE  userPriority 
)
pure virtual

Prioritizes a remote user's stream.

Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.

Note
The Agora SDK supports setting userPriority as high for one user only.
Parameters
uidThe ID of the remote user.
userPrioritySets the priority of the remote user. See PRIORITY_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopPreview()

virtual int agora::rtc::IRtcEngine::stopPreview ( )
pure virtual

Stops the local video preview and disables video.

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

◆ enableAudio()

virtual int agora::rtc::IRtcEngine::enableAudio ( )
pure virtual

Enables the audio module.

The audio mode is enabled by default.

Note
  • This method affects the internal engine and can be called after the leaveChannel method. You can call this method either before or after joining a channel.
  • This method resets the internal engine and takes some time to take effect. We recommend using the following API methods to control the audio engine modules separately:
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableLocalAudio()

virtual int agora::rtc::IRtcEngine::enableLocalAudio ( bool  enabled)
pure virtual

Disables/Re-enables the local audio function.

The audio function is enabled by default. This method disables or re-enables the local audio function, that is, to stop or restart local audio capturing.

This method does not affect receiving or playing the remote audio streams,and enableLocalAudio(false) is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.

The SDK triggers the onMicrophoneEnabled callback once the local audio function is disabled or enabled.

Note
  • Call this method after the joinChannel method.
  • This method is different from the muteLocalAudioStream method:
    • enableLocalAudio: Disables/Re-enables the local audio capturing and processing. If you disable or re-enable local audio recording using the enableLocalAudio method, the local user may hear a pause in the remote audio playback.
    • muteLocalAudioStream: Sends/Stops sending the local audio streams.
  • After you disable local audio recording using the enableLocalAudio(false) method, the system volume switches to the media volume. Re-enabling local audio recording using the enableLocalAudio(true) method switches the system volume back to the in-call volume.
Parameters
enabledSets whether to disable/re-enable the local audio function:
  • true: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone).
  • false: Disable the local audio function, that is, to stop local audio capturing.
Returns
  • 0: Success.
  • < 0: Failure.

◆ disableAudio()

virtual int agora::rtc::IRtcEngine::disableAudio ( )
pure virtual

Disables the audio module.

Note
  • This method affects the internal engine and can be called after the leaveChannel method. You can call this method either before or after joining a channel.
  • This method resets the internal engine and takes some time to take effect. We recommend using the enableLocalAudio and muteLocalAudioStream methods to capture, process, and send the local audio streams.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setAudioProfile()

virtual int agora::rtc::IRtcEngine::setAudioProfile ( AUDIO_PROFILE_TYPE  profile,
AUDIO_SCENARIO_TYPE  scenario 
)
pure virtual

Sets the audio parameters and application scenarios.

Note
  • The setAudioProfile method must be called before the joinChannel method.
  • In the Communication and Live-broadcast profiles, the bitrate may be different from your settings due to network self-adaptation.
  • In scenarios involving music education, we recommend setting profile as AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) and scenario as AUDIO_SCENARIO_GAME_STREAMING (3).
Parameters
profileSets the sample rate, bitrate, encoding mode, and the number of channels. See AUDIO_PROFILE_TYPE.
scenarioSets the audio application scenario. See AUDIO_SCENARIO_TYPE. Under different audio scenarios, the device uses different volume tracks, i.e. either the in-call volume or the media volume. For details, see What is the difference between the in-call volume and the media volume?.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteLocalAudioStream()

virtual int agora::rtc::IRtcEngine::muteLocalAudioStream ( bool  mute)
pure virtual

Stops/Resumes sending the local audio stream.

A successful muteLocalAudioStream method call triggers the onUserMuteAudio callback on the remote client.

Note
When mute is set as true, this method does not disable the microphone, which does not affect any ongoing recording.
Parameters
muteSets whether to send/stop sending the local audio stream:
  • true: Stops sending the local audio stream.
  • false: (Default) Sends the local audio stream.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteAllRemoteAudioStreams()

virtual int agora::rtc::IRtcEngine::muteAllRemoteAudioStreams ( bool  mute)
pure virtual

Stops/Resumes receiving all remote users' audio streams.

Parameters
muteSets whether to receive/stop receiving all remote users' audio streams.
  • true: Stops receiving all remote users' audio streams.
  • false: (Default) Receives all remote users' audio streams.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setDefaultMuteAllRemoteAudioStreams()

virtual int agora::rtc::IRtcEngine::setDefaultMuteAllRemoteAudioStreams ( bool  mute)
pure virtual

Stops/Resumes receiving all remote users' audio streams by default.

Parameters
muteSets whether to receive/stop receiving all remote users' audio streams by default:
  • true: Stops receiving all remote users' audio streams by default.
  • false: (Default) Receives all remote users' audio streams by default.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteRemoteAudioStream()

virtual int agora::rtc::IRtcEngine::muteRemoteAudioStream ( uid_t  userId,
bool  mute 
)
pure virtual

Stops/Resumes receiving a specified remote user's audio stream.

Note
If you called the muteAllRemoteAudioStreams method and set mute as true to stop receiving all remote users' audio streams, call the muteAllRemoteAudioStreams method and set mute as false before calling this method. The muteAllRemoteAudioStreams method sets all remote audio streams, while the muteRemoteAudioStream method sets a specified remote audio stream.
Parameters
userIdUser ID of the specified remote user sending the audio.
muteSets whether to receive/stop receiving a specified remote user's audio stream:
  • true: Stops receiving the specified remote user's audio stream.
  • false: (Default) Receives the specified remote user's audio stream.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteLocalVideoStream()

virtual int agora::rtc::IRtcEngine::muteLocalVideoStream ( bool  mute)
pure virtual

Stops/Resumes sending the local video stream.

A successful muteLocalVideoStream method call triggers the onUserMuteVideo callback on the remote client.

Note
When set to true, this method does not disable the camera which does not affect the retrieval of the local video streams. This method executes faster than the enableLocalVideo method which controls the sending of the local video stream.
Parameters
muteSets whether to send/stop sending the local video stream:
  • true: Stop sending the local video stream.
  • false: (Default) Send the local video stream.
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableLocalVideo()

virtual int agora::rtc::IRtcEngine::enableLocalVideo ( bool  enabled)
pure virtual

Enables/Disables the local video capture.

This method disables or re-enables the local video capturer, and does not affect receiving the remote video stream.

After you call the enableVideo method, the local video capturer is enabled by default. You can call enableLocalVideo(false) to disable the local video capturer. If you want to re-enable it, call enableLocalVideo(true).

After the local video capturer is successfully disabled or re-enabled, the SDK triggers the onUserEnableLocalVideo callback on the remote client.

Note
This method affects the internal engine and can be called after the leaveChannel method.
Parameters
enabledSets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
  • true: (Default) Re-enable the local video.
  • false: Disable the local video. Once the local video is disabled, the remote users can no longer receive the video stream of this user, while this user can still receive the video streams of the other remote users.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteAllRemoteVideoStreams()

virtual int agora::rtc::IRtcEngine::muteAllRemoteVideoStreams ( bool  mute)
pure virtual

Stops/Resumes receiving all video stream from a specified remote user.

Parameters
muteSets whether to receive/stop receiving all remote users' video streams:
  • true: Stop receiving all remote users' video streams.
  • false: (Default) Receive all remote users' video streams.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setDefaultMuteAllRemoteVideoStreams()

virtual int agora::rtc::IRtcEngine::setDefaultMuteAllRemoteVideoStreams ( bool  mute)
pure virtual

Stops/Resumes receiving all remote users' video streams by default.

Parameters
muteSets whether to receive/stop receiving all remote users' video streams by default:
  • true: Stop receiving all remote users' video streams by default.
  • false: (Default) Receive all remote users' video streams by default.
Returns
  • 0: Success.
  • < 0: Failure.

◆ muteRemoteVideoStream()

virtual int agora::rtc::IRtcEngine::muteRemoteVideoStream ( uid_t  userId,
bool  mute 
)
pure virtual

Stops/Resumes receiving the video stream from a specified remote user.

Note
If you called the muteAllRemoteVideoStreams method and set mute as true to stop receiving all remote video streams, call the muteAllRemoteVideoStreams method and set mute as false before calling this method.
Parameters
userIdUser ID of the specified remote user.
muteSets whether to stop/resume receiving the video stream from a specified remote user:
  • true: Stop receiving the specified remote user's video stream.
  • false: (Default) Receive the specified remote user's video stream.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteVideoStreamType()

virtual int agora::rtc::IRtcEngine::setRemoteVideoStreamType ( uid_t  userId,
REMOTE_VIDEO_STREAM_TYPE  streamType 
)
pure virtual

Sets the remote user's video stream type received by the local user when the remote user sends dual streams.

This method allows the application to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.

  • If the remote user enables the dual-stream mode by calling the enableDualStreamMode method, the SDK receives the high-stream video by default.
  • If the dual-stream mode is not enabled, the SDK receives the high-stream video by default.

The method result returns in the onApiCallExecuted callback. The SDK receives the high-stream video by default to reduce the bandwidth. If needed, users may use this method to switch to the low-stream video. By default, the aspect ratio of the low-stream video is the same as the high-stream video. Once the resolution of the high-stream video is set, the system automatically sets the resolution, frame rate, and bitrate of the low-stream video.

Parameters
userIdID of the remote user sending the video stream.
streamTypeSets the video-stream type. See REMOTE_VIDEO_STREAM_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteDefaultVideoStreamType()

virtual int agora::rtc::IRtcEngine::setRemoteDefaultVideoStreamType ( REMOTE_VIDEO_STREAM_TYPE  streamType)
pure virtual

Sets the default video-stream type for the video received by the local user when the remote user sends dual streams.

  • If the dual-stream mode is enabled by calling the enableDualStreamMode method, the user receives the high-stream video by default. The setRemoteDefaultVideoStreamType method allows the application to adjust the corresponding video-stream type according to the size of the video window, reducing the bandwidth and resources.
  • If the dual-stream mode is not enabled, the user receives the high-stream video by default.

The result after calling this method is returned in the onApiCallExecuted callback. The Agora SDK receives the high-stream video by default to reduce the bandwidth. If needed, users can switch to the low-stream video through this method.

Parameters
streamTypeSets the default video-stream type. See REMOTE_VIDEO_STREAM_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableAudioVolumeIndication()

virtual int agora::rtc::IRtcEngine::enableAudioVolumeIndication ( int  interval,
int  smooth,
bool  report_vad 
)
pure virtual

Enables the onAudioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.

Once this method is enabled, the SDK returns the volume indication in the onAudioVolumeIndication callback at the set time interval, whether or not any user is speaking in the channel.

Parameters
intervalSets the time interval between two consecutive volume indications:
  • ≤ 0: Disables the volume indication.
  • > 0: Time interval (ms) between two consecutive volume indications. We recommend setting interval > 200 ms. Do not set interval < 10 ms, or the onAudioVolumeIndication callback will not be triggered.
smoothSmoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3.
report_vad
  • true: Enable the voice activity detection of the local user. Once it is enabled, the vad parameter of the onAudioVolumeIndication callback reports the voice activity status of the local user.
  • false: (Default) Disable the voice activity detection of the local user. Once it is disabled, the vad parameter of the onAudioVolumeIndication callback does not report the voice activity status of the local user, except for the scenario where the engine automatically detects the voice activity of the local user.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startAudioRecording() [1/2]

virtual int agora::rtc::IRtcEngine::startAudioRecording ( const char *  filePath,
AUDIO_RECORDING_QUALITY_TYPE  quality 
)
pure virtual

DEPRECATED Starts an audio recording. Use startAudioRecording2 instead.

The SDK allows recording during a call. Supported formats:

  • .wav: Large file size with high fidelity.
  • .aac: Small file size with low fidelity.

This method has a fixed sample rate of 32 kHz.

Ensure that the directory to save the recording file exists and is writable. This method is usually called after the joinChannel method. The recording automatically stops when the leaveChannel method is called.

Parameters
filePathPointer to the absolute file path of the recording file. The string of the file name is in UTF-8.
qualitySets the audio recording quality. See AUDIO_RECORDING_QUALITY_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ startAudioRecording() [2/2]

virtual int agora::rtc::IRtcEngine::startAudioRecording ( const char *  filePath,
int  sampleRate,
AUDIO_RECORDING_QUALITY_TYPE  quality 
)
pure virtual

Starts an audio recording on the client.

The SDK allows recording during a call. After successfully calling this method, you can record the audio of all the users in the channel and get an audio recording file. Supported formats of the recording file are as follows:

  • .wav: Large file size with high fidelity.
  • .aac: Small file size with low fidelity.
Note
  • Ensure that the directory you use to save the recording file exists and is writable.
  • This method is usually called after the joinChannel method. The recording automatically stops when you call the leaveChannel method.
  • For better recording effects, set quality as AUDIO_RECORDING_QUALITY_MEDIUM or AUDIO_RECORDING_QUALITY_HIGH when sampleRate is 44.1 kHz or 48 kHz.
Parameters
filePathPointer to the absolute file path of the recording file. The string of the file name is in UTF-8.
sampleRateSample rate (kHz) of the recording file. Supported values are as follows:
  • 16
  • (Default) 32
  • 44.1
  • 48
qualitySets the audio recording quality. See AUDIO_RECORDING_QUALITY_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopAudioRecording()

virtual int agora::rtc::IRtcEngine::stopAudioRecording ( )
pure virtual

Stops an audio recording on the client.

You can call this method before calling the leaveChannel method else, the recording automatically stops when the leaveChannel method is called.

Returns
  • 0: Success
  • < 0: Failure.

◆ startAudioMixing()

virtual int agora::rtc::IRtcEngine::startAudioMixing ( const char *  filePath,
bool  loopback,
bool  replace,
int  cycle 
)
pure virtual

Starts playing and mixing the music file.

This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone's audio stream with the specified local audio file. You can choose whether the other user can hear the local audio playback and specify the number of playback loops. This method also supports online music playback.

When the audio mixing file playback finishes after calling this method, the SDK triggers the onAudioMixingFinished callback.

A successful startAudioMixing method call triggers the onAudioMixingStateChanged (PLAY) callback on the local client.

When the audio mixing file playback finishes, the SDK triggers the onAudioMixingStateChanged (STOPPED) callback on the local client.

Note
  • Call this method when you are in a channel.
  • If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR = 701.
Parameters
filePathPointer to the absolute path of the local or online audio file to mix. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MPEG-4, SAMI, and WAVE. For more information, see Supported Media Formats in Media Foundation.
loopbackSets which user can hear the audio mixing:
  • true: Only the local user can hear the audio mixing.
  • false: Both users can hear the audio mixing.
replaceSets the audio mixing content:
  • true: Only the specified audio file is published; the audio stream received by the microphone is not published.
  • false: The local audio file is mixed with the audio stream from the microphone.
cycleSets the number of playback loops:
  • Positive integer: Number of playback loops.
  • -1: Infinite playback loops.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopAudioMixing()

virtual int agora::rtc::IRtcEngine::stopAudioMixing ( )
pure virtual

Stops playing and mixing the music file.

Call this method when you are in a channel.

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

◆ pauseAudioMixing()

virtual int agora::rtc::IRtcEngine::pauseAudioMixing ( )
pure virtual

Pauses playing and mixing the music file.

Call this method when you are in a channel.

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

◆ resumeAudioMixing()

virtual int agora::rtc::IRtcEngine::resumeAudioMixing ( )
pure virtual

Resumes playing and mixing the music file.

Call this method when you are in a channel.

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

◆ adjustAudioMixingVolume()

virtual int agora::rtc::IRtcEngine::adjustAudioMixingVolume ( int  volume)
pure virtual

Adjusts the volume during audio mixing.

Call this method when you are in a channel.

Note
Calling this method does not affect the volume of audio effect file playback invoked by the playEffect method.
Parameters
volumeAudio mixing volume. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ adjustAudioMixingPlayoutVolume()

virtual int agora::rtc::IRtcEngine::adjustAudioMixingPlayoutVolume ( int  volume)
pure virtual

Adjusts the audio mixing volume for local playback.

Note
Call this method when you are in a channel.
Parameters
volumeAudio mixing volume for local playback. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ getAudioMixingPlayoutVolume()

virtual int agora::rtc::IRtcEngine::getAudioMixingPlayoutVolume ( )
pure virtual

Retrieves the audio mixing volume for local playback.

This method helps troubleshoot audio volume related issues.

Note
Call this method when you are in a channel.
Returns
  • ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
  • < 0: Failure.

◆ adjustAudioMixingPublishVolume()

virtual int agora::rtc::IRtcEngine::adjustAudioMixingPublishVolume ( int  volume)
pure virtual

Adjusts the audio mixing volume for publishing (for remote users).

Note
Call this method when you are in a channel.
Parameters
volumeAudio mixing volume for publishing. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ getAudioMixingPublishVolume()

virtual int agora::rtc::IRtcEngine::getAudioMixingPublishVolume ( )
pure virtual

Retrieves the audio mixing volume for publishing.

This method helps troubleshoot audio volume related issues.

Note
Call this method when you are in a channel.
Returns
  • ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100].
  • < 0: Failure.

◆ getAudioMixingDuration()

virtual int agora::rtc::IRtcEngine::getAudioMixingDuration ( )
pure virtual

Retrieves the duration (ms) of the music file.

Call this method when you are in a channel.

Returns
  • ≥ 0: The audio mixing duration, if this method call succeeds.
  • < 0: Failure.

◆ getAudioMixingCurrentPosition()

virtual int agora::rtc::IRtcEngine::getAudioMixingCurrentPosition ( )
pure virtual

Retrieves the playback position (ms) of the music file.

Call this method when you are in a channel.

Returns
  • ≥ 0: The current playback position of the audio mixing, if this method call succeeds.
  • < 0: Failure.

◆ setAudioMixingPosition()

virtual int agora::rtc::IRtcEngine::setAudioMixingPosition ( int  pos)
pure virtual

Sets the playback position of the music file to a different starting position (the default plays from the beginning).

Parameters
posThe playback starting position (ms) of the music file.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getEffectsVolume()

virtual int agora::rtc::IRtcEngine::getEffectsVolume ( )
pure virtual

Retrieves the volume of the audio effects.

The value ranges between 0.0 and 100.0.

Returns
  • ≥ 0: Volume of the audio effects, if this method call succeeds.
  • < 0: Failure.

◆ setEffectsVolume()

virtual int agora::rtc::IRtcEngine::setEffectsVolume ( int  volume)
pure virtual

Sets the volume of the audio effects.

Parameters
volumeSets the volume of the audio effects. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ setVolumeOfEffect()

virtual int agora::rtc::IRtcEngine::setVolumeOfEffect ( int  soundId,
int  volume 
)
pure virtual

Sets the volume of a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
volumeSets the volume of the specified audio effect. The value ranges between 0 and 100 (default).
Returns
  • 0: Success.
  • < 0: Failure.

◆ playEffect()

virtual int agora::rtc::IRtcEngine::playEffect ( int  soundId,
const char *  filePath,
int  loopCount,
double  pitch,
double  pan,
int  gain,
bool  publish = false 
)
pure virtual

Plays a specified local or online audio effect file.

This method allows you to set the loop count, pitch, pan, and gain of the audio effect file, as well as whether the remote user can hear the audio effect.

To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time.

Parameters
soundIdID of the specified audio effect. Each audio effect has a unique ID.
Note
  • If the audio effect is preloaded into the memory through the preloadEffect method, the value of soundID must be the same as that in the preloadEffect method.
  • Playing multiple online audio effect files simultaneously is not supported on macOS and Windows.
Parameters
filePathThe absolute path to the local audio effect file or the URL of the online audio effect file.
loopCountSets the number of times the audio effect loops:
  • 0: Play the audio effect once.
  • 1: Play the audio effect twice.
  • -1: Play the audio effect in an indefinite loop until the stopEffect or stopAllEffects method is called.
pitchSets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch.
panSets the spatial position of the audio effect. The value ranges between -1.0 and 1.0:
  • 0.0: The audio effect displays ahead.
  • 1.0: The audio effect displays to the right.
  • -1.0: The audio effect displays to the left.
gainSets the volume of the audio effect. The value ranges between 0 and 100 (default). The lower the value, the lower the volume of the audio effect.
publishSets whether or not to publish the specified audio effect to the remote stream:
  • true: The locally played audio effect is published to the Agora Cloud and the remote users can hear it.
  • false: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopEffect()

virtual int agora::rtc::IRtcEngine::stopEffect ( int  soundId)
pure virtual

Stops playing a specified audio effect.

Parameters
soundIdID of the audio effect to stop playing. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopAllEffects()

virtual int agora::rtc::IRtcEngine::stopAllEffects ( )
pure virtual

Stops playing all audio effects.

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

◆ preloadEffect()

virtual int agora::rtc::IRtcEngine::preloadEffect ( int  soundId,
const char *  filePath 
)
pure virtual

Preloads a specified audio effect file into the memory.

Note
This method does not support online audio effect files.

To ensure smooth communication, limit the size of the audio effect file. We recommend using this method to preload the audio effect before calling the joinChannel method.

Supported audio formats: mp3, aac, m4a, 3gp, and wav.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
filePathPointer to the absolute path of the audio effect file.
Returns
  • 0: Success.
  • < 0: Failure.

◆ unloadEffect()

virtual int agora::rtc::IRtcEngine::unloadEffect ( int  soundId)
pure virtual

Releases a specified preloaded audio effect from the memory.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pauseEffect()

virtual int agora::rtc::IRtcEngine::pauseEffect ( int  soundId)
pure virtual

Pauses a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ pauseAllEffects()

virtual int agora::rtc::IRtcEngine::pauseAllEffects ( )
pure virtual

Pauses all audio effects.

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

◆ resumeEffect()

virtual int agora::rtc::IRtcEngine::resumeEffect ( int  soundId)
pure virtual

Resumes playing a specified audio effect.

Parameters
soundIdID of the audio effect. Each audio effect has a unique ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ resumeAllEffects()

virtual int agora::rtc::IRtcEngine::resumeAllEffects ( )
pure virtual

Resumes playing all audio effects.

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

◆ enableSoundPositionIndication()

virtual int agora::rtc::IRtcEngine::enableSoundPositionIndication ( bool  enabled)
pure virtual

Enables/Disables stereo panning for remote users.

Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling setRemoteVoicePosition.

Parameters
enabledSets whether or not to enable stereo panning for remote users:
  • true: enables stereo panning.
  • false: disables stereo panning.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteVoicePosition()

virtual int agora::rtc::IRtcEngine::setRemoteVoicePosition ( uid_t  uid,
double  pan,
double  gain 
)
pure virtual

Sets the sound position and gain of a remote user.

When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.

Note
  • For this method to work, enable stereo panning for remote users by calling the enableSoundPositionIndication method before joining a channel.
  • This method requires hardware support. For the best sound positioning, we recommend using a stereo speaker.
Parameters
uidThe ID of the remote user.
panThe sound position of the remote user. The value ranges from -1.0 to 1.0:
  • 0.0: the remote sound comes from the front.
  • -1.0: the remote sound comes from the left.
  • 1.0: the remote sound comes from the right.
gainGain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVoicePitch()

virtual int agora::rtc::IRtcEngine::setLocalVoicePitch ( double  pitch)
pure virtual

Changes the voice pitch of the local speaker.

Parameters
pitchSets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch).
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVoiceEqualization()

virtual int agora::rtc::IRtcEngine::setLocalVoiceEqualization ( AUDIO_EQUALIZATION_BAND_FREQUENCY  bandFrequency,
int  bandGain 
)
pure virtual

Sets the local voice equalization effect.

Parameters
bandFrequencySets the band frequency. The value ranges between 0 and 9, representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. See AUDIO_EQUALIZATION_BAND_FREQUENCY.
bandGainSets the gain of each band in dB. The value ranges between -15 and 15.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVoiceReverb()

virtual int agora::rtc::IRtcEngine::setLocalVoiceReverb ( AUDIO_REVERB_TYPE  reverbKey,
int  value 
)
pure virtual

Sets the local voice reverberation.

v2.4.0 adds the setLocalVoiceReverbPreset method, a more user-friendly method for setting the local voice reverberation. You can use this method to set the local reverberation effect, such as pop music, R&B, rock music, and hip-hop.

Parameters
reverbKeySets the reverberation key. See AUDIO_REVERB_TYPE.
valueSets the value of the reverberation key.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVoiceChanger()

virtual int agora::rtc::IRtcEngine::setLocalVoiceChanger ( VOICE_CHANGER_PRESET  voiceChanger)
pure virtual

Sets the local voice changer option.

Note
Do not use this method together with the setLocalVoiceReverbPreset method, because the method called later overrides the one called earlier.
Parameters
voiceChangerSets the local voice changer option. See VOICE_CHANGER_PRESET.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVoiceReverbPreset()

virtual int agora::rtc::IRtcEngine::setLocalVoiceReverbPreset ( AUDIO_REVERB_PRESET  reverbPreset)
pure virtual

Sets the preset local voice reverberation effect.

Note
  • Do not use this method together with setLocalVoiceReverb.
  • Do not use this method together with the setLocalVoiceChanger method, because the method called later overrides the one called earlier.
Parameters
reverbPresetSets the preset audio reverberation configuration. See AUDIO_REVERB_PRESET.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLogFile()

virtual int agora::rtc::IRtcEngine::setLogFile ( const char *  filePath)
pure virtual

Specifies an SDK output log file.

The log file records all SDK operations during runtime. If it does not exist, the SDK creates one.

Note
  • The default log file is located at: C:\Users<user_name>\AppData\Local\Agora<process_name>.
  • Ensure that you call this method immediately after calling the initialize method, otherwise the output log may not be complete.
Parameters
filePathFile path of the log file. The string of the log file is in UTF-8.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLogFilter()

virtual int agora::rtc::IRtcEngine::setLogFilter ( unsigned int  filter)
pure virtual

Sets the output log level of the SDK.

You can use one or a combination of the log filter levels. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level.

If you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.

Parameters
filterSets the log filter level. See LOG_FILTER_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLogFileSize()

virtual int agora::rtc::IRtcEngine::setLogFileSize ( unsigned int  fileSizeInKBytes)
pure virtual

Sets the log file size (KB).

The SDK has two log files, each with a default size of 512 KB. If you set fileSizeInBytes as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.

Parameters
fileSizeInKBytesThe SDK log file size (KB).
Returns
  • 0: Success.
  • <0: Failure.

◆ setLocalRenderMode()

virtual int agora::rtc::IRtcEngine::setLocalRenderMode ( RENDER_MODE_TYPE  renderMode)
pure virtual

Sets the local video display mode.

This method can be called multiple times during a call to change the display mode.

Parameters
renderModeSets the local video display mode. See RENDER_MODE_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteRenderMode()

virtual int agora::rtc::IRtcEngine::setRemoteRenderMode ( uid_t  userId,
RENDER_MODE_TYPE  renderMode 
)
pure virtual

Sets the video display mode of a specified remote user.

This method can be called multiple times during a call to change the display mode.

Parameters
userIdID of the remote user.
renderModeSets the video display mode. See RENDER_MODE_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalVideoMirrorMode()

virtual int agora::rtc::IRtcEngine::setLocalVideoMirrorMode ( VIDEO_MIRROR_MODE_TYPE  mirrorMode)
pure virtual

Sets the local video mirror mode.

You must call this method before calling the startPreview method, otherwise the mirror mode will not work.

Parameters
mirrorModeSets the local video mirror mode. See VIDEO_MIRROR_MODE_TYPE.
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableDualStreamMode()

virtual int agora::rtc::IRtcEngine::enableDualStreamMode ( bool  enabled)
pure virtual

Sets the stream mode to the single-stream (default) or dual-stream mode. (Live broadcast only.)

If the dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution and high-bitrate video stream), or the low stream (low-resolution and low-bitrate video stream).

Parameters
enabledSets the stream mode:
  • true: Dual-stream mode.
  • false: (Default) Single-stream mode.

◆ setExternalAudioSource()

virtual int agora::rtc::IRtcEngine::setExternalAudioSource ( bool  enabled,
int  sampleRate,
int  channels 
)
pure virtual

Sets the external audio source. Please call this method before joinChannel.

Parameters
enabledSets whether to enable/disable the external audio source:
  • true: Enables the external audio source.
  • false: (Default) Disables the external audio source.
sampleRateSets the sample rate of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
channelsSets the audio channels of the external audio source (two channels maximum).
Returns
  • 0: Success.
  • < 0: Failure.

◆ setExternalAudioSink()

virtual int agora::rtc::IRtcEngine::setExternalAudioSink ( bool  enabled,
int  sampleRate,
int  channels 
)
pure virtual

Sets the external audio sink. This method applies to scenarios where you want to use external audio data for playback. After enabling the external audio sink, you can call the pullAudioFrame method to pull the remote audio data, process it, and play it with the audio effects that you want.

Note
Once you enable the external audio sink, the app will not retrieve any audio data from the onPlaybackAudioFrame callback.
Parameters
enabled
  • true: Enables the external audio sink.
  • false: (Default) Disables the external audio sink.
sampleRateSets the sample rate of the external audio sink. You can set this parameter as 8000, 16000, 32000, 44100 or 48000.
channelsSets the number of audio channels of the external audio sink:
  • 1: Mono.
  • 2: Stereo.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRecordingAudioFrameParameters()

virtual int agora::rtc::IRtcEngine::setRecordingAudioFrameParameters ( int  sampleRate,
int  channel,
RAW_AUDIO_FRAME_OP_MODE_TYPE  mode,
int  samplesPerCall 
)
pure virtual

Sets the audio recording format for the onRecordAudioFrame callback.

Parameters
sampleRateSets the sample rate (samplesPerSec) returned in the onRecordAudioFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
channelSets the number of audio channels (channels) returned in the onRecordAudioFrame callback:
  • 1: Mono
  • 2: Stereo
modeSets the use mode (see RAW_AUDIO_FRAME_OP_MODE_TYPE) of the onRecordAudioFrame callback.
samplesPerCallSets the sample points (samples) returned in the onRecordAudioFrame callback. samplesPerCall is usually set as 1024 for stream pushing.

samplesPerCall = (int)(samplesPerSec × sampleInterval × numChannels), where sampleInterval ≥ 0.01 in seconds.

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

◆ setPlaybackAudioFrameParameters()

virtual int agora::rtc::IRtcEngine::setPlaybackAudioFrameParameters ( int  sampleRate,
int  channel,
RAW_AUDIO_FRAME_OP_MODE_TYPE  mode,
int  samplesPerCall 
)
pure virtual

Sets the audio playback format for the onPlaybackAudioFrame callback.

Parameters
sampleRateSets the sample rate (samplesPerSec) returned in the onPlaybackAudioFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
channelSets the number of channels (channels) returned in the onPlaybackAudioFrame callback:
  • 1: Mono
  • 2: Stereo
modeSets the use mode (see RAW_AUDIO_FRAME_OP_MODE_TYPE) of the onPlaybackAudioFrame callback.
samplesPerCallSets the sample points (samples) returned in the onPlaybackAudioFrame callback. samplesPerCall is usually set as 1024 for stream pushing.

samplesPerCall = (int)(samplesPerSec × sampleInterval × numChannels), where sampleInterval ≥ 0.01 in seconds.

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

◆ setMixedAudioFrameParameters()

virtual int agora::rtc::IRtcEngine::setMixedAudioFrameParameters ( int  sampleRate,
int  samplesPerCall 
)
pure virtual

Sets the mixed audio format for the onMixedAudioFrame callback.

Parameters
sampleRateSets the sample rate (samplesPerSec) returned in the onMixedAudioFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
samplesPerCallSets the sample points (samples) returned in the onMixedAudioFrame callback. samplesPerCall is usually set as 1024 for stream pushing.

samplesPerCall = (int)(samplesPerSec × sampleInterval × numChannels), where sampleInterval ≥ 0.01 in seconds.

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

◆ adjustRecordingSignalVolume()

virtual int agora::rtc::IRtcEngine::adjustRecordingSignalVolume ( int  volume)
pure virtual

Adjusts the recording volume.

Parameters
volumeRecording volume. The value ranges between 0 and 400:
  • 0: Mute.
  • 100: Original volume.
  • 400: (Maximum) Four times the original volume with signal clipping protection.
Returns
  • 0: Success.
  • < 0: Failure.

◆ adjustPlaybackSignalVolume()

virtual int agora::rtc::IRtcEngine::adjustPlaybackSignalVolume ( int  volume)
pure virtual

Adjusts the playback volume of the voice.

Parameters
volumeThe playback volume of the voice. The value ranges between 0 and 400:
  • 0: Mute.
  • 100: Original volume.
  • 400: (Maximum) Four times the original volume with signal clipping protection.
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableWebSdkInteroperability()

virtual int agora::rtc::IRtcEngine::enableWebSdkInteroperability ( bool  enabled)
pure virtual

Enables interoperability with the Agora Web SDK.

Note
This method applies only to the Live-broadcast profile. In the Communication profile, interoperability with the Agora Web SDK is enabled by default.
Parameters
enabledSets whether to enable/disable interoperability with the Agora Web SDK:
  • true: Enable.
  • false: (Default) Disable.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLocalPublishFallbackOption()

virtual int agora::rtc::IRtcEngine::setLocalPublishFallbackOption ( STREAM_FALLBACK_OPTIONS  option)
pure virtual

Sets the fallback option for the locally published video stream based on the network conditions.

If option is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK will:

  • Disable the upstream video but enable audio only when the network conditions deteriorate and cannot support both video and audio.
  • Re-enable the video when the network conditions improve.

When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the onLocalPublishFallbackToAudioOnly callback.

Note
Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the locally published video stream falls back to audio only.
Parameters
optionSets the fallback option for the locally published video stream:
  • STREAM_FALLBACK_OPTION_DISABLED (0): (Default) No fallback behavior for the locally published video stream when the uplink network condition is poor. The stream quality is not guaranteed.
  • STREAM_FALLBACK_OPTION_AUDIO_ONLY (2): The locally published video stream falls back to audio only when the uplink network condition is poor.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setRemoteSubscribeFallbackOption()

virtual int agora::rtc::IRtcEngine::setRemoteSubscribeFallbackOption ( STREAM_FALLBACK_OPTIONS  option)
pure virtual

Sets the fallback option for the remotely subscribed video stream based on the network conditions.

The default setting for option is STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW (1), where the remotely subscribed video stream falls back to the low-stream video (low resolution and low bitrate) under poor downlink network conditions.

If option is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve.

When the remotely subscribed video stream falls back to audio only or when the audio-only stream switches back to the video stream, the SDK triggers the onRemoteSubscribeFallbackToAudioOnly callback.

Parameters
optionSets the fallback option for the remotely subscribed video stream. See STREAM_FALLBACK_OPTIONS.
Returns
  • 0: Success.
  • < 0: Failure.

◆ switchCamera() [1/2]

virtual int agora::rtc::IRtcEngine::switchCamera ( )
pure virtual

Switches between front and rear cameras.

Note
This method is for Android and iOS only.
Returns
  • 0: Success.
  • < 0: Failure.

◆ switchCamera() [2/2]

virtual int agora::rtc::IRtcEngine::switchCamera ( CAMERA_DIRECTION  direction)
pure virtual

Switches between front and rear cameras.

Note
This method is for Android and iOS only, and it is private.
Parameters
directionSets the camera to be used:
  • CAMERA_DIRECTION.CAMERA_REAR: Use the rear camera.
  • CAMERA_DIRECTION.CAMERA_FRONT: Use the front camera.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setDefaultAudioRouteToSpeakerphone()

virtual int agora::rtc::IRtcEngine::setDefaultAudioRouteToSpeakerphone ( bool  defaultToSpeaker)
pure virtual

Sets the default audio playback route.

This method sets whether the received audio is routed to the earpiece or speakerphone by default before joining a channel. If a user does not call this method, the audio is routed to the earpiece by default. If you need to change the default audio route after joining a channel, call the setEnableSpeakerphone method.

The default setting for each mode:

  • Voice: Earpiece.
  • Video: Speakerphone. If a user who is in the Communication profile calls the disableVideo method or if the user calls the muteLocalVideoStream and muteAllRemoteVideoStreams methods, the default audio route switches back to the earpiece automatically.
  • Live Broadcast: Speakerphone.
  • Gaming Voice: Speakerphone.
Note
  • This method is for Android and iOS only.
  • This method only works in audio mode.
  • Call this method before calling the joinChannel method.
  • Regardless of whether the audio is routed to the speakerphone or earpiece by default, once a headset is plugged in or Bluetooth device is connected, the default audio route changes. The default audio route switches to the earpiece once removing the headset or disconnecting the Bluetooth device.
Parameters
defaultToSpeakerSets the default audio route:
  • true: Speakerphone.
  • false: (Default) Earpiece.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setEnableSpeakerphone()

virtual int agora::rtc::IRtcEngine::setEnableSpeakerphone ( bool  speakerOn)
pure virtual

Enables/Disables the audio playback route to the speakerphone.

This method sets whether the audio is routed to the speakerphone or earpiece.

See the default audio route explanation in the setDefaultAudioRouteToSpeakerphone method and check whether it is necessary to call this method.

Note
  • This method is for Android and iOS only.
  • Ensure that you have successfully called the joinChannel method before calling this method.
  • After calling this method, the SDK returns the onAudioRouteChanged callback to indicate the changes.
  • This method does not take effect if a headset is used.
Parameters
speakerOnSets whether to route the audio to the speakerphone or earpiece:
  • true: Route the audio to the speakerphone.
  • false: Route the audio to the earpiece.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setInEarMonitoringVolume()

virtual int agora::rtc::IRtcEngine::setInEarMonitoringVolume ( int  volume)
pure virtual

Sets the volume of the in-ear monitor.

Parameters
volumeSets the volume of the in-ear monitor. The value ranges between 0 and 100 (default).
Note
This method is for Android and iOS only.
Returns
  • 0: Success.
  • < 0: Failure.

◆ isSpeakerphoneEnabled()

virtual bool agora::rtc::IRtcEngine::isSpeakerphoneEnabled ( )
pure virtual

Checks whether the speakerphone is enabled.

Note
This method is for Android and iOS only.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setAudioSessionOperationRestriction()

virtual int agora::rtc::IRtcEngine::setAudioSessionOperationRestriction ( AUDIO_SESSION_OPERATION_RESTRICTION  restriction)
pure virtual

Sets the audio session’s operational restriction.

The SDK and the app can both configure the audio session by default. The app may occasionally use other apps or third-party components to manipulate the audio session and restrict the SDK from doing so. This method allows the app to restrict the SDK’s manipulation of the audio session.

You can call this method at any time to return the control of the audio sessions to the SDK.

Note
  • This method is for iOS only.
  • This method restricts the SDK’s manipulation of the audio session. Any operation to the audio session relies solely on the app, other apps, or third-party components.
Parameters
restrictionThe operational restriction (bit mask) of the SDK on the audio session. See AUDIO_SESSION_OPERATION_RESTRICTION.
Returns
  • 0: Success.
  • < 0: Failure.

◆ enableLoopbackRecording()

virtual int agora::rtc::IRtcEngine::enableLoopbackRecording ( bool  enabled,
const char *  deviceName = NULL 
)
pure virtual

Enables loopback recording.

If you enable loopback recording, the output of the sound card is mixed into the audio stream sent to the other end.

Parameters
enabledSets whether to enable/disable loopback recording.
  • true: Enable loopback recording.
  • false: (Default) Disable loopback recording.
deviceNamePointer to the device name of the sound card. The default value is NULL (the default sound card).
Note
  • This method is for macOS and Windows only.
  • macOS does not support loopback recording of the default sound card. If you need to use this method, please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower.

◆ startScreenCaptureByDisplayId()

virtual int agora::rtc::IRtcEngine::startScreenCaptureByDisplayId ( unsigned int  displayId,
const Rectangle regionRect,
const ScreenCaptureParameters captureParams 
)
pure virtual

Shares the whole or part of a screen by specifying the display ID.

Note
This method is for macOS only.
Parameters
displayIdThe display ID of the screen to be shared. This parameter specifies which screen you want to share.
regionRect(Optional) Sets the relative location of the region to the screen. NIL means sharing the whole screen. See Rectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
captureParamsSets the screen sharing encoding parameters. See ScreenCaptureParameters.
Returns
  • 0: Success.
  • < 0: Failure:
    • ERR_INVALID_STATE: the screen sharing state is invalid, probably because another screen or window is being shared. Call stopScreenCapture to stop the current screen sharing.
    • ERR_INVALID_ARGUMENT: the argument is invalid.

◆ startScreenCaptureByScreenRect()

virtual int agora::rtc::IRtcEngine::startScreenCaptureByScreenRect ( const Rectangle screenRect,
const Rectangle regionRect,
const ScreenCaptureParameters captureParams 
)
pure virtual

Shares the whole or part of a screen by specifying the screen rect.

Parameters
screenRectSets the relative location of the screen to the virtual screen. For information on how to get screenRect, see Share the Screen.
regionRect(Optional) Sets the relative location of the region to the screen. NULL means sharing the whole screen. See Rectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
captureParamsSets the screen sharing encoding parameters. See ScreenCaptureParameters.
Returns
  • 0: Success.
  • < 0: Failure:
    • ERR_INVALID_STATE: the screen sharing state is invalid, probably because another screen or window is being shared. Call stopScreenCapture to stop the current screen sharing.
    • ERR_INVALID_ARGUMENT: the argument is invalid.

◆ startScreenCaptureByWindowId()

virtual int agora::rtc::IRtcEngine::startScreenCaptureByWindowId ( view_t  windowId,
const Rectangle regionRect,
const ScreenCaptureParameters captureParams 
)
pure virtual

Shares the whole or part of a window by specifying the window ID.

Parameters
windowIdThe ID of the window to be shared. For information on how to get the windowId, see Share the Screen.
regionRect(Optional) The relative location of the region to the window. NULL/NIL means sharing the whole window. See Rectangle. If the specified region overruns the window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole window.
captureParamsWindow sharing encoding parameters. See ScreenCaptureParameters.
Returns
  • 0: Success.
  • < 0: Failure:
    • ERR_INVALID_STATE: the window sharing state is invalid, probably because another screen or window is being shared. Call stopScreenCapture to stop sharing the current window.
    • ERR_INVALID_ARGUMENT: the argument is invalid.

◆ setScreenCaptureContentHint()

virtual int agora::rtc::IRtcEngine::setScreenCaptureContentHint ( VideoContentHint  contentHint)
pure virtual

Sets the content hint for screen sharing.

A content hint suggests the type of the content being shared, so that the SDK applies different optimization algorithm to different types of content.

Parameters
contentHintSets the content hint for screen sharing. See VideoContentHint.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateScreenCaptureParameters()

virtual int agora::rtc::IRtcEngine::updateScreenCaptureParameters ( const ScreenCaptureParameters captureParams)
pure virtual

Updates the screen sharing parameters.

Parameters
captureParamsSets the screen sharing encoding parameters. See ScreenCaptureParameters.
Returns
  • 0: Success.
  • < 0: Failure:

◆ updateScreenCaptureRegion() [1/2]

virtual int agora::rtc::IRtcEngine::updateScreenCaptureRegion ( const Rectangle regionRect)
pure virtual

Updates the screen sharing region.

Parameters
regionRectSets the relative location of the region to the screen or window. NULL means sharing the whole screen or window. See Rectangle. If the specified region overruns the screen or window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen or window.
Returns
  • 0: Success.
  • < 0: Failure:

◆ stopScreenCapture()

virtual int agora::rtc::IRtcEngine::stopScreenCapture ( )
pure virtual

Stop screen sharing.

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

◆ startScreenCapture()

virtual int agora::rtc::IRtcEngine::startScreenCapture ( WindowIDType  windowId,
int  captureFreq,
const Rect rect,
int  bitrate 
)
pure virtual

DEPRECATED Starts screen sharing.

This method is deprecated as of v2.4.0. See the following methods instead:

This method shares the whole screen, specified window, or specified region:

  • Whole screen: Set windowId as 0 and rect as NULL.
  • Specified window: Set windowId as a value other than 0. Each window has a windowId that is not 0.
  • Specified region: Set windowId as 0 and rect not as NULL. In this case, you can share the specified region, for example by dragging the mouse or implementing your own logic.
Note
The specified region is a region on the whole screen. Currently, sharing a specified region in a specific window is not supported. captureFreq* is the captured frame rate once the screen-sharing function is enabled. The mandatory value ranges between 1 fps and 15 fps.
Parameters
windowIdSets the screen sharing area. See WindowIDType.
captureFreq(Mandatory) The captured frame rate. The value ranges between 1 fps and 15 fps.
rectSpecifies the screen-sharing region. rect is valid when windowsId is set as 0. When rect is set as NULL, the whole screen is shared.
bitrateThe captured bitrate.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateScreenCaptureRegion() [2/2]

virtual int agora::rtc::IRtcEngine::updateScreenCaptureRegion ( const Rect rect)
pure virtual

DEPRECATED Updates the screen capture region.

Parameters
rectSpecifies the required region inside the screen or window.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getCallId()

virtual int agora::rtc::IRtcEngine::getCallId ( agora::util::AString callId)
pure virtual

Retrieves the current call ID.

When a user joins a channel on a client, a callId is generated to identify the call from the client. Feedback methods, such as rate and complain, must be called after the call ends to submit feedback to the SDK.

The rate and complain methods require the callId parameter retrieved from the getCallId method during a call. callId is passed as an argument into the rate and complain methods after the call ends.

Parameters
callIdPointer to the current call ID.
Returns
  • 0: Success.
  • < 0: Failure.

◆ rate()

virtual int agora::rtc::IRtcEngine::rate ( const char *  callId,
int  rating,
const char *  description 
)
pure virtual

Allows a user to rate a call after the call ends.

Parameters
callIdPointer to the ID of the call, retrieved from the getCallId method.
ratingRating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the ERR_INVALID_ARGUMENT (2) error returns.
description(Optional) Pointer to the description of the rating, with a string length of less than 800 bytes.
Returns
  • 0: Success.
  • < 0: Failure.

◆ complain()

virtual int agora::rtc::IRtcEngine::complain ( const char *  callId,
const char *  description 
)
pure virtual

Allows a user to complain about the call quality after a call ends.

Parameters
callIdPointer to the ID of the call, retrieved from the getCallId method.
description(Optional) Pointer to the description of the complaint, with a string length of less than 800 bytes.
Returns
  • 0: Success.
  • < 0: Failure.

◆ getVersion()

virtual const char* agora::rtc::IRtcEngine::getVersion ( int *  build)
pure virtual

Retrieves the SDK version number.

Parameters
buildPointer to the build number.
Returns
The version of the current SDK in the string format. For example, 2.3.1.

◆ enableLastmileTest()

virtual int agora::rtc::IRtcEngine::enableLastmileTest ( )
pure virtual

Enables the network connection quality test.

This method tests the quality of the users' network connections and is disabled by default.

Before a user joins a channel or before an audience switches to a host, call this method to check the uplink network quality.

This method consumes additional network traffic, and hence may affect communication quality.

Call the disableLastmileTest method to disable this test after receiving the onLastmileQuality callback, and before joining a channel.

Note
  • Do not call any other methods before receiving the onLastmileQuality callback. Otherwise, the callback may be interrupted by other methods, and hence may not be triggered.
  • A host should not call this method after joining a channel (when in a call).
  • If you call this method to test the last-mile quality, the SDK consumes the bandwidth of a video stream, whose bitrate corresponds to the bitrate you set in the setVideoEncoderConfiguration method. After you join the channel, whether you have called the disableLastmileTest method or not, the SDK automatically stops consuming the bandwidth.
Returns
  • 0: Success.
  • < 0: Failure.

◆ disableLastmileTest()

virtual int agora::rtc::IRtcEngine::disableLastmileTest ( )
pure virtual

Disables the network connection quality test.

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

◆ startLastmileProbeTest()

virtual int agora::rtc::IRtcEngine::startLastmileProbeTest ( const LastmileProbeConfig config)
pure virtual

Starts the last-mile network probe test.

This method starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).

Call this method to check the uplink network quality before users join a channel or before an audience switches to a host. Once this method is enabled, the SDK returns the following callbacks:

  • onLastmileQuality: the SDK triggers this callback within two seconds depending on the network conditions. This callback rates the network conditions and is more closely linked to the user experience.
  • onLastmileProbeResult: the SDK triggers this callback within 30 seconds depending on the network conditions. This callback returns the real-time statistics of the network conditions and is more objective.
Note
  • This method consumes extra network traffic and may affect communication quality. We do not recommend calling this method together with enableLastmileTest.
  • Do not call other methods before receiving the onLastmileQuality and onLastmileProbeResult callbacks. Otherwise, the callbacks may be interrupted.
  • In the Live-broadcast profile, a host should not call this method after joining a channel.
Parameters
configSets the configurations of the last-mile network probe test. See LastmileProbeConfig.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopLastmileProbeTest()

virtual int agora::rtc::IRtcEngine::stopLastmileProbeTest ( )
pure virtual

Stops the last-mile network probe test.

◆ getErrorDescription()

virtual const char* agora::rtc::IRtcEngine::getErrorDescription ( int  code)
pure virtual

Retrieves the warning or error description.

Returns
code WARN_CODE_TYPE or ERROR_CODE_TYPE returned in the onWarning or onError callback.

◆ setEncryptionSecret()

virtual int agora::rtc::IRtcEngine::setEncryptionSecret ( const char *  secret)
pure virtual

Enables built-in encryption with an encryption password before users join a channel.

All users in a channel must use the same encryption password. The encryption password is automatically cleared once a user leaves the channel.

If an encryption password is not specified, the encryption functionality will be disabled.

Note
  • Do not use this method for CDN live streaming.
  • For optimal transmission, ensure that the encrypted data size does not exceed the original data size + 16 bytes. 16 bytes is the maximum padding size for AES encryption.
Parameters
secretPointer to the encryption password.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setEncryptionMode()

virtual int agora::rtc::IRtcEngine::setEncryptionMode ( const char *  encryptionMode)
pure virtual

Sets the built-in encryption mode.

The Agora SDK supports built-in encryption, which is set to the aes-128-xts mode by default. Call this method to use other encryption modes.

All users in the same channel must use the same encryption mode and password.

Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.

Note
Call the setEncryptionSecret method to enable the built-in encryption function before calling this method.
Parameters
encryptionModePointer to the set encryption mode:
  • "aes-128-xts": (Default) 128-bit AES encryption, XTS mode.
  • "aes-128-ecb": 128-bit AES encryption, ECB mode.
  • "aes-256-xts": 256-bit AES encryption, XTS mode.
  • "": When encryptionMode is set as NULL, the encryption mode is set as "aes-128-xts" by default.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerPacketObserver()

virtual int agora::rtc::IRtcEngine::registerPacketObserver ( IPacketObserver observer)
pure virtual

Registers a packet observer.

The Agora SDK allows your application to register a packet observer to receive callbacks for voice or video packet transmission.

Parameters
observerPointer to the registered packet observer. See IPacketObserver.
Returns
  • 0: Success.
  • < 0: Failure.

◆ createDataStream()

virtual int agora::rtc::IRtcEngine::createDataStream ( int *  streamId,
bool  reliable,
bool  ordered 
)
pure virtual

Creates a data stream.

Each user can create up to five data streams during the lifecycle of the RtcEngine.

Note
Set both the reliable and ordered parameters to true or false. Do not set one as true and the other as false.
Parameters
streamIdPointer to the ID of the created data stream.
reliableSets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
  • true: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the application.
  • false: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream.
orderedSets whether or not the recipients receive the data stream in the sent order:
  • true: The recipients receive the data stream in the sent order.
  • false: The recipients do not receive the data stream in the sent order.
Returns
  • Returns 0: Success.
  • < 0: Failure.

◆ sendStreamMessage()

virtual int agora::rtc::IRtcEngine::sendStreamMessage ( int  streamId,
const char *  data,
size_t  length 
)
pure virtual

Sends data stream messages to all users in a channel.

The SDK has the following restrictions on this method:

  • Up to 30 packets can be sent per second in a channel with each packet having a maximum size of 1 kB.
  • Each client can send up to 6 kB of data per second.
  • Each user can have up to five data streams simultaneously.

A successful sendStreamMessage method call triggers the onStreamMessage callback on the remote client, from which the remote user gets the stream message.

A failed sendStreamMessage method call triggers the onStreamMessage callback on the remote client.

Note
This method applies only to the Communication profile or to the hosts in the Live-broadcast profile. If an audience in the Live-broadcast profile calls this method, the audience may be switched to a host.
Parameters
streamIdID of the sent data stream, returned in the createDataStream method.
dataPointer to the sent data.
lengthLength of the sent data.
Returns
  • 0: Success.
  • < 0: Failure.

◆ addPublishStreamUrl()

virtual int agora::rtc::IRtcEngine::addPublishStreamUrl ( const char *  url,
bool  transcodingEnabled 
)
pure virtual

Publishes the local stream to a specified CDN live RTMP address. (CDN live only.)

The SDK returns the result of this method call in the onStreamPublished callback.

The addPublishStreamUrl method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.

Note
  • Ensure that the user joins the channel before calling this method.
  • This method adds only one stream RTMP URL address each time it is called.
  • The RTMP URL address must not contain special characters, such as Chinese language characters.
  • This method applies to Live Broadcast only.
Parameters
urlThe CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.
transcodingEnabledSets whether transcoding is enabled/disabled:
  • true: Enable transcoding. To transcode the audio or video streams when publishing them to CDN live, often used for combining the audio and video streams of multiple hosts in CDN live.
  • false: Disable transcoding.
Returns
  • 0: Success.
  • < 0: Failure.

◆ removePublishStreamUrl()

virtual int agora::rtc::IRtcEngine::removePublishStreamUrl ( const char *  url)
pure virtual

Removes an RTMP stream from the CDN. (CDN live only.)

This method removes the RTMP URL address (added by the addPublishStreamUrl method) from a CDN live stream. The SDK returns the result of this method call in the onStreamUnpublished callback.

The removePublishStreamUrl method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of removing an RTMP stream from the CDN.

Note
  • This method removes only one RTMP URL address each time it is called.
  • The RTMP URL address must not contain special characters, such as Chinese language characters.
  • This method applies to Live Broadcast only.
Parameters
urlThe RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes.
Returns
  • 0: Success.
  • < 0: Failure.

◆ setLiveTranscoding()

virtual int agora::rtc::IRtcEngine::setLiveTranscoding ( const LiveTranscoding transcoding)
pure virtual

Sets the video layout and audio settings for CDN live. (CDN live only.)

Note
  • This method applies to Live Broadcast only.
  • Ensure that you enable the RTMP Converter service before using this function. See Prerequisites.
Parameters
transcodingSets the CDN live audio/video transcoding settings. See LiveTranscoding.
Returns
  • 0: Success.
  • < 0: Failure.

◆ addVideoWatermark() [1/2]

virtual int agora::rtc::IRtcEngine::addVideoWatermark ( const RtcImage watermark)
pure virtual

DEPRECATED Adds a watermark image to the local video or CDN live stream.

This method is deprecated from v2.9.1. Use addVideoWatermark2 instead.

This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and CDN live audience to view and capture.

To add the PNG file to the CDN live publishing stream, see the setLiveTranscoding method.

Parameters
watermarkPointer to the watermark image to be added to the local video stream. See RtcImage.
Note
  • The URL descriptions are different for the local video and CDN live streams:
    • In a local video stream, url in RtcImage refers to the absolute path of the added watermark image file in the local video stream.
    • In a CDN live stream, url in RtcImage refers to the URL address of the added watermark image in the CDN live broadcast.
  • The source file of the watermark image must be in the PNG file format. If the width and height of the PNG file differ from your settings in this method, the PNG file will be cropped to conform to your settings.
  • The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one.
Returns
  • 0: Success.
  • < 0: Failure.

◆ addVideoWatermark() [2/2]

virtual int agora::rtc::IRtcEngine::addVideoWatermark ( const char *  watermarkUrl,
const WatermarkOptions options 
)
pure virtual

Adds a watermark image to the local video.

This method adds a PNG watermark image to the local video in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), and the recording device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one.

The watermark position depends on the settings in the setVideoEncoderConfiguration method:

Note
  • Ensure that you have called the enableVideo method to enable the video module before calling this method.
  • If you only want to add a watermark image to the local video for the audience in the CDN live broadcast channel to see and capture, you can call this method or the setLiveTranscoding method.
  • This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray.
  • If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings.
  • If you have enabled the local video preview by calling the startPreview method, you can use the visibleInPreview member in the WatermarkOptions class to set whether or not the watermark is visible in preview.
  • If you have mirrored the local video by calling the setLocalVideoMirrorMode method, the watermark image in preview is also mirrored.
Parameters
watermarkUrlThe local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path.
optionsPointer to the watermark's options to be added. See WatermarkOptions for more infomation.
Returns
  • 0: Success.
  • < 0: Failure.

◆ clearVideoWatermarks()

virtual int agora::rtc::IRtcEngine::clearVideoWatermarks ( )
pure virtual

Removes the watermark image from the video stream added by the addVideoWatermark method.

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

◆ setBeautyEffectOptions()

virtual int agora::rtc::IRtcEngine::setBeautyEffectOptions ( bool  enabled,
BeautyOptions  options 
)
pure virtual

Supports Android and iOS only! Enables/Disables image enhancement and sets the options.

Parameters
enabledSets whether or not to enable image enhancement:
  • true: enables image enhancement.
  • false: disables image enhancement.
optionsSets the image enhancement option. See BeautyOptions.

◆ addInjectStreamUrl()

virtual int agora::rtc::IRtcEngine::addInjectStreamUrl ( const char *  url,
const InjectStreamConfig config 
)
pure virtual

Adds a voice or video stream URL address to a live broadcast.

The onStreamPublished callback returns the inject status. If this method call is successful, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all audience members in the channel can watch a live show and interact with each other.

Note

The addInjectStreamUrl method call triggers the following callbacks:

  • The local client:
    • onStreamInjectedStatus , with the state of the injecting the online stream.
    • onUserJoined (uid: 666), if the method call is successful and the online media stream is injected into the channel.
  • The remote client:
    • onUserJoined (uid: 666), if the method call is successful and the online media stream is injected into the channel.
Parameters
urlPointer to the URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and FLV.
  • Supported FLV audio codec type: AAC.
  • Supported FLV video codec type: H264 (AVC).
configPointer to the InjectStreamConfig object that contains the configuration of the added voice or video stream.
Returns
  • 0: Success.
  • < 0: Failure.
    • ERR_INVALID_ARGUMENT (2): The injected URL does not exist. Call this method again to inject the stream and ensure that the URL is valid.
    • ERR_NOT_READY (3): The user is not in the channel.
    • ERR_NOT_SUPPORTED (4): The channel profile is not live broadcast. Call the setChannelProfile method and set the channel profile to live broadcast before calling this method.
    • ERR_NOT_INITIALIZED (7): The SDK is not initialized. Ensure that the IRtcEngine object is initialized before calling this method.

◆ startChannelMediaRelay()

virtual int agora::rtc::IRtcEngine::startChannelMediaRelay ( const ChannelMediaRelayConfiguration configuration)
pure virtual

Starts to relay media streams across channels.

After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged and onChannelMediaRelayEvent callbacks, and these callbacks return the state and events of the media stream relay.

Note
  • Call this method after the joinChannel method.
  • This method takes effect only when you are a broadcaster in a Live-broadcast channel.
  • After a successful method call, if you want to call this method again, ensure that you call the stopChannelMediaRelay method to quit the current relay.
Parameters
configurationThe configuration of the media stream relay: ChannelMediaRelayConfiguration.
Returns
  • 0: Success.
  • < 0: Failure.

◆ updateChannelMediaRelay()

virtual int agora::rtc::IRtcEngine::updateChannelMediaRelay ( const ChannelMediaRelayConfiguration configuration)
pure virtual

Updates the channels for media stream relay. After a successful startChannelMediaRelay method call, if you want to relay the media stream to more channels, or leave the current relay channel, you can call the updateChannelMediaRelay method.

After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged callback with the RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL (7) state code.

Note
Call this method after the startChannelMediaRelay method to update the destination channel.
Parameters
configurationThe media stream relay configuration: ChannelMediaRelayConfiguration.
Returns
  • 0: Success.
  • < 0: Failure.

◆ stopChannelMediaRelay()

virtual int agora::rtc::IRtcEngine::stopChannelMediaRelay ( )
pure virtual

Stops the media stream relay.

Once the relay stops, the broadcaster quits all the destination channels.

After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged callback. If the callback returns RELAY_STATE_IDLE (0) and RELAY_OK (0), the broadcaster successfully stops the relay.

Note
If the method call fails, the SDK triggers the onChannelMediaRelayStateChanged callback with the RELAY_ERROR_SERVER_NO_RESPONSE (2) or RELAY_ERROR_SERVER_CONNECTION_LOST (8) state code. You can leave the channel by calling the leaveChannel method, and the media stream relay automatically stops.
Returns
  • 0: Success.
  • < 0: Failure.

◆ removeInjectStreamUrl()

virtual int agora::rtc::IRtcEngine::removeInjectStreamUrl ( const char *  url)
pure virtual

Removes the voice or video stream URL address from a live broadcast.

This method removes the URL address (added by the addInjectStreamUrl method) from the live broadcast.

Note
If this method is called successfully, the SDK triggers the onUserOffline callback and returns a stream uid of 666.
Parameters
urlPointer to the URL address of the added stream to be removed.
Returns
  • 0: Success.
  • < 0: Failure.

◆ registerEventHandler()

virtual bool agora::rtc::IRtcEngine::registerEventHandler ( IRtcEngineEventHandler eventHandler)
pure virtual

◆ unregisterEventHandler()

virtual bool agora::rtc::IRtcEngine::unregisterEventHandler ( IRtcEngineEventHandler eventHandler)
pure virtual

◆ getConnectionState()

virtual CONNECTION_STATE_TYPE agora::rtc::IRtcEngine::getConnectionState ( )
pure virtual

Gets the current connection state of the SDK.

Returns
CONNECTION_STATE_TYPE.

◆ registerMediaMetadataObserver()

virtual int agora::rtc::IRtcEngine::registerMediaMetadataObserver ( IMetadataObserver observer,
IMetadataObserver::METADATA_TYPE  type 
)
pure virtual

Registers the metadata observer.

Registers the metadata observer. You need to implement the IMetadataObserver class and specify the metadata type in this method. A successful call of this method triggers the getMaxMetadataSize callback. This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.

Note
  • Call this method before the joinChannel method.
  • This method applies to the Live-broadcast channel profile.
Parameters
observerThe IMetadataObserver class. See the definition of IMetadataObserver for details.
typeSee METADATA_TYPE. The SDK supports VIDEO_METADATA (0) only for now.
Returns
  • 0: Success.
  • < 0: Failure.