Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
Listens for the events during the Agora engine runtime.
The compatible bitrate set in the setVideoEncoderConfiguration method.
The bitrate remains the same regardless of the channel profile. If you choose this mode in the LIVE_BROADCASTING
profile, the
video frame rate may be lower than the set value.
Use the default minimum bitrate.
(Recommended) The standard bitrate set in the setVideoEncoderConfiguration method.
In this mode, the bitrates differ between the live interactive streaming and communication profiles:
COMMUNICATION
profile: The video bitrate is the same as the base bitrate.LIVE_BROADCASTING
profile: The video bitrate is twice the base bitrate.Adds a voice or video stream URL address to the live streaming.
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.
The addInjectStreamUrl
method call triggers the following callbacks:
Note
LIVE_BROADCASTING
profile only.The URL address to be added to the ongoing streaming. Valid protocols are RTMP, HLS, and HTTP-FLV.
agora.InjectStreamConfig contains the configuration of the added voice or video stream.
ERR_INVALID_ARGUMENT
): The injected URL does not exist. Call this method again to inject the stream and
ensure that the URL is valid.ERR_NOT_READY
): The user is not in the channel.ERR_NOT_SUPPORTED
): The channel profile is not LIVE_BROADCASTING
. Call the
setChannelProfile method and set the channel profile to LIVE_BROADCASTING
before calling this method.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
LIVE_BROADCASTING
only.The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The RTMP URL address must not contain special characters, such as Chinese language characters.
Sets whether transcoding is enabled/disabled:
true
, ensure that you call the
setLiveTranscoding method before this method.null
or has a string length of 0.Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video in the live 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 watermark image replaces the previous one.
The watermark position depends on the settings in the setVideoEncoderConfiguration method:
setVideoEncoderConfiguration
method. Otherwise, the watermark image will be cropped.Note
visibleInPreview
member in the WatermarkOptions
class to set whether or not the watermark is visible in preview.The 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.
The watermark's options to be added. See WatermarkOptions.
Adjusts the audio mixing volume for local playback.
Audio mixing volume for local playback. The value ranges between 0 and 100 (default).
Adjusts the audio mixing volume for publishing (for remote users).
Audio mixing volume for publishing. The value ranges between 0 and 100 (default).
Adjusts the volume during audio mixing.
Call this method when you are in a channel.
Audio mixing volume. The value ranges between 0 and 100 (default).
Adjusts the playback volume of all remote users.
Note
adjustPlaybackSignalVolume
and
adjustAudioMixingVolume methods and set the volume as 0
.The playback volume of all remote users. To avoid echoes and improve call quality, Agora recommends setting the value of volume between 0 and 100. If you need to set the value higher than 100, contact support@agora.io first.
Adjusts the recording volume.
Recording volume. To avoid echoes and improve call quality, Agora recommends setting the value of volume between 0 and 100. If you need to set the value higher than 100, contact support@agora.io first.
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
The 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 the addVideoWatermark method.
Allows a user to complain about the call quality after a call ends.
The ID of the call, retrieved from the getCallId method.
(Optional) The description of the complaint, with a string length of less than 800 bytes.
Creates a data stream.
Each user can create up to five data streams during the lifecycle of the Agora engine.
The ID of the created data stream.
Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
Sets whether or not the recipients receive the data stream in the sent order:
Disables the audio module.
Note
Disables the network connection quality test.
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
Enables the audio module.
The audio mode is enabled by default.
Note
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.
Sets the time interval between two consecutive volume indications:
interval
> 200 ms.
Do not set interval
< 10 ms, or the onAudioVolumeIndication
callback will not be triggered.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 onAudioVolumeIndication
callback reports the voice activity status of the local user.
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.Sets the stream mode to the single-stream (default) or dual-stream mode. (LIVE_BROADCASTING
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).
Sets the stream mode:
Enables/Disables the built-in encryption.
In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel.
All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared.
Note
SM4_128_ECB
mode), you
need to add an external encryption library when integrating the Android or iOS SDK.Whether to enable the built-in encryption:
Configurations of built-in encryption schemas. See EncryptionConfig.
Enables/Disables face detection for the local user.
Once face detection is enabled, the SDK triggers the onFacePositionChanged callback to report the face information of the local user, which includes the following aspects:
Determines whether to enable the face detection function for the local user:
Enables in-ear monitoring.
Determines whether to enable in-ear monitoring.
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
onLastmileQuality
callback. Otherwise, the callback may
be interrupted by other methods, and hence may not be triggered.disableLastmileTest
method or not, the SDK automatically stops consuming the bandwidth.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.
Once the local audio function is disabled or re-enabled, the SDK triggers the
onLocalAudioStateChanged callback, which reports
LOCAL_AUDIO_STREAM_STATE_STOPPED(0)
or LOCAL_AUDIO_STREAM_STATE_RECORDING(1)
.
Note
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.Sets whether to disable/re-enable the local audio function:
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.
Sets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
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.
Sets whether or not to enable stereo panning for remote users:
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
Enables interoperability with the Agora Web SDK.
Sets whether to enable/disable interoperability with the Agora Web SDK:
Retrieves the playback position (ms) of the music file.
Call this method when you are in a channel.
Retrieves the duration (ms) of the music file.
Call this method when you are in a channel.
Retrieves the audio mixing volume for local playback.
This method helps troubleshoot audio volume related issues.
Retrieves the audio mixing volume for publishing.
This method helps troubleshoot audio volume related issues.
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.
The current call ID.
Gets the current connection state of the SDK.
Retrieves the volume of the audio effects.
The value ranges between 0.0 and 100.0.
Retrieves the warning or error description.
See WARN_CODE_TYPE or ERROR_CODE_TYPE.
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 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
interface by passing in the user ID.
The user ID of the remote user. Ensure that you set this parameter.
A UserInfo interface that identifies the user.
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 UserInfo, and triggers the onUserInfoUpdated callback on the local client.
After receiving the onUserInfoUpdated callback, you can call this method
to get the user ID of the remote user from the UserInfo
interface by passing in the user account.
The user account of the user. Ensure that you set this parameter.
A UserInfo interface that identifies the user.
Retrieves the SDK version number.
The version of the current SDK in the string format. For example, "3.1.2"
.
Initializes the Agora engine.
Unless otherwise specified, all the methods provided by the Agora engine are executed asynchronously. Agora recommends calling these methods in the same thread.
Note
initWithAreaCode
and this method is that
initWithAreaCode
enables you to specify the region for connection.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. To change your
App ID, call release to release
the current Agora engine, and after release
returns 0
, call
init
to initializes the Agora engine with a new App ID.
Initializes the Agora engine.
Unless otherwise specified, all the methods provided by the Agora engine are executed asynchronously. Agora recommends calling these methods in the same thread.
Note
init
and this method is that this method enables you to specify the region for connection.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 initialize only one Agora engine. To change your
App ID, call release to release
the current Agora engine, and after release
returns 0
, call
initWithAreaCode
to initializes the Agora engine with a new App ID.
The region for connection. This advanced feature applies to scenarios that have regional restrictions.
For the regions that Agora supports, see AREA_CODE. After specifying the region, the SDK connects to the Agora servers within that region.
Checks whether the speakerphone is enabled.
Joins a channel with the user ID.
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:
COMMUNICATION
profile, or is a host in the LIVE_BROADCASTING
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 onRejoinChannelSuccess callback on the local client.
The token for authentication:
The unique channel name for the Agora RTC session in the string format smaller than 64 bytes. Supported characters:
(Optional) The 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.
(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.
Joins the channel with a user account.
After the user successfully joins the channel, the SDK triggers the following callbacks:
COMMUNICATION
profile, or
is a host in the LIVE_BROADCASTING
profile.Note
The token for authentication:
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
. Supported character scopes are:
ERR_INVALID_ARGUMENT
)ERR_NOT_READY
)ERR_REFUSED
)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:
COMMUNICATION
channel, or is a host in the LIVE_BROADCASTING
profile.Note
leaveChannel
method, the leaveChannel
process
interrupts, and the onLeaveChannel callback is not triggered.leaveChannel
method during a CDN live streaming, the SDK triggers the
removePublishStreamUrl method.Stops/Resumes receiving all remote users' audio streams.
Sets whether to receive or stop receiving all remote users' audio streams.
Stops/Resumes receiving all video stream from a specified remote user.
Sets whether to receive/stop receiving all remote users' video streams:
Stops/Resumes sending the local audio stream.
A successful muteLocalAudioStream
method call triggers the onUserMuteAudio
callback on the remote client.
Note
mute
is set as true
, this method does not disable the microphone, which does not affect any ongoing recording.setChannelProfile
method.Sets whether to send or stop sending the local audio stream:
Stops/Resumes sending the local video stream.
A successful muteLocalVideoStream
method call triggers the
onUserMuteVideo callback on the remote client.
Note
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.setChannelProfile
method.Sets whether to send/stop sending the local video stream:
Stops/Resumes receiving a specified remote user's audio stream.
User ID of the specified remote user sending the audio.
Sets whether to receive/stop receiving a specified remote user's audio stream:
Stops/Resumes receiving the video stream from a specified remote user.
User ID of the specified remote user.
Sets whether to stop/resume receiving the video stream from a specified remote user:
Stops monitoring the events during the Agora engine runtime.
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.
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.
ID of the specified audio effect. Each audio effect has a unique ID.
Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file, for example, c:/music/audio.mp4. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav.
Sets the number of times the audio effect loops:
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 and 100 (default). The lower the value, the lower the volume of the audio effect.
Sets whether or not to publish the specified audio effect to the remote stream:
Preloads a specified audio effect file into the memory.
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.
ID of the audio effect. Each audio effect has a unique ID.
The absolute path of the audio effect file.
Allows a user to rate a call after the call ends.
The 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 ERR_INVALID_ARGUMENT(-2)
error returns.
(Optional) The description of the rating, with a string length of 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 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:
registerLocalUserAccount
method to create a user account, and then the
joinChannelWithUserAccount method to join the channel.joinChannelWithUserAccount
method 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.
You need to specify the metadata type in this method.
This method enables you to add synchronized metadata in the video stream for more diversified live interactive streaming, such as sending shopping links, digital coupons, and online quizzes.
Note
LIVE_BROADCASTING
channel profile.See METADATA_TYPE. The SDK supports VIDEO_METADATA(0)
only for now.
Registers a packet observer.
The Agora SDK allows your application to register a packet observer to receive callbacks for voice or video packet transmission.
Note
The registered packet observer.
Releases all resources of the Agora engine.
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 release
to release the Agora engine, 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 init to initialize a new Agora engine.
Removes the voice or video stream URL address from the live streaming.
This method removes the URL address (added by the addInjectStreamUrl method) from the live streaming.
The URL address of the injected stream to be removed.
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
LIVE_BROADCASTING
only.The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes.
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:
CONNECTION_CHANGED_TOKEN_EXPIRED(9)
.The application should call this method to get the new token
. Failure to do so will result in the SDK disconnecting from the
server.
The new token.
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.
Agora supports reporting and analyzing customized messages.
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.
To try out this function, contact support@agora.io and discuss the format of customized messages with us.
Sends the metadata.
Note
The sent metadata.
The size of the sent metadata.
The timestamp (ms) of the metadata.
ID of the user who sends the metadata.
Sends data stream messages to all users in a channel.
The SDK has the following restrictions on this method:
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 onStreamMessageError callback on the remote client.
ID of the sent data stream, returned in the createDataStream method.
The sent data.
Length of the sent data.
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.
Sets the pitch of the local music file by chromatic scale. The default value is 0, which means keeping 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 position of the music file to a different starting position (the default plays from the beginning).
The playback starting position (ms) of the music file.
Sets the audio parameters and application scenarios.
Note
setAudioProfile
method must be called before the joinChannel method.COMMUNICATION
and LIVE_BROADCASTING
profiles, the bitrate may be different from your settings due
to network self-adaptation.profile
as AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)
and scenario
as AUDIO_SCENARIO_GAME_STREAMING(3)
.Sets the sample rate, bitrate, encoding mode, and the number of channels. See AUDIO_PROFILE_TYPE.
Sets 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?.
Enables/Disables image enhancement and sets the options.
Note
Sets whether or not to enable image enhancement:
Sets the image enhancement option. See BeautyOptions.
Sets the camera capture configuration.
For a video call or the live interactive video streaming, 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:
config
as
CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to avoid such problems.config
as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to optimize CPU and RAM usage.CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2)
.Sets the camera capturer configuration. See CameraCapturerConfiguration.
Sets the channel profile of the Agora engine.
The Agora engine differentiates channel profiles and applies optimization algorithms accordingly. For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality for the live interactive video streaming.
The channel profile of the Agora engine. See CHANNEL_PROFILE_TYPE.
ERR_OK
): Success.ERR_INVALID_ARGUMENT
): The parameter is invalid.ERR_NOT_INITIALIZED
): The SDK is not initialized.Sets the role of the user, such as a host or an audience (default), before joining a channel in the live interactive streaming.
This method can be used to switch the user role in the live interactive streaming after the user joins a channel.
In the LIVE_BROADCASTING
profile, when a user switches user roles after joining a channel, a successful
setClientRole
method call triggers the following callbacks:
Sets the role of the user. See CLIENT_ROLE_TYPE.
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 profile:
COMMUNICATION
: In a voice call, the default audio route is the earpiece. In a video call, the default audio
route is the 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_BROADCASTING
: Speakerphone.Note
COMMUNICATION
profile.Sets the default audio route:
Stops/Resumes receiving all remote users' audio streams by default.
You can call this method either before or after joining a channel. If you call setDefaultMuteAllRemoteAudioStreams (true)
after joining a channel, the remote audio streams of all subsequent users are not received.
Sets whether to receive/stop receiving all remote users' audio streams by default:
Stops/Resumes receiving all remote users' video streams by default.
You can call this method either before or after joining a channel. If you call setDefaultMuteAllRemoteVideoStreams (true)
after joining a channel, the remote video streams of all subsequent users are not received.
Sets whether to receive/stop receiving all remote users' video streams by default:
Sets the volume of the audio effects.
Sets the volume of the audio effects. The value ranges between 0 and 100 (default).
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
Sets whether to route the audio to the speakerphone or earpiece:
Sets the built-in encryption mode.
The set encryption mode:
null
, the encryption mode is set as "aes-128-xts" by default.Enables built-in encryption with an encryption password before users join a channel.
The encryption password.
Sets the high-quality audio preferences.
Sets whether to enable/disable full-band codec (48-kHz sample rate). Not compatible with SDK versions before v1.7.4:
Sets whether to enable/disable stereo codec. Not compatible with SDK versions before v1.7.4:
Sets whether to enable/disable high-bitrate mode. Recommended in voice-only mode:
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. (CDN live only.)
The SDK triggers the onTranscodingUpdated callback when you call the
setLiveTranscoding
method to update the transcoding setting.
Note
LIVE_BROADCASTING
only.setLiveTranscoding
method to update the transcoding setting for the first time, the SDK does
not trigger the onTranscodingUpdated
callback.Sets the CDN live audio/video transcoding settings. See LiveTranscoding.
Sets the fallback option for the published video stream based on the network conditions.
If option
is set as
STREAM_FALLBACK_OPTION_AUDIO_ONLY(2),
the SDK will:
When the 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.
Sets the fallback option for the published video stream. See STREAM_FALLBACK_OPTIONS.
Sets the local voice changer option.
This method can be used to set the local voice effect for users in a COMMUNICATION
channel or hosts in a
LIVE_BROADCASTING
channel.
Voice changer options include the following voice effects:
VOICE_CHANGER_XXX
: Changes the local voice to an old man, a little boy, or the Hulk. Applies to the voice
talk scenario.VOICE_BEAUTY_XXX
: Beautifies the local voice by making it sound more vigorous, resounding, or adding spacial
resonance. Applies to the voice talk and singing scenario.GENERAL_VOICE_BEAUTY_XXX
: Adds gender-based beautification effect to the local voice. Applies to the voice
talk scenario.Note
AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)
or
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)
.Sets the local voice changer option. The default value is VOICE_CHANGER_OFF
, which means
the original voice. See details in VOICE_CHANGER_PRESET.
Gender-based beatification effect works best only when assigned a proper gender:
GENERAL_BEAUTY_VOICE_MALE_MAGNETIC
.GENERAL_BEAUTY_VOICE_FEMALE_FRESH
or GENERAL_BEAUTY_VOICE_FEMALE_VITALITY
.Failure to do so can lead to voice distortion.
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, 250, 500, 1k, 2k, 4k, 8k, and 16k Hz. See AUDIO_EQUALIZATION_BAND_FREQUENCY.
Sets the gain of each band in dB. The value ranges between -15 and 15.
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.
You can also use setLocalVoiceReverbPreset to use the preset reverberation effect, such as pop music, R&B or rock music effects.
Sets the reverberation key. See AUDIO_REVERB_TYPE.
Sets the value of the reverberation key.
Sets the local voice reverberation option, including the virtual stereo.
This method sets the local voice reverberation for users in a COMMUNICATION
channel or hosts in a LIVE_BROADCASTING
channel.
After successfully calling this method, all users in the channel can hear the voice with reverberation.
Note
AUDIO_REVERB_FX
, ensure that you set profile in
setAudioProfile as AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)
or
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)
; otherwise, this methods cannot set the corresponding voice
reverberation option.AUDIO_VIRTUAL_STEREO
, Agora recommends setting the profile
parameter in
setAudioProfile
as AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)
.The local voice reverberation option. The default value is AUDIO_REVERB_OFF
,
which means the original voice. See AUDIO_REVERB_PRESET.
To achieve better voice effects, Agora recommends the enumeration whose name begins with AUDIO_REVERB_FX
.
Sets the log files that the SDK outputs.
By default, the SDK outputs five log files, agorasdk.log
, agorasdk_1.log
, agorasdk_2.log
, agorasdk_3.log
,
agorasdk_4.log
, each with a default size of 1024 KB.
These log files are encoded in UTF-8. The SDK writes the latest logs in agorasdk.log
. When agorasdk.log
is
full, the SDK deletes the log file with the earliest modification time among the other four, renames
agorasdk.log
to the name of the deleted log file, and create a new agorasdk.log
to record latest logs.
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 of a log file that the SDK outputs.
By default, the SDK outputs five log files, agorasdk.log
, agorasdk_1.log
, agorasdk_2.log
, agorasdk_3.log
,
agorasdk_4.log
, each with a default size of 1024 KB.
These log files are encoded in UTF-8. The SDK writes the latest logs in agorasdk.log
. When agorasdk.log
is
full, the SDK deletes the log file with the earliest modification time among the other four, renames
agorasdk.log
to the name of the deleted log file, and create a new agorasdk.log
to record latest logs.
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.
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
.
Sets the log filter level. See LOG_FILTER_TYPE.
Sets the maximum size of the Metadata.
The metadata includes the following parameters:
uid
: ID of the user who sends the metadata.size
: The size of the sent or received metadata.buffer
: The sent or received metadata.timeStampMs
: The timestamp (ms) of the metadata.The maximum size of the buffer of the metadata that you want to use. The highest value is 1024 bytes.
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
Sets the parameter as a JSON string in the specified format.
Sets the default stream type of remote videos.
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-quality 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-quality 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-quality video stream. Once the resolution of the high-quality video stream is set, the system automatically sets the resolution, frame rate, and bitrate of the low-video stream.
The method result returns in the onApiCallExecuted callback.
Sets the default video-stream type. See REMOTE_VIDEO_STREAM_TYPE.
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.
Sets the fallback option for the remotely subscribed video stream. See STREAM_FALLBACK_OPTIONS.
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.
The ID of the remote user.
Sets the priority of the remote user. See PRIORITY_TYPE.
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-quality 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-quality 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-quality video stream. Once the resolution of the high-quality video stream is set, the system automatically sets the resolution, frame rate, and bitrate of the low-video stream.
The method result returns in the onApiCallExecuted callback.
ID of the remote user sending the video stream.
Sets the video-stream type. See REMOTE_VIDEO_STREAM_TYPE.
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
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 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.
Sets the local video encoder configuration. See VideoEncoderConfiguration.
Sets the video profile.
Sets the video profile. See VIDEO_PROFILE_TYPE.
Sets whether to swap the width and height of the video stream:
Sets the volume of a specified audio effect.
ID of the audio effect. Each audio effect has a unique ID.
Sets the volume of the specified audio effect. The value ranges between 0 and 100 (default).
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
WARN_AUDIO_MIXING_OPEN_ERROR(-701)
.AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL(702)
error code occurs.The absolute path (including the suffixes of the filename) of the local or online audio file to mix, for example, c:\music\audio.mp4. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MP4, MPEG-4, SAMI, and WAVE. For more information, see Supported Media Formats in Media Foundation.
Sets which user can hear the audio mixing:
Sets the audio mixing content:
Sets the number of playback loops:
-1
: Infinite playback loops.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:
Note
joinChannel
method. The recording automatically stops when you call
the leaveChannel
method.sampleRate
is 44.1 kHz or 48 kHz.The absolute file path of the recording file. The string of the file name is in UTF-8, such as /dir1/dir2/dir3/audio.aac.
Sets the audio recording quality. See AUDIO_RECORDING_QUALITY_TYPE.
Sample rate (Hz) of the recording file. Supported values are as follows:
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.
onChannelMediaRelayStateChanged
callback returns
RELAY_STATE_RUNNING(2) and
RELAY_OK(0), and the onChannelMediaRelayEvent
callback returns
RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4),
the host starts sending data to the destination channel.onChannelMediaRelayStateChanged
callback returns
RELAY_STATE_FAILURE(3), an exception occurs during
the media stream relay.Note
LIVE_BROADCASTING
channel.The configuration of the media stream relay: ChannelMediaRelayConfiguration.
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
LIVE_BROADCASTING
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.
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:
Note
onLastmileQuality
and onLastmileProbeResult
callbacks. Otherwise,
the callbacks may be interrupted.LIVE_BROADCASTING
profile, a host should not call this method after joining a channel.Sets the configurations of the last-mile network probe test. See LastmileProbeConfig.
Starts the local video preview before joining the channel.
Before calling this method, you must call the enableVideo method to enable video.
Stops playing all audio effects.
Stops playing and mixing the music file.
Call this method when you are in a channel.
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.
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 onChannelMediaRelayStateChanged callback. If the callback returns RELAY_STATE_IDLE(0) and RELAY_OK(0), the host successfully stops the relay.
Stops the audio call test.
Stops playing a specified audio effect.
ID of the audio effect to stop playing. Each audio effect has a unique ID.
Stops the last-mile network probe test.
Stops the local video preview and disables video.
Switches between front and rear cameras.
Sets the camera to be used. See CAMERA_DIRECTION.
Switches to a different channel.
This method allows the audience of a LIVE_BROADCASTING
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.
The token for authentication:
The unique channel name for the Agora RTC session in the string format smaller than 64 bytes. Supported characters:
Releases a specified preloaded audio effect from the memory.
ID of the audio effect. Each audio effect has a unique ID.
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 onChannelMediaRelayEvent callback with the RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7) state code.
The media stream relay configuration: ChannelMediaRelayConfiguration.
Generated using TypeDoc
Listens for the events during the Agora engine runtime.