Adds the RtcEngineEvents
handler.
After setting the RtcEngineEvents
handler, you can listen for RtcEngine
events and receive the statistics of the corresponding RtcEngine instance.
The event type.
The RtcEngineEvents
handler.
Publishes the local stream to a specified CDN streaming URL.
The CDN streaming URL in the RTMP or RTMPS format. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters.
Whether to enable transcoding.
If you set this parameter as true
, ensure that you call setLiveTranscoding
before this method.
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.RtcEngine
when publishing the stream.Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video stream in a live interactive streaming. 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-added watermark image replaces the previous one.
The watermark position depends on the settings in the setVideoEncoderConfiguration
method:
If the orientation mode of the encoding video is FixedLandscape
, or the landscape mode in Adaptative
, the watermark uses the landscape orientation.
If the orientation mode of the encoding video is FixedPortrait
, or the portrait mode in Adaptative
, the watermark uses the portrait orientation.
When setting the watermark position, the region must be less than the dimensions set in the setVideoEncoderConfiguration
method.
Otherwise, the watermark image will be cropped.
Note
Ensure that you have called enableVideo
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 interactive streaming 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 startPreview
, you can use the visibleInPreview
member in the WatermarkOptions
class to set whether the watermark is visible in preview.
If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer.
The local file path of the watermark image to be added.
/assets/
to access a local file.
You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead.The options of the watermark image to be added.
Adjusts the volume of audio mixing for local playback.
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Audio mixing volume for local playback. The value ranges between 0 and 100 (default).
Adjusts the volume of audio mixing for publishing (sending to other users).
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Audio mixing volume for publishing. The value ranges between 0 and 100 (default).
Adjusts the volume of audio mixing.
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Calling this method does not affect the volume of the audio effect file playback invoked by the playEffect
method.
Audio mixing volume. The value ranges between 0 and 100 (default).
Adjusts the playback volume of all remote users.
Note
adjustAudioMixingVolume
, and set volume
as 0
.The playback volume.The value ranges between 0 and 400, including the following:
0
: Mute.100
: (Default) Original volume.400
: Four times the original volume with signal-clipping protection.Adjusts the volume of the signal captured by the microphone
The volume of the signal captured by the microphone.The value ranges between 0 and 400, including the following:
0
: Mute.100
: (Default) Original volume.400
: Four times the original volume with signal-clipping protection.Adjusts the playback volume of a specified remote user.
You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user.
Note
ID of the remote user.
The playback volume of the specified remote user. The value ranges from 0 to 100:
Removes the watermark image from the video stream added by addVideoWatermark
.
Allows a user to complain about the call quality after a call ends.
ID of the call retrieved from the getCallId
method.
(Optional) The description of the complaint. The string length must be less than 800 bytes.
Configures the virtual metronome.
The metronome configuration. See RhythmPlayerConfig
.
Creates a data stream.
Sets whether the recipients are guaranteed to receive the data stream from the sender within five seconds:
true
: The recipients receive the data from the sender within five seconds.
If the recipient does not receive the data within five seconds, the SDK triggers the StreamMessageError
callback and returns an error code.
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.
Sets whether the recipients receive the data stream in the sent order:
true
: The recipients receive the data in the sent order.false
: The recipients do not receive the data in the sent order.Creates a data stream.
The configurations for the data stream.
Destroys the RtcEngine
instance and releases all resources used by the Agora SDK.
Use this method for apps in which users occasionally make voice or video calls. When users do not make calls, you can free up resources for other operations.
Once you call this method to destroy the created RtcEngine
instance, you cannot use any method or callback in the SDK any more.
If you want to use the real-time communication functions again, you must call create
to create a new RtcEngine
instance.
Note
destroy
is a synchronous method and the app cannot move on to another task until the execution completes,
Agora suggests calling this method in a sub-thread to avoid congestion in the main thread.
Besides, you cannot call destroy
in any method or callback of the SDK.
Otherwise, the SDK cannot release the resources occupied by the RtcEngine
instance until the callbacks return results, which may result in a deadlock.RtcEngine
instance after destroying the current one, ensure that you wait till the destroy
method completes executing.Disables the audio module.
Note
This method affects the audio module and can be called after calling leaveChannel
.
You can call this method either before or after joining a channel.
This method enables/disables the audio module and takes some time to take effect. We recommend using the following API methods to control the audio module separately:
enableLocalAudio
: Whether to enable the microphone to create the local audio stream.
muteLocalAudioStream
: Whether to publish the local audio stream.
muteRemoteAudioStream
: Whether to subscribe to and play the remote audio stream.
muteAllRemoteAudioStreams
: Whether to subscribe to and play all remote audio streams.
Disables the network connection quality test.
Disables the video module.
You can call this method before joining a channel or during a call:
A successful call of this method triggers the UserEnableVideo(false)
callback on the remote client.
To enable the video mode, call enableVideo
.
Note
This method affects the internal engine and can be called after calling leaveChannel
.
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 video engine modules separately:
enableLocalVideo
: Whether to enable the camera to create the local video stream.
muteLocalVideoStream
: Whether to publish the local video stream.
muteRemoteVideoStream
: Whether to subscribe to and play the remote video stream.
muteAllRemoteVideoStreams
: Whether to subscribe to and play all remote video streams.
Enables the audio module.
The audio module is enabled by default.
Note
This method affects the audio module and can be called after calling leaveChannel
.
You can call this method either before or after joining a channel.
This method enables/disables the audio module and takes some time to take effect. We recommend using the following API methods to control the audio module separately:
enableLocalAudio
: Whether to enable the microphone to create the local audio stream.
muteLocalAudioStream
: Whether to publish the local audio stream.
muteRemoteAudioStream
: Whether to subscribe to and play the remote audio stream.
muteAllRemoteAudioStreams
: Whether to subscribe to and play all remote audio streams.
Enables the AudioVolumeIndication
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 AudioVolumeIndication
callback at the set time interval,
regardless of whether any user is speaking in the channel.
Sets the time interval between two consecutive volume indications:
The smoothing 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.
true
: Enable the voice activity detection of the local user. Once it is enabled, the vad
parameter of the AudioVolumeIndication
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 AudioVolumeIndication
callback does not report the voice activity status of the local user,
except for scenarios where the engine automatically detects the voice activity of the local user.Enables or disables deep-learning noise reduction.
Sets whether to enable deep-learning noise reduction.
true
: Enables deep-learning noise reduction.false
: Disables deep-learning noise reduction.Enables/Disables the dual video stream mode.
If dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution high-bitrate video stream) or low stream (low-resolution low-bitrate video stream) video.
Sets the stream mode:
true
: Dual-stream mode.false
: (Default) Single-stream mode.Enables/Disables the built-in encryption.
Whether to enable the built-in encryption.
true
: Enable the built-in encryption.false
: Disable the built-in encryption.Configurations of built-in encryption schemas. See EncryptionConfig
.
RtcEngine
instance before calling this method.Enables/Disables face detection for the local user.
Once face detection is enabled, the SDK triggers the FacePositionChanged
callback to report the face information of the local user, which includes the following aspects:
Note You can call this method either before or after joining a channel.
Determines whether to enable the face detection function for the local user:
true
: Enable face detection.false
: (Default) Disable face detection.Enables in-ear monitoring.
Sets whether to enable/disable in-ear monitoring:
true
: Enable.false
: (Default) Disable.Enables the network connection quality test.
This method tests the quality of the users' network connections and is disabled by default.
Before users join 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, which may affect the communication quality.
Call disableLastmileTest
to disable this test after receiving the LastmileQuality
callback,
and before the user joins a channel or switches the user role.
Note
Do not use this method with the startLastmileProbeTest
method.
Do not call any other methods before receiving the LastmileQuality
callback. Otherwise, the callback may be interrupted by other methods and may not execute.
In the LiveBroadcasting
profile, a host should not call this method after joining a channel.
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 disableLastmileTest
or not, the SDK automatically stops consuming the bandwidth.
Enables/Disables the local audio capture.
The audio function is enabled by default. This method disables/re-enables the local audio function, that is, to stop or restart local audio capture and processing.
This method does not affect receiving 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.
Once the local audio function is disabled or re-enabled, the SDK triggers the LocalAudioStateChanged
callback, which reports Stopped
or Recording
.
The SDK triggers the LocalAudioStateChanged
callback once the local audio function is disabled or re-enabled.
Note
This method is different from the muteLocalAudioStream
method:
enableLocalAudio
: Disables/Re-enables the local audio capture and processing.
If you disable or re-enable local audio recording using enableLocalAudio
, the local user may hear a pause in the remote audio playback.
muteLocalAudioStream
: Stops/Continues sending the local audio streams.
Sets whether to disable/re-enable the local audio function:
true
: (Default) Re-enable the local audio function, that is, to start local audio capture and processing.false
: Disable the local audio function, that is, to stop local audio capture and processing.Disables/Re-enables 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 enableVideo
, 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 UserEnableLocalVideo
callback on the remote client.
Note
leaveChannel
.Sets 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 other remote users.
When you set enabled
as false
, this method does not require a local camera.Enables reporting the voice pitch of the local user.
Sets the time interval at which the SDK triggers the LocalVoicePitchInHz
callback:
LocalVoicePitchInHz
callback.LocalVoicePitchInHz
callback.
The value must be greater than or equal to 10. If the value is less than 10, the SDK automatically
changes it to 10.Enables/Disables the super-resolution algorithm for a remote user's video stream.
The user ID of the remote user.
Determines whether to enable super resolution for the remote user's video:
true
: Enable super resolution.false
: Do not enable super resolution.Enables/Disables stereo panning for remote users.
Ensure that you call this method before calling joinChannel
to enable stereo panning for remote users so that
the local user can track the position of a remote user by calling setRemoteVoicePosition
.
Sets whether to enable stereo panning for remote users:
true
: Enable stereo panning.false
: Disable stereo panning.Enables the video module.
You can call this method either before joining a channel or during a call:
A successful call of this method triggers the UserEnableVideo(true)
callback on the remote client.
To disable the video, call the disableVideo
method.
Note
This method affects the internal engine and can be called after calling 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 video engine modules separately:
enableLocalVideo
: Whether to enable the camera to create the local video stream.
muteLocalVideoStream
: Whether to publish the local video stream.
muteRemoteVideoStream
: Whether to subscribe to and play the remote video stream.
muteAllRemoteVideoStreams
: Whether to subscribe to and play all remote video streams.
Enables/Disables the virtual background function.
Sets whether to enable the virtual background:
true
: Enable.false
: Disable.The custom background image. See VirtualBackgroundSource
.
Note: To adapt the resolution of the custom background image to the resolution of the SDK capturing video, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted.
Enables interoperability with the Agora Web SDK (LiveBroadcasting
only).
Sets whether to enable/disable interoperability with the Agora Web SDK:
true
: Enable.false
: (Default) Disable.Gets the information of a specified audio file.
The file path, including the filename extensions.
/assets/
. You might encounter permission issues if you use
an absolute path to access a local file, so Agora recommends using a URI address instead. For example:
content://com.android.providers.media.documents/document/audio%3A14441
./var/mobile/Containers/Data/audio.mp4
.Gets the playback position (ms) of the music file.
Note
startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.getAudioMixingCurrentPosition
multiple times, ensure that the call interval is longer than 500 ms.Gets the duration (ms) of the music file.
@since v3.4.2 The file path, including the filename extensions.
Gets the audio mixing volume for local playback.
This method helps troubleshoot audio volume related issues.
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Gets the audio mixing volume for publishing.
This method helps troubleshoot audio volume related issues.
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Gets the audio track index of the current music file.
Gets the current call ID.
When a user joins a channel on a client, a call ID 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.
Current call ID.
Gets the maximum zoom ratio supported by the camera.
This method applies to Android only.
The maximum camera zoom factor if the method call succeeds.
Gets the connection state of the SDK.
The connection state of the SDK if the method call succeeds.
Gets the playback position of the audio effect file.
Audio effect ID. Ensure that this parameter is set to the same value as in playEffect
.
Gets the duration of the audio effect file.
The file path, including the filename extensions.
Gets the volume of the audio effects.
The value ranges between 0.0 and 100.0.
Gets the native handle of the SDK engine.
This interface is used to retrieve the native C++ handle of the SDK engine used in special scenarios, such as registering the audio and video frame observer.
The native handle of the SDK engine if the method call succeeds.
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 UserInfoUpdated
callback on the local client.
After receiving the UserInfoUpdated
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.
The user ID of the user. Ensure that you set this parameter.
The user information if the method call succeeds.
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 UserInfoUpdated
callback on the local client.
After receiving the UserInfoUpdated
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.
The user account of the user. Ensure that you set this parameter.
The user information if the method call succeeds.
Checks whether the camera auto-face focus function is supported.
true
: The device supports the camera auto-face focus function.false
: The device does not support the camera auto-face focus function.Checks whether the camera exposure function is supported.
true
: The device supports the camera exposure function.false
: The device does not support the camera exposure function.Checks whether the camera manual focus function is supported.
true
: The device supports the camera manual focus function.false
: The device does not support the camera manual focus function.Checks whether the device supports enabling the flash.
The SDK uses the front camera by default, so if you call isCameraTorchSupported
directly,
you can find out from the return value whether the device supports enabling the flash when using the
front camera. If you want to check whether the device supports enabling the flash when using the rear camera,
call switchCamera
to switch the camera used by the SDK to the rear camera, and then call isCameraTorchSupported
.
Note Call this method after the camera is started.
true
: The device supports enabling the flash.false
: The device does not support enabling the flash.Checks whether the camera zoom function is supported.
true
: The device supports the camera zoom function.false
: The device does not support the camera zoom function.Checks whether the speakerphone is enabled.
Note
You can call this method either before or after joining a channel.
true
: The speakerphone is enabled, and the audio plays from the speakerphone.false
: The speakerphone is not enabled, and the audio plays from devices other than the speakerphone. For example, the headset or earpiece.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 leaveChannel
to exit the current call before joining another channel.
A successful call of this method triggers the following callbacks:
The local client: JoinChannelSuccess
.
The remote client: UserJoined
, if the user joining the channel is in the Communication
profile,
or is a Broadcaster
in the LiveBroadcasting
profile.
When the connection between the client and Agora 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 RejoinChannelSuccess
callback on the local client.
Once the user joins the channel (switches to another channel), the user publishes the local audio and video streams and automatically subscribes to the audio and video streams of all the other users in the channel.
Subscribing incurs all associated usage costs. To unsubscribe, set the options
parameter or call the mute
methods accordingly.
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.
Warning
Ensure that the App ID used for creating the token is the same App ID used in the create
method for creating an RtcEngine
object. Otherwise, CDN live streaming may fail.
The token generated at your server. See Authenticate Your Users with Tokens.
The unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
(Optional) Reserved for future use.
(Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to (2^32-1). optionalUid
must be unique. If optionalUid
is not assigned (or set to 0
), the SDK assigns and returns uid
in the JoinChannelSuccess
callback.
Your app must record and maintain the returned uid since the SDK does not do so.
The uid is represented as a 32-bit unsigned integer in the SDK. Since unsigned integers are not supported by Java, the uid is handled as a 32-bit signed integer and larger numbers are interpreted as negative numbers in Java. If necessary, the uid can be converted to a 64-bit integer through “uid&0xffffffffL”.
@since v3.3.1. (Optional) The channel media options: ChannelMediaOptions
.
RtcChannel
object with the same channel name.RtcChannel
object. When you join a channel created by the RtcEngine object, the SDK publishes the local audio and video streams to that channel by default. Because the SDK does not support publishing a local stream to more than one channel simultaneously, an error occurs in this occasion.RtcEngine
channel at a time. Therefore, the SDK returns this error code when a user who has already joined an RtcEngine
channel calls the joining channel method of the RtcEngine
class with a valid channel name.Joins the channel with a user account.
After the user successfully joins the channel, the SDK triggers the following callbacks:
The local client: LocalUserRegistered
and JoinChannelSuccess
.
The remote client: UserJoined
and UserInfoUpdated
, if the user joining the channel is in the Communication
profile, or is a Broadcaster
in the LiveBroadcasting
profile.
Once the user joins the channel, the user publishes the local audio and video streams and automatically subscribes to the audio and video streams
of all the other users in the channel. Subscribing incurs all associated usage costs. To unsubscribe, set the options
parameter or call the mute
methods accordingly.
Note
The token generated at your server. See Authenticate Your Users with Tokens.
The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:
The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null.
@since v3.3.1. (Optional) The channel media options: ChannelMediaOptions
.
RtcEngine
channel at a time. Therefore, the SDK returns this error code when a user who has already joined an RtcEngine
channel calls the joining channel method of the RtcEngine
class with a valid channel name.Allows a user to leave a channel.
After joining a channel, the user must call this 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 exited the channel when the method call returns.
Once the user leaves the channel, the SDK triggers the LeaveChannel
callback.
A successful leaveChannel
method call triggers the following callbacks:
The local client: LeaveChannel
.
The remote client: UserOffline
, if the user leaving the channel is in the Communication
channel, or is a Broadcaster
in the LiveBroadcasting
profile.
Note
If you call destroy
immediately after calling leaveChannel
, the leaveChannel
process interrupts, and the SDK does not trigger the LeaveChannel
callback.
If you call leaveChannel
during CDN live streaming, the SDK triggers the removePublishStreamUrl
method.
Stops or resumes subscribing to the audio streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including all subsequent users.
Note
setDefaultMuteAllRemoteAudioStreams
.
Agora recommend not calling muteAllRemoteAudioStreams
and setDefaultMuteAllRemoteAudioStreams
together;
otherwise, the settings may not take effect. See Set the Subscribing State.Sets whether to stop subscribing to the audio streams of all remote users.
true
: Stop subscribing to the audio streams of all remote users.false
: (Default) Resume subscribing to the audio streams of all remote users.Stops or resumes subscribing to the video streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users.
Note
setDefaultMuteAllRemoteVideoStreams
.
Agora recommend not calling muteAllRemoteVideoStreams
and setDefaultMuteAllRemoteVideoStreams
together;
otherwise, the settings may not take effect. See Set the Subscribing State.Sets whether to stop subscribing to the video streams of all remote users.
true
: Stop subscribing to the video streams of all remote users.false
: (Default) Resume subscribing to the video streams of all remote users.Stops or resumes publishing the local audio stream.
As of v3.4.5, this method only sets the publishing state of the audio stream in the channel of RtcEngine
.
A successful method call triggers the UserMuteAudio
callback on the remote client.
You can only publish the local stream in one channel at a time. If you create multiple channels,
ensure that you only call muteLocalAudioStream(false)
in one channel; otherwise, the method call fails,
and the SDK returns -5 (ERR_REFUSED)
.
Note
joinChannel
and setClientRole
methods. For details, see Set the Publishing State.Sets whether to stop publishing the local audio stream.
true
: Stop publishing the local audio stream.false
: Resume publishing the local audio stream.-5 (ERR_REFUSED)
: The request is rejected.Stops or resumes publishing the local video stream.
As of v3.4.5, this method only sets the publishing state of the video stream in the channel of RtcEngine
.
A successful method call triggers the UserMuteVideo
callback on the remote client.
You can only publish the local stream in one channel at a time. If you create multiple channels,
ensure that you only call muteLocalVideoStream(false)
in one channel; otherwise,
the method call fails, and the SDK returns -5 (ERR_REFUSED)
.
Note
joinChannel
and setClientRole
methods. For details, see Set the Publishing State.Sets whether to stop publishing the local video stream.
true
: Stop publishing the local video stream.false
: Resume publishing the local video stream.-5 (ERR_REFUSED)
: The request is rejected.Stops or resumes subscribing to the audio stream of a specified user.
Note
The user ID of the specified remote user.
Sets whether to stop subscribing to the audio stream of a specified user.
true
: Stop subscribing to the audio stream of a specified user.false
: (Default) Resume subscribing to the audio stream of a specified user.Stops or resumes subscribing to the video stream of a specified user.
Note
The user ID of the specified remote user.
Sets whether to stop subscribing to the video stream of a specified user.
true
: Stop subscribing to the video stream of a specified user.false
: (Default) Resume subscribing to the video stream of a specified user.Pauses the media stream relay to all destination channels.
Pauses all audio effects.
Pauses playing and mixing the music file.
Call this method when you are in a channel.
Pauses a specified audio effect.
ID of the audio effect. Each audio effect has a unique ID.
Plays a specified local or online audio effect file.
With this method, you can set the loop count, pitch, pan, and gain of the audio effect file and whether the remote user can hear the audio effect.
To play multiple audio effect files simultaneously, call this method multiple times with different soundId
and filePath
.
We recommend playing no more than three audio effect files at the same time.
When the audio effect file playback is finished, the SDK triggers the AudioEffectFinished
callback.
Note For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
ID of the specified audio effect. Each audio effect has a unique ID. If you preloaded the audio effect into the memory
through the preloadEffect
method, ensure that the soundID
value is set to the same value as in the preloadEffect
method.
The file path, including the filename extensions.
The number of times the audio effect loops:
1
means loop one time, which means play the audio effect two times in total.Sets 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.
Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0.
Sets the volume of the audio effect. The value ranges between 0.0 and 100,0. The default value is 100.0. The lower the value, the lower the volume of the audio effect.
Set whether 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.@since v3.4.2 The playback position (ms) of the audio effect file.
Preloads a specified audio effect file into the memory.
Note
joinChannel
.Note For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
ID of the audio effect. Each audio effect has a unique ID.
The file path, including the filename extensions.
Allows the user to rate a call after the call ends.
ID of the call retrieved from the getCallId
method.
Rating of the call. The value is between 1 (lowest score) and 5 (highest score).
If you set a value out of this range, the InvalidArgument(-2)
error occurs.
(Optional) The description of the rating. The string length must be less than 800 bytes.
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 LocalUserRegistered
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:
Call this method to create a user account, and then joinChannelWithUserAccount
to join the channel.
Call joinChannelWithUserAccount
to join the channel.
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
userAccount
parameter. Otherwise, this method does not take effect.userAccount
parameter is unique in the channel.The App ID of your project.
The 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:
Registers the metadata observer.
This method enables you to add synchronized metadata in the video stream for more diversified live streaming interactions, such as sending shopping links, digital coupons, and online quizzes.
Note
Call this method before the joinChannel
method.
Removes all the RtcEngineEvents
handlers.
The event type.
Removes the RtcEngineEvents
handler.
For callback events that you only want to listen for once, call this method to remove the specific RtcEngineEvents
objects after you have received them.
The event type.
The RtcEngineEvents
handler.
Removes an RTMP or RTMPS stream from the CDN.
The CDN streaming URL to be removed. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters.
Renews the token when the current token expires.
The token expires after a period of time once the token schema is enabled when:
The SDK triggers the TokenPrivilegeWillExpire
callback, or
The ConnectionStateChanged
callback reports the TokenExpired(9)
error.
The app should retrieve a new token from the server and call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
The new token.
Resumes the media stream relay to all destination channels.
Resumes playing all audio effects.
Resumes playing and mixing the music file.
Call this method when you are in a channel.
Resumes playing a specified audio effect.
ID of the audio effect. Each audio effect has a unique ID.
Specifies the playback track of the current music file.
This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact support@agora.io and discuss the format of customized messages with us.
Sends the metadata.
The metadata to be sent.
Sends data stream messages.
The SDK has the following restrictions on this method:
A successful sendStreamMessage
method call triggers the StreamMessage
callback on the remote client, from which the remote user gets the stream message.
A failed sendStreamMessage
method call triggers the StreamMessageError
callback on the remote client.
Note
Ensure that you have created the data stream using createDataStream
before calling this method.
This method applies only to the Communication
profile or to hosts in the LiveBroadcasting
profile.
ID of the sent data stream returned by the createDataStream
method.
Sent data.
Sets the storage directory of .so
files.
The directory where you store .so
files, which must be a private directory of the app
and can be obtained using Context.getDir()
. Ensure the specified directory exists; otherwise, the SDK reports the InvalidParameterException
error.
Sets parameters for SDK preset audio effects.
The options for SDK preset audio effects:
RoomAcoustics3DVoice
.setAudioProfile
and set the profile parameter to MusicStandardStereo(3)
or MusicHighQualityStereo(5)
before setting this enumerator;
otherwise, the enumerator setting does not take effect.PitchCorrection
. To achieve better audio effect quality, Agora recommends calling setAudioProfile
and setting the profile parameter to MusicHighQuality(4)
or MusicHighQualityStereo(5)
before setting this enumerator.RoomAcoustics3DVoice
, the param1
sets the cycle period of the 3D voice effect.
The value range is [1,60] and the unit is a second. The default value is 10 seconds, indicating that the voice moves around you every 10 seconds.PitchCorrection
, param1
sets the basic mode of the pitch correction effect:preset
to RoomAcoustics3DVoice
, you need to set param2
to 0
.preset
to PitchCorrection
, param2
sets the tonic pitch of the pitch correction effect:Sets an SDK preset audio effect.
The options for SDK preset audio effects. See AudioEffectPreset
.
Sets the channel mode of the current music file.
The channel mode. See [AudioMixingDualMonoMode
]{@link enum.AudioMixingDualMonoMode}.
Sets the pitch of the local music file.
When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only.
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
Sets the pitch of the local music file by chromatic scale. The default value is 0, which means keep the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file.
Sets the playback speed of the current music file.
The playback speed. Agora recommends that you limit this value to between 50 and 400, defined as follows:
Sets the playback position (ms) of the music file to a different starting position (the default plays from the beginning).
Note
Call this method after calling startAudioMixing
and receiving the AudioMixingStateChanged(Playing)
callback.
The playback starting position (ms) of the audio mixing file.
Sets the audio parameters and application scenarios.
Note
joinChannel
.Communication
and LiveBroadcasting
profiles, the bitrates may be different from your settings due to network self-adaptation.MusicHighQuality(4)
and scenario as GameStreaming(3)
. For example, for music education scenarios.Sets the sample rate, bitrate, encoding mode, and the number of channels. See AudioProfile
.
Sets the audio application scenarios. See AudioScenario
. 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?.
The method applies to the iOS platform only. You can call this method either before or after joining a channel.
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
The operational restriction (bit mask) of the SDK on the audio session. See AudioSessionOperationRestriction
.
Enables/Disables image enhancement and sets the options.
Note
Call this method after calling enableVideo
.
On Android,this method applies to Android 4.4 or later.
Agora has updated the Agora image enhancement algorithm from v3.6.2 to enhance image enhancement effects and support sharpness adjustment. If you want to experience optimized image enhancement effects or set the sharpness, ensure that you have integrated the following dynamic library into the project before calling this method:
Android: libagora_video_process_extension.so
iOS: AgoraVideoProcessExtension.xcframework
Sets whether to enable image enhancement:
true
: Enable image enhancement.false
: Disable image enhancement.The image enhancement options.
Enables the camera auto-face focus function.
Sets whether to enable/disable the camera auto-face focus function:
true
: Enable the camera auto-face focus function.false
: (Default) Disable the camera auto-face focus function.Sets the camera capturer configuration.
For a video call or live interactive video streaming, generally the SDK controls the camera output parameters. When the default camera capture 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 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 Performance(1)
to optimize CPU and RAM usage.
If you want better quality for the local video preview, we recommend setting config
as Preview(2)
.
To customize the width and height of the video image captured by the local camera, set the camera capture configuration as Manual(3)
.
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.
The camera capturer configuration.
Sets the camera exposure position.
A successful setCameraExposurePosition
method call triggers the CameraExposureAreaChanged
callback on the local client.
The horizontal coordinate of the touch point in the view.
The vertical coordinate of the touch point in the view.
Sets the camera manual focus position.
A successful setCameraFocusPositionInPreview
method call triggers the CameraFocusAreaChanged
callback on the local client.
The horizontal coordinate of the touch point in the view.
The vertical coordinate of the touch point in the view.
Sets whether to enable the flash.
Note Call this method after the camera is started.
Determines whether to enable the flash:
true
: Enable the flash.false
: Disable the flash.Sets the camera zoom ratio.
Sets the camera zoom factor. The value ranges between 1.0 and the maximum zoom supported by the device.
Sets the channel profile of the Agora RtcEngine
.
After initialization, the SDK uses the communication channel profile by default. You can call setChannelProfile
to set the channel profile.
The Agora RtcEngine
differentiates channel profiles and applies different optimization algorithms accordingly.
For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality for live interactive video streaming.
The channel profile of the Agora RtcEngine
.
Sets the role of a user in interactive live streaming.
After calling setChannelProfile(LiveBroadcasting)
, the SDK sets the user role as audience by default. You can call setClientRole
to set the user role as host.
You can call this method either before or after joining a channel. If you call this method to switch the user role after joining a channel, the SDK automatically does the following:
muteLocalAudioStream
and muteLocalVideoStream
to change the publishing state.ClientRoleChanged
or ClientRoleChangeFailed
on the local client.UserJoined
or UserOffline
(BecomeAudience
) on the remote client.Note
LiveBroadcasting
profile only (when the profile
parameter in setChannelProfile
is set as LiveBroadcasting
).The role of a user in interactive live streaming. See ClientRole.
The detailed options of a user, including user level. See ClientRoleOptions.
joinChannel
with the options
parameter and use the default settings publishLocalAudio = true
or publishLocalVideo = true
.setClientRole
to set the user role as host.muteLocalAudioStream(false)
or muteLocalVideoStream(false)
.Sets the Agora cloud proxy service.
The cloud proxy type. See CloudProxyType
. This parameter is required, and the SDK reports an error if you do not pass in a value.
2(InvalidArgument)
: The parameter is invalid.7(NotInitialized)
: The SDK is not initialized.Sets color enhancement.
Sets whether to enable video noise reduction:
true
: Enable.false
: (Default) Disable.The video noise reduction options. See ColorEnhanceOptions
.
Sets the default audio route.
If the default audio route of the SDK (see Set the Audio Route ) cannot meet your requirements,
you can call this method to switch the default audio route. After successfully switching the audio route,
the SDK triggers the AudioRouteChanged
callback to indicate the changes.
Note
joinChannel
. If you need to switch the audio route after joining a channel, call setEnableSpeakerphone
.Sets the default audio route as follows:
true
: Set to the speakerphone.false
: Set to the earpiece.Sets whether to receive all remote audio streams by default.
Sets whether to stop subscribing to the audio streams of all remote users by default.
true
: Stop subscribing to the audio streams of all remote users by default.false
: (Default) Resume subscribing to the audio streams of all remote users by default.Sets whether to receive all remote video streams by default.
Sets whether to stop subscribing to the video streams of all remote users by default.
true
: Stop subscribing to the video streams of all remote users by default.false
: (Default) Resume subscribing to the video streams of all remote users by default.Sets the playback position of an audio effect file.
Audio effect ID. Ensure that this parameter is set to the same value as in playEffect
.
The playback position (ms) of the audio effect file.
Sets the volume of the audio effects.
Volume of the audio effects. The value ranges between 0.0 and 100.0 (default).
Enables/Disables the audio route to the speakerphone.
If the default audio route of the SDK (see Set the Audio Route ) or
the setting in setDefaultAudioRoutetoSpeakerphone
cannot meet your requirements,
you can call this method to switch the current audio route. After successfully switching the audio route, the SDK triggers the AudioRouteChanged
callback to indicate the changes.
This method only sets the audio route in the current channel and does not influence the default audio route. If the user leaves the current channel and joins another channel, the default audio route is used.
Note
joinChannel
.Sets whether to enable the speakerphone or earpiece
true
: Enable the speakerphone. The audio route is the speakerphone.false
: Disable the speakerphone. The audio route is the earpiece.Sets the built-in encryption mode.
Sets the encryption mode.
Enables built-in encryption with an encryption password before joining a channel.
The encryption password.
Sets the volume of the in-ear monitor.
Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default).
Sets the video layout and audio settings for CDN live.
Sets the CDN live audio/video transcoding settings.
Sets the fallback option for the locally published video stream based on the network conditions.
If option
is set as AudioOnly(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 LocalPublishFallbackToAudioOnly
.
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.
Sets the fallback option for the locally published video stream.
Sets the local voice changer option.
The local voice changer option.
Sets the local voice equalization effect.
Sets 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.
Sets the gain of each band (dB). The value ranges between -15 and 15. The default value is 0.
Changes the voice pitch of the local speaker.
Sets 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).
Sets the local voice reverberation.
Note
As of v3.2.1, the SDK provides a more convenient method setAudioEffectPreset
, which directly implements the popular music, R&B music, KTV and other preset reverb effects.
The reverberation key: AudioReverbType
The local voice reverberation value.
Sets the preset local voice reverberation effect.
The local voice reverberation preset.
Sets the log files that the SDK outputs.
The absolute path of log files. The default file path is as follows:
/storage/emulated/0/Android/data/<package_name>/files/agorasdk.log
App Sandbox/Library/caches/agorasdk.log
Ensure that the directory for the log files exists and is writable. You can use this parameter to rename the log files.Sets the size (KB) of a log file that the SDK outputs.
The size (KB) of a log file. The default value is 1024 KB. If you set fileSizeInKByte
to 1024 KB, the SDK outputs
at most 5 MB log files; if you set it to less than 1024 KB, the maximum size of a log file is still 1024 KB.
Sets the output log level of the SDK.
Sets the log filter level.
Sets low-light enhancement.
Sets whether to enable low-light enhancement:
true
: Enable.false
: (Default) Disable.The low-light enhancement options. See LowLightEnhanceOptions
.
Sets the maximum size of the metadata.
Buffer size of the sent or received metadata.
Sets the default video-stream type of the remotely subscribed video stream when the remote user sends dual streams.
Note
setRemoteVideoStreamType
, the SDK applies the settings in the setRemoteVideoStreamType
method.Sets the default video-stream type.
Sets the fallback option for the remotely subscribed video stream based on the network conditions.
If option
is set as AudioOnly(2)
, the SDK automatically switches
the video from a high-stream to a low-stream, or disables the video when the downlink network condition 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 the audio-only stream switches back to the video,
the SDK triggers the RemoteSubscribeFallbackToAudioOnly
callback.
Sets the fallback option for the remotely subscribed video stream.
Sets the priority of a remote user's media 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.
The ID of the remote user.
The priority of the remote user.
Sets the stream type of the remote video.
Under limited network conditions, if the publisher has not disabled the
dual-stream mode using enableDualStreamMode(false)
, the receiver can choose to receive
either the high-video stream (the high resolution, and high bitrate video stream) or the low-video stream (the low resolution, and low bitrate video stream).
By default, users receive the high-video stream. Call this method if you want to switch to the low-video stream. This method allows the app to adjust the corresponding video stream type based on the size of the video window to reduce the bandwidth and resources.
The aspect ratio of the low-video stream is the same as the high-video stream. Once the resolution of the high-video stream is set, the system automatically sets the resolution, frame rate, and bitrate of the low-video stream.
The SDK reports the result of calling this method in the ApiCallExecuted
callback.
Note
You can call this method either before or after joining a channel. If you call both setRemoteVideoStreamType
and setRemoteDefaultVideoStreamType
, the SDK applies the settings in the setRemoteVideoStreamType
method.
ID of the remote user sending the video stream.
Sets the video-stream type.
Sets the sound position 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 wired headset.
The ID of the remote user.
The sound position of the remote user. The value ranges from -1.0 to 1.0:
Gain 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.
Sets video noise reduction.
Sets whether to enable video noise reduction:
true
: Enable.false
: (Default) Disable.The video noise reduction options. See VideoDenoiserOptions
.
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.
If you do not set the video encoder configuration after joining the channel, you can call this method before calling enableVideo
to reduce the render time of the first video frame.
The local video encoder configuration.
Sets parameters for SDK preset voice beautifier effects.
The options for SDK preset voice beautifier effects:
- SingingBeautifier
: Singing beautifier effect.
The gender characteristics options for the singing voice:
- 1
: A male-sounding voice.
- 2
: A female-sounding voice.
The reverberation effects options:
- 1
: The reverberation effect sounds like singing in a small room.
- 2
: The reverberation effect sounds like singing in a large room.
- 3
: The reverberation effect sounds like singing in a hall.
Sets an SDK preset voice beautifier effect.
The options for SDK preset voice beautifier effects. See VoiceBeautifierPreset
.
Sets an SDK preset voice conversion effect.
The options for SDK preset voice conversion effects. See VoiceConversionPreset
.
Sets the volume of a specified audio effect.
ID of the audio effect. Each audio effect has a unique ID.
Volume of the audio effect. The value ranges between 0.0 and 100.0 (default).
Starts playing and mixing the music file.
This method mixes the specified local or online audio file with the audio stream from the microphone,
or replaces the microphone’s audio stream with the specified local or remote audio file.
You can choose whether the other user can hear the local audio playback and specify the number of playback loops.
When the audio mixing file playback finishes after calling this method, the SDK triggers the AudioMixingFinished
callback.
A successful call of this method triggers the AudioMixingStateChanged
callback and reports Playing
on the local client.
When the audio mixing file playback finishes, the SDK triggers the AudioMixingStateChanged
callback and reports Stopped
on the local client.
Note
To use this method on Android, ensure that the Android device is v4.2 or later, and the API version is v16 or later.
If you want to play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the TooFrequentCall(702)
error occurs.
If you want to play an online music file, Agora does not recommend using the redirected URL address. Some Android devices may fail to open a redirected URL address.
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 CanNotOpen(701)
.
If you call this method on an emulator, only the MP3 file format is supported.
For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
The file path, including the filename extensions.
Sets 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.Sets the audio mixing content:
true
: Only publish the specified audio file; the audio stream from the microphone is not published.false
: The local audio file is mixed with the audio stream from the microphone.Sets the number of playback loops:
@since v3.4.2 The playback position (ms) of the music file.
Starts an audio recording on the client.
Absolute file path (including the suffixes of the filename) of the recording file. The string of the file name is in UTF-8. For example, /sdcard/emulated/0/audio/aac
.
Sample rate (Hz) of the recording file.
The audio recording quality.
Starts an audio recording on the client.
Recording configuration. See AudioRecordingConfiguration
.
Starts to relay media streams across channels.
After a successful method call, the SDK triggers the ChannelMediaRelayStateChanged
and ChannelMediaRelayEvent
callbacks, and these
callbacks return the state and events of the media stream relay.
If the ChannelMediaRelayStateChanged
callback returns Running(2)
and None(0)
,
and the ChannelMediaRelayEvent
callback returns SentToDestinationChannel(4)
, the SDK starts relaying media streams between the original and the destination channel.
If the ChannelMediaRelayStateChanged
callback returns Failure(3)
, an exception occurs during the media stream relay.
Note
joinChannel
method.Broadcaster
in a LiveBroadcasting
channel.stopChannelMediaRelay
to quit the current relay.The configuration of the media stream relay.
Starts an audio call test.
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 stopEchoTest
to end the test.
Otherwise, the app cannot run the next echo test, or call joinChannel
.
In the LiveBroadcasting
profile, only a host can call this method.
The time interval (s) between when you speak and when the recording plays back.
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).
Once this method is enabled, the SDK returns the following callbacks:
LastmileQuality
: the SDK triggers this callback within two seconds depending on the network conditions.
This callback rates the network conditions with a score and is more closely linked to the user experience.
LastmileProbeResult
: 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.
Call this method to check the uplink network quality before users join a channel or before an audience switches to a host.
Note
enableLastmileTest
.LastmileQuality
and LastmileProbeResult
callbacks. Otherwise, the callbacks may be interrupted by other methods.LiveBroadcasting
profile, a host should not call this method after joining a channel.The configurations of the last-mile network probe test.
Starts the local video preview before joining a channel.
Before calling this method, you must call the enableVideo
method to enable the video.
Note
leaveChannel
,
the local video preview remains until you call stopPreview
to disable it.Starts recording the local audio and video.
The recording configurations. See MediaRecorderConfiguration
.
RtcEngine
does not support the request due to one of the following reasons:Enables the virtual metronome.
The absolute path or URL address (including the filename extensions) of the file for the downbeat.
/sdcard/emulated/0/audio.mp4
./var/mobile/Containers/Data/audio.mp4
.The absolute path or URL address (including the filename extensions) of the file for the upbeats.
/sdcard/emulated/0/audio.mp4
./var/mobile/Containers/Data/audio.mp4
.The metronome configuration. See RhythmPlayerConfig
.
Starts pushing media streams to a CDN and sets the transcoding configuration.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
The transcoding configuration for CDN live streaming. See LiveTranscoding
.
url
is null or the string length is 0.Starts pushing media streams to a CDN without transcoding.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
url
is null or the string length is 0.Starts screen sharing.
The configuration of the screen sharing. See ScreenCaptureParameters
.
startScreenCapture
on systems earlier than Android 5.startScreenCapture
and set captureAudio
as true
on systems later than Android 5 (API level 21) and earlier than Android 10 (API level 29).Stops playing all audio effects.
Stops playing or mixing the music file.
Call this method when you are in a channel.
Stops the audio recording on the client.
Stops the media stream relay.
Once the relay stops, the host quits all the destination channels.
After a successful method call, the SDK triggers the ChannelMediaRelayStateChanged
callback.
If the callback returns Idle(0)
and None(0)
, the host successfully stops the relay.
Note
If the method call fails, the SDK triggers the ChannelMediaRelayStateChanged
callback with the ServerNoResponse(2)
or ServerConnectionLost(8)
error code.
You can leave the channel by calling leaveChannel
, and the media stream relay automatically stops.
Stops the audio call test.
Stops playing a specified audio effect.
Note
If you preloaded the audio effect into the memory through the preloadEffect
method,
ensure that the soundID
value is set to the same value as in the preloadEffect
method.
ID of the specified audio effect. Each audio effect has a unique ID.
Stops the last-mile network probe test.
Stops the local video preview and the video.
Note
Call this method after you start the local video preview and before you join the channel.
Stops recording the local audio and video.
Disables the virtual metronome.
Stops pushing media streams to a CDN.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
Stops screen sharing.
Switches between front and rear cameras.
Switches to a different channel.
This method allows the audience of a LiveBroadcasting
channel to switch to a different channel.
After the user successfully switches to another channel, the LeaveChannel
and JoinChannelSuccess
callbacks are triggered to
indicate that the user has left the original channel and joined a new one.
Once the user joins the channel (switches to another channel), the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billing calculation. If you do not want to subscribe to a specified stream or all remote streams, call the mute
methods accordingly.
Note
This method applies to the Audience
role in a LiveBroadcasting
channel only.
The token generated at your server. See Authenticate Your Users with Tokens.
Unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
@since v3.3.1. (Optional) The channel media options: ChannelMediaOptions
.
Takes a snapshot of a video stream.
The channel name.
The user ID of the user. Set uid
as 0
if you want to take a snapshot of the local user's video.
The local path (including the filename extensions) for the snapshot. Ensure that the path you specify exists and is writable. For example:
/storage/emulated/0/Android/data/<package name>/files/example.jpg
./App Sandbox/Library/Caches/example.jpg
.Releases a specified preloaded audio effect from the memory.
ID of the audio effect. Each audio effect has a unique ID.
Unregisters the metadata observer.
Updates the channels for media relay.
After the channel media relay starts, if you want to relay the media stream to more channels,
or leave the current relay channel, you can call updateChannelMediaRelay
.
After a successful method call, the SDK triggers the ChannelMediaRelayEvent
callback with the UpdateDestinationChannel(7)
state code.
Note
Call this method after the startChannelMediaRelay
method to update the destination channel.
This method supports adding at most four destination channels in the relay. If there are already four destination channels in the relay.
The media stream relay configuration
Updates the transcoding configuration.
The transcoding configuration for CDN live streaming. See LiveTranscoding
.
Updates the screen sharing configuration.
The configuration of the screen sharing. See ScreenCaptureParameters
.
Creates an RtcEngine
instance.
Unless otherwise specified, all the methods provided by the RtcEngine
class are executed asynchronously. Agora recommends calling these methods in the same thread.
Note
The App ID issued to you by Agora. See How to get the App ID.
Only users in apps with the same App ID can join the same channel and communicate with each other.
Use an App ID to create only one RtcEngine
instance. To change your App ID, call destroy
to destroy the current RtcEngine
instance, and after destroy
returns 0
,
call create
to create an RtcEngine
instance with the new App ID.
RtcEngine
instance, if the method call succeeds.Creates an RtcEngine
instance.
The App ID issued to you by Agora. See How to get the App ID.
Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only one RtcEngine
instance.
To change your App ID, call destroy
to destroy the current RtcEngine
instance and after destroy
returns 0
, call create
to create an RtcEngine
instance with the new App ID.
The area of connection. This advanced feature applies to scenarios that have regional restrictions. For details, see AreaCode.
After specifying the region, the app that integrates the Agora SDK connects to the Agora servers within that region.
RtcEngine
instance, if the method call succeeds.Creates an RtcEngine
instance.
Configurations for the RtcEngine
instance. For details, see RtcEngineConfig
.
RtcEngine
instance, if the method call succeeds.Creates an RtcEngine
instance.
Configurations for the RtcEngine
instance. For details, see RtcEngineContext
.
RtcEngine
instance, if the method call succeeds.Gets the warning or error description.
The warning or error description.
Gets the SDK version.
The version of the current SDK in the string format. For example, 2.3.0.
Generated using TypeDoc
RtcEngine
is the main class of the Agora SDK.