Voice Call APIAgora Native SDK Error Codes

Voice Call API

Java Interface Class Description
`Basic Methods(RtcEngine)`_ The RtcEngine class provides the main methods that can be invoked by your application.
`Audio Effect Methods(IAudioEffectManager)`_ The IAudioEffectManager class provides the methods to manage the audio effects.
`Callback Methods(IRtcEngineEventHandler)`_ The IRtcEngineEventHandler class enables callback event notifications to your application.

Basic Methods (RtcEngine)

Developer suite: io.agora.rtc

The RtcEngine class is the main interface class of the Agora Native SDK. Call the methods of this class to use all the functionalities of the SDK. We recommend calling the RtcEngine API methods in the same thread instead of in multiple threads. In previous versions this class was named AgoraAudio, and it is renamed to RtcEngine from version 1.0.

Developers must follow the corresponding section to implement basic voice first before adding other functions.

Create an RtcEngine Object (create)

public static RtcEngine create(Context context,
                                    String appId,
                                    IRtcEngineEventHandler  handler )

This method creates an RtcEngine object.

Currently the Agora Native SDK only supports one RtcEngine instance at a time, therefore the application should create only one RtcEngine object. Unless otherwise specified, all called methods provided by the RtcEngine class are executed asynchronously. It is recommended to call the interface methods in the same thread. Unless otherwise specified, the following result applies to all APIs whose return values are integer types: A return value of 0 indicates that the call was successful, and a return value less than 0 indicates that the call failed.

Name Description
context The context of Android Activity.
appId The App ID issued to the application developers by Agora. Apply for a new one from Agora if the key is missing in your kit.
handler IRtcEngineEventHandler is an abstract class that provides default implementations. The SDK uses this class to report to the application on SDK runtime events.
Return Value An RtcEngine object.

Implement Voice Communication

This section shows how to implement a basic voice communication function. Developers can add more functions to the basic voice communication according to the modules included in this document. Ensure that an RtcEngine object has been created for the application according to `Create RtcEngine Object (create)`_.

../_images/android_audio_api.png

Set Channel Profile (setChannelProfile)

int setChannelProfile (int profile)

This method configures the channel profile. The Agora RtcEngine needs to know what scenario the application is in to apply different methods for optimization.

The Agora Native SDK currently supports two profiles:

Profile Description
Communication The default setting. This is used in one-on-one communications or meetings, where all users in the channel can talk freely.
Live Broadcast Live Broadcast involves host and audience roles that can be set by calling setClientRole. The host sends and receives voice, while the audience only receives voice only with the sending function disabled.
Gaming Gaming Voice Mode. Any user in the channel can speak freely. This mode uses the codec with low-power consumption and low bitrate by default.

Note

  • You can only use one profile at the same time in the same channel.
  • This method must be called and configured before a user joins a channel because the channel profile cannot be configured when the channel is in use.
Name Description
profile

The channel profile. Choose one of the following:

  • CHANNEL_PROFILE_COMMUNICATION: Communication (default)
  • CHANNEL_PROFILE _LIVE_BROADCASTING: Live Broadcast
  • CHANNEL_PROFILE _GAME: Gaming Voice
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Enable Audio Mode (enableAudio)

public int enableAudio();

This method enables audio mode, which is enabled by default.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Disable Audio Mode (disableAudio)

public int disableAudio();

This method disables audio mode.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Join Channel (joinChannel)

public int joinChannel(   String  channelKey,
                          String  channelName,
                          String  optionalInfo,
                          int     optionalUid );

This method lets the user 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 using different App IDs cannot call each other. Once in a call, the user must call the leaveChannel method to exit the current call before entering another channel.

Note

One channel does not accept duplicated UIDs, for example, two users with the same UID. If your App supports the function of one user logging in from different devices simultaneously, be sure that you will use different UIDs. For example, if you used the same UID previously, add the respective Device ID in the UID to make the UIDs different. This action does not apply to the scenario if your App does not support one user logging in from different devices, for example, you log onto a new device and it will be forced to quit on the previously logged-in device.

Name Description
channelKey

The token is a Channel Key generated by the application.

This parameter is optional if the user uses a static App ID. In this case, pass NULL as the parameter value.

If a user uses a Channel Key, Agora issues an additional App Certificate to the application developers. Developers can then generate a user key using and an algorithm and App Certificate provided by Agora for user authentication on the server.

In most circumstances, the static App ID will suffice. For users who have a high security requirements, use a Channel Key.

channelName

A string providing a unique channel name for the AgoraRTC session. The length must be within 64 bytes.

The following is the supported scope:a-z,A-Z,0-9,space,!

#$%&,()+,

-,:;<=.,>?

@[],^_,{|},~

optionalInfo (Optional) Additional information about the channel. Other users in the channel will not receive this information.
optionalUid

(Optional) The user ID: A 32-bit unsigned integer ranging from 1 to (2^32-1) which must be unique. If not assigned (or set to 0), the SDK will allocate one and returns it in the onJoinChannelSuccess callback. The app needs to record and maintain the returned value as the SDK does not maintain it.

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 32-bit signed integer and larger numbers are interpreted as negative numbers. If necessary, the UID can be converted to a 64-bit integer via “uid&0xffffffffL”.

Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.
  • ERR_INVALID_ARGUMENT (-2): The passed argument is invalid.
  • ERR_NOT_READY (-3): Initialization failed.
  • ERR_REFUSED (-5): The SDK cannot start a call. It could be that the SDK is in another call or failed to create a channel.

Leave Channel (leaveChannel)

public int leaveChannel();

This method lets the user leave a channel, that is, hanging up or exiting a call.

After joining a channel, the user must call the leaveChannel method to end the call before joining another one. Calling the leaveChannel method even when not in a call is harmless. The leaveChannel method releases all resources related to the call. The leaveChannel method is called asynchronously, and the user actually does not exit the channel when the call returns. Once the user exits the channel, the SDK triggers the onLeaveChannel callback.

Note

If you call destroy() immediately after you have called leaveChannel, it will interrupt the leavechannel process, which means that the SDK will not trigger the onLeaveChannel callback.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set the Local Voice Pitch (setLocalVoicePitch)

public int setLocalVoicePitch(double pitch);

This method changes the voice pitch of the local speaker.

Name Description
pitch The voice frequency in the range of [0.5, 2.0]. The default value is 1.0.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set Audio Profile (setAudioProfile)

public int setAudioProfile(int profile, int scenario);

This method sets the audio parameters and application scenarios.

Name Description
profile

Sets the sampling rate, bitrate, encode mode, and the number of channels:

  • AUDIO_PROFILE_DEFAULT = 0: Default
  • AUDIO_PROFILE_SPEECH_STANDARD = 1: Sampling rate 32 kHz, audio encoding, single channel, and bitrate 18 kbps
  • AUDIO_PROFILE_MUSIC_STANDARD = 2: Sampling rate 32 kHz, music encoding, single channel, and bitrate 50 kbps
  • AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3: Sampling rate 32 kHz, music encoding, dual channel, and bitrate 50 kbps
  • AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4: Sampling rate 48 kHz, music encoding, single channel, and bitrate 128 kbps
  • AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5: Sampling rate 48 kHz, music encoding, dual channel, and bitrate 192 kbps
scenario

Sets the audio application scenarios:

  • AUDIO_SCENARIO_DEFAULT = 0: Default
  • AUDIO_SCENARIO_CHATROOM = 1: Applicable to the chatroom scenario which requires frequent host in and out
  • AUDIO_SCENARIO_EDUCATION = 2: Applicable to the education scenario which prioritizes the fluency and stability
  • AUDIO_SCENARIO_GAME_STREAMING = 3: Applicable to the live gaming scenario which needs to enable the gaming audio effect in speaker mode in the live broadcast scenario
  • AUDIO_SCENARIO_SHOWROOM = 4: Applicable to the showroom scenario which optimizes the audio quality with professional external equipment
Return Value
  • 0: Method call succeeded
  • <0: Method call failed

Set Audio Route

Set Default Audio Route (setDefaultAudioRouteToSpeakerPhone)

public int setDefaultAudioRouteToSpeakerPhone( boolean defaultToSpeaker );

This method modifies the default audio route if necessary.

The default audio routes are listed in the following table:

Channel Mode Default Audio Route
Communication Earpiece
Live Broadcast Speakerphone
Game Voice Speakerphone

You can modify the default audio routes if necessary according to the following table:

Name Description
defaultToSpeaker
  • True: Speakerphone.
  • False: Earpiece.

No matter whether the audio is routed to the speakerphone or earpiece, once a headset is plugged in or bluetooth is connected,

the audio route will be changed. The audio route will be switched to default once removing the headset or disconnecting bluetooth.

Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Enable Speakerphone (setEnableSpeakerphone)

public int setEnableSpeakerphone( boolean enabled );

This method enables the audio routing to the speakerphone.

After calling this method, the SDK will return the onAudioRouteChanged callback to indicate the changes.

Note

Ensure that you have read the default audio route explanation according to Set Default Audio Route(SetDefaultAudioRouteToSpeakerPhone) and checked whether it is necessary to call this method.

Name Description
enabled
  • True:
    • If this API is called after joining a channel, whether the audio was routed to the headset, bluetooth, or earpiece, it will be routed to the speaker.
    • If this API is called before joining a channel, when joining a channel, the audio will be routed to the speaker whether the user uses a headset or bluetooth.
  • False: The audio will follow the default audio route mentioned in Set Default Audio Route(setDefaultAudioRouteToSpeakerphone).
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set Audio Volume

Set Speakerphone Volume (setSpeakerphoneVolume)

public int setSpeakerphoneVolume( int volume );

This method sets the speakerphone volume.

Name Description
volume Sets the speakerphone volume between 0 (lowest) to 255 (highest).
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Enable Audio Volume Indication (enableAudioVolumeIndication)

public int enableAudioVolumeIndication(int interval, int smooth);

This method enables the SDK to regularly report to the application on which user is speaking and the volume of the speaker.

Name Description
interval

Specifies the time interval between two consecutive volume indications.

  • <=0: Disables volume indication.
  • >0: The volume indication interval in milliseconds. We recommend setting it to a minimum of 20 ms.
smooth The smoothing factor. recommended default value is 3.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Mute Audio Stream

Mute Local Audio Stream (muteLocalAudioStream)

public int muteLocalAudioStream( boolean muted );

This method enables/disables sending local audio streams to the network.

Note

When set to True, this method does not disable the microphone and does not affect any ongoing recording.

Name Description
On
  • True: Stops sending local audio streams to the network.
  • False: Allows sending local audio streams to the network.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Mute All Remote Audio Streams (muteAllRemoteAudioStreams)

public int muteAllRemoteAudioStreams( boolean muted );

This method enables/disables playing all remote callers’ audio streams.

Note

When set to True, this method stops playing audio streams without affecting the audio stream receiving process.

Name Description
On
  • True: Stops playing all the received audio streams
  • False: Allows playing all the received audio streams
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Mute Certain Remote Audio Streams (muteRemoteAudioStream)

public int muteRemoteAudioStream(int uid, boolean muted );

This method mutes/unmutes a specified remote user’s audio stream.

Note

When set to True, this method stops playing audio streams without affecting the audio stream receiving process.

Name Description
uid User ID of whose audio stream the user intends to mute.
muted
  • True: Stops playing a specified user’s audio stream.
  • False: Allows playing a specified user’s audio stream.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Audio Mixing

Start Audio Mixing (startAudioMixing)

public int startAudioMixing(String filePath,
                                  bool loopback,
                                  bool replace,
                                  int cycle);

This method mixes the specified local audio file with the audio stream that the microphone collects; or, it replaces the microphone audio stream with the specified local audio file. You can decide whether the other user can hear the local audio playback and specify the number of loop playbacks. This API also supports online music playback.

Note

  • If you want to use this API, then ensure that the Android device version is 4.2 or later, and the API version is 16 or later.
  • Call this API when you are in the channel, otherwise it may cause issues.
  • If you call this API on a simulator, only the MP3 file format is supported.
Name Description
filePath

Specify the name and path of the local audio file to be mixed:

  • If the path begins with /assets/, find the audio file in the /assets/ directory.
  • Otherwise, find the audio file in the absolute path.

Supported audio formats: mp3, aac, m4a, 3gp, wav, flac

loopback
  • True: Only the local user can hear the remix or the replaced audio stream.
  • False: Both users can hear the remix or the replaced audio stream.
replace
  • True: The content of the local audio file replaces the audio stream collected by the microphone.
  • False: Mix the content of the local audio file with the audio stream collected by the microphone.
cycle

Specify the number of loop playbacks:

  • Positive integer: The number of loop playbacks
  • -1: Infinite loop
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Stop Audio Mixing (stopAudioMixing)

public int stopAudioMixing

This method stops audio mixing. Call this API when you are in the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Pause Audio Mixing (pauseAudioMixing)

public int pauseAudioMixing();

This method pauses mixing the specified local audio with the microphone input. Call this API when you are in the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Resume Audio Mixing (resumeAudioMixing)

public int resumeAudioMixing();

This method resumes mixing the specified local audio with the microphone input. Call this API when you are in the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Adjust Audio Mixing Volume (adjustAudioMixingVolume)

public int adjustAudioMixingVolume(int volume);

This method adjusts the music volume during audio mixing. Call this API when you are in the channel.

Name Description
volume Music volume ranging from 0 to 100. By default, 100 is the original music volume.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Get the Audio Mixing Duration (getAudioMixingDuration)

public int getAudioMixingDuration();

This method gets the duration (in milliseconds) of the music. Call this API when you are in the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Get the Current Audio Position (getAudioMixingCurrentPosition)

public int getAudioMixingCurrentPosition();

This method gets the playback position (in milleseconds) of the audio. Call this API when you are in the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Drag the Audio Progress Bar (setAudioMixingPosition)

public abstract int setAudioMixingPosition(int pos);

This method drags the playback progress bar of the audio mixing file to where you want to play instead of playing it from the beginning.

Name Description
pos Integer. The position of the audio mixing file (milliseconds).

Recording

Start the Audio Recording (startAudioRecording)

public int startAudioRecording( String filePath, int quality );

This method starts an audio recording. The SDK allows recording during a call, which supports either one of the following two formats:

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

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

Name Description
filePath Full file path of the recording file. The string of the file name is UTF-8 code.
quality

Recording audio quality:

  • AUDIO_RECORDING_QUALITY_LOW = 0: Low quality, file size around 1.2 MB after 10 minutes of recording.
  • AUDIO_RECORDING_QUALITY_MEDIUM = 1: Medium quality, file size around 2B M after 10 minutes of recording.
  • AUDIO_RECORDING_QUALITY_HIGH = 2: High quality, file size around 3.75 MB after 10 minutes of recording.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Stop the Audio Recording (stopAudioRecording)

public int stopAudioRecording();

This method stops recording on the client machine.

Note

Call this method before calling leaveChannel, otherwise the recording automatically stops when the leaveChannel method is called.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set the Recording Audio Format (setRecordingAudioFrameParameters)

Refer to Set Recording Audio Format (setRecordingAudioFrameParameters).

Set the Playback Audio Format (setPlaybackAudioFrameParameters)

Refer to Set Playback Audio Format (setPlaybackAudioFrameParameters).

Adjust the Recording Signal Volume (adjustRecordingSignalVolume)

public int adjustRecordingSignalVolume(int volume);

This method adjusts the recording signal volume.

Name Description
volume

The recording signal volume ranges from 0 to 400:

  • 0: Mute.
  • 100: Original volume.
  • 400: Four times the original volume with signal clipping protection.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Adjust Playback Signal Volume (adjustPlaybackSignalVolume)

public int adjustPlaybackSignalVolume(int volume);

This method adjusts the playback signal volume.

Name Description
volume

The playback signal volume ranges from 0 to 400:

  • 0: Mute.
  • 100: Original volume.
  • 400: Four times the original volume with signal clipping protection
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Encryption

Register Packet Observer (registerAgoraPacketObserver)

JNIEXPORT jint registerAgoraPacketObserver(void* engine,agora::rtc::IPacketObserver* observer);

This method registers a packet observer. When sending or receiving audio packets, the Agora SDK calls back the interface defined by IPacketObserver, and the application can use this interface to process data by performing data encryption and decryption. When the application initializes the RtcEngine instance, use dlopen/dlsym to find registerAgoraPacketObserver, which is the derived function of libagora-rtc-sdk-jni.so.

Note

The maximum size of the processed network packet is 1200 bytes. A packet larger than the maximum size may not be sent successfully.

Name Description
engine It can be retrieved by calling the API RtcEngine.getNativeHandle().
observer Callback interface of the send/receive packet.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Enable Built-in Encryption (setEncryptionSecret)

public abstract int setEncryptionSecret(String secret);

Use setEncryptionSecret to specify an encryption password to enable built-in encryption before joining a channel. All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user has left the channel. If the encryption password is not specified or set to empty, the encryption function will be disabled.

Name Description
secret Encryption Password
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set Built-in Encryption Mode (setEncryptionMode)

int setEncryptionMode  (String  encryptionMode)

The Agora Native SDK supports built-in encryption, which is in AES-128-XTS mode by default. If you want to use other modes, call this API to set the encryption mode.

All users in the same channel must use the same encryption mode and password. You can refer to information on the AES encryption algorithm on the differences of encryption modes.

Note

Call setEncryptionSecret to enable the built-in encryption function before calling this API.

Name Description
encryptionMode

Encryption mode. The following modes are currently supported:

  • “aes-128-xts”:128-bit AES encryption, XTS mode
  • “aes-128-ecb”:128-bit AES encryption, ECB mode
  • “aes-256-xts”: 256-bit AES encryption, XTS mode
  • “”: When it is set to a NULL string, the encryption is in “aes-128-xts” by default.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Establish a Data Channel

Create a Data Stream (createDataStream)

public abstract int createDataStream(boolean reliable, boolean ordered);

This method creates the data stream. Each user can only have up to five data channels at the same time.

Note

Ensure that you set reliable and ordered both as True or both as False. Do not set one as True and the other as False.

Name Description
reliable
  • True: The recipients will receive data from the sender within 5 seconds. If the recipient does not receive the sent data within 5 seconds, the data channel will report an error to the application.
  • False: The recipients will not receive any data, and it will not report any error upon data missing.
ordered
  • True: The recipients will receive data in the order of the sender.
  • False: The recipients will not receive data in the order of the sender.
Return Value
  • <0: Returns error code when it fails to create the data stream. [1]
  • >0: Returns the Stream ID when the data stream is created.

Footnotes

[1]The error code is related to the positive integer displayed in Error Code, for example, if it returns -2, then it indicates 2: ERR_INVALID_ARGUMENT in Error Code.

Send a Data Stream (sendStreamMessage)

public abstract int sendStreamMessage(int streamId, byte[] message);

This method sends data stream messages to all users in a channel. Up to 30 packets can be sent per second in a channel with each packet having a maximum size of 1 kB. The API controls the data channel transfer rate. Each app can send up to 6 kB of data per second. Each user can have up to five data channels simultaneously.

Name Description
streamId Stream ID returned by createDataStream.
message Data to be sent
Return Value

When it fails to send the message, the following error code will be returned:

ERR_SIZE_TOO_LARGE/ERR_TOO_OFTEN/ERR_BITRATE_LIMIT

Test and Detection

Start Audio Call Test (startEchoTest)

public int startEchoTest();

This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. In the test, the user first speaks, and the recording is played back in 10 seconds. If the user can hear the recording in 10 seconds, it indicates that the audio devices and network connection work properly.

Note

After calling the startEchoTest method, call stopEchoTest to end the test; otherwise the application cannot run the next echo test, nor can it call the joinChannel method to start a new call.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.
  • ERR_REFUSED (-5): Failed to launch the echo test, for example, initialization failed.

Stop Audio Call Test (stopEchoTest)

public int stopEchoTest();

This method stops the audio call test.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.
  • ERR_REFUSED(-5): Failed to stop the echo test. It could be that the echo test is not running.

Enable Network Test (enableLastmileTest)

public int enableLastmileTest();

This method tests the quality of the user’s network connection and is disabled by default.

Before users join a channel, they can call this method to check the network quality.

Calling this method consumes extra network traffic, which may affect the communication quality. Call disableLastmileTest to disable it immediately once users have received the onLastmileQuality callback before they join the channel.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Disable Network Test (disableLastmileTest)

public int disableLastmileTest();

This method disables the network connection quality test.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Monitor Network Connection Event (monitorConnectionEvent)

public void monitorConnectionEvent( boolean monitor );

This method monitors the network connection event, which is enabled by default. The application calls this method before entering the channel.

Name Description
monitor
  • True: Monitoring network connection event enabled. (Default)
  • False: Monitoring network connection event disabled.

Feedback

Get Current Call ID (getCallId)

public String getCallId();

This method gets the current call ID.

When a user joins a channel on a client machine, a CallId is generated to identify the call from the client. Some methods such as rate and complain need to be called after the call ends in order to submit feedback to the SDK. These methods require assigned values of the CallId parameters. To use these feedback methods, call the getCallId method to retrieve the CallId during the call, and then pass the value as an argument in the feedback methods after the call ends.

Name Description
Return Value Current call ID.

Rate the Call (rate)

public int rate(String      callId,
                    int     rating,
                    String  description );

This method lets the user rate the call. It is usually called after the call ends.

Name Description
callId Call ID retrieved from the getCallId method.
rating Rating for the call between 1 (lowest) to 10 (highest).
description

Description for the call with a length less than 800 bytes.

This parameter is optional.

Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.
  • ERR_INVALID_ARGUMENT (-2): The passed argument is invalid, for example, callId invalid.
  • ERR_NOT_READY (-3): The SDK status is incorrect, for example, initialization failed.

Complain about Call Quality (complain)

public int complain(String callId,
                    String description );

This method allows the user to complain about the call quality. It is usually called after the call ends.

Name Description
callId Call ID retrieved from the getCallId method.
description

A given description for the call with a length less than 800 bytes.

This parameter is optional.

Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.
  • ERR_INVALID_ARGUMENT (-2): The passed argument is invalid, for example, callId invalid.
  • ERR_NOT_READY (-3): The SDK status is incorrect, for example, initialization failed.

Others

Renew Channel Key (renewChannelKey)

public int renewChannelKey( const char* channelKey )

This method updates the Channel Key.

The key expires after a certain period of time once the Channel Key schema is enabled. When the onError callback reports the error ERR_CHANNEL_KEY_EXPIRED(109), the application should retrieve a new key and then call this method to renew it. Failure to do so will result in the SDK disconnecting with the server.

Name Description
channelKey Specifies the Channel Key to be renewed.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Specify Log File (setLogFile)

public int setLogFile( String filePath );

This method specifies the SDK output log file. The log file records all the log data of the SDK’s operation. Ensure that the directory to save the application exists and is writable.

Name Description
filePath The full file path of the log file. The string of the log file is in UTF-8 code.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Set Log Filter (setLogFilter)

public int setLogFilter( unsigned int filter )

This method sets the SDK output log filter. You can use either one or a combination of the filters.

Name Description
filter Filters
  • 1: INFO
  • 2: WARNING
  • 4: ERROR
  • 8: FATAL
  • 0x800: DEBUG
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Destroy Engine Instance (destroy)

public void destroy();

This method releases all the resources used by the Agora SDK. This is useful for applications that occassionaly make voice calls, to free up resources for other operations when not making calls. Once the application calls destroy() to destroy the created RtcEngine instance, no other methods in the SDK can be used and no callbacks can occur.

To start communication again, reinitialize sharedEngineWithappId to create a new instance of AgoraRtcEngineKit.

Note

This method is called synchronously. The result returns after the IRtcEngine object resources are released. The app should not call this interface in the callback generated by the SDK, otherwise the SDK must wait for the callback to return before it can reclaim the related object resources, causing a deadlock.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Get SDK Version (getVersion)

public void getVersion();

This method returns the string of the version number in character format.

Configure External Audio Source

Set External Audio Source(setExternalAudioSource)

public abstract int setExternalAudioSource(boolean enabled, int sampleRate, int channels);

This method sets the external audio source.

Name Description
enabled Enable external audio source: True/False
sampleRate Sampling rate of the external audio source
channelsPerFrame Number of external audio source channels (two channels maximum)

Push External Audio Frame (pushExternalAudioFrameRawData)

public abstract int pushExternalAudioFrame(byte[] data, long timestamp);

This method pushes the external audio frame to the Agora SDK for encoding.

Name Description
data External audio data
timestamp Timestamp of the external audio frame to be synchronized with the external video source

Audio Effect Methods (IAudioEffectManager)

Get Audio Effect Volume (getEffectsVolume)

double getEffectsVolume();

This method gets the volume of the audio effects from 0.0 to 1.0.

Set Audio Effect Volume (setEffectsVolume)

public int setEffectsVolume(double volume);

This method sets the volume of the audio effects.

Name Description
volume The value ranges from 0.0 to 100.0. 100.0 is the default value.
Return Value
  • 0: Method call succeeded
  • <0: Method call failed

Adjust Audio Effect Volume in Real Time (setVolumeOfEffect)

public int setVolumeOfEffect(int soundId, double volume);

This method adjusts the volume of the specified sound effect in real time.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
volume The value ranges from 0.0 to 100.0. 100.0 is the default value.
Return Value
  • 0: Method call succeeded
  • <0: Method call failed

Play Audio Effect (playEffect)

public int playEffect(int soundId, String filePath, boolean loop, double pitch, double pan, double gain);

This method plays the audio effect.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID. [2]
filePath Absolute path of the audio effect file.
loop

Sets whether to play the audio effect in a loop

  • True: Yes
  • False: No (default)
pitch

Sets whether to change the pitch of the audio effect. The range is [0.5, 2] with 1.0 as the default value, which means no need to change the pitch.

The smaller the value is set, the lower the pitch.

pan

Sets whether to change the spatial position of the audio effect. The range is [-1, 1]:

  • 0: Audio effect shows right ahead.
  • -1: Audio effect shows on the left.
  • 1: Audio effect shows on the right.
gain

Sets whether to change the volume of a single audio effect. The range is [0.0, 100.0].

The default value is 100.0. The smaller the number, the lower the volume of the audio effect.

Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Footnotes

[2]If you loaded the audio effect in the memory through preloadEffect, ensure that the soundId set is the same as the one set in preloadEffect.

Stop Playing Audio Effect (stopEffect)

public int stopEffect(int soundId);

This method stops playing a specific audio effect.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Stop Playing all Audio Effects (stopAllEffects)

public int stopAllEffects();

This method stops playing all audio effects.

Preload Audio Effect (preloadEffect)

public int preloadEffect(int soundId, String filePath);

This method preloads a specific audio effect file (compressed audio file) to the memory.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
filePath Absolute path of the audio effect file.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Release Audio Effect (unloadEffect)

public int unloadEffect(int soundId);

This method releases the specific preloaded audio effect from the memory.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Pause Audio Effect (pauseEffect)

public int pauseEffect(int soundId);

This method pauses the specific audio effect.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Pause all Audio Effects (pauseAllEffects)

public int pauseAllEffects();

This method pauses all audio effects.

Name Description
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Resume Audio Effect (resumeEffect)

public int resumeEffect(int soundId);

This method resumes playing a specific audio effect.

Name Description
soundId ID of the audio effect. Each audio effect has a unique ID.
Return Value
  • 0: Method call succeeded.
  • <0: Method call failed.

Resume All Audio Effects (resumeAllEffects)

public int resumeAllEffects();

This method resumes all audio effects.

Callback Methods (IRtcEngineEventHandler)

Developer Suite: io.agora.rtc

The IRtcEngineEventHandler interface class is used to send callback event notifications to the application. The application inherits the interface class methods to get the event notifications.

All methods in this interface class have a default (empty) implementation, and the application can inherit only required events. In the callback method, the application should avoid time-consuming tasks or calling blocking APIs (such as SendMessage), otherwise the SDK may not work properly.

Join Channel Callback (onJoinChannelSuccess)

public void onJoinChannelSuccess( String channel,
                                    int uid,
                                    int elapsed );

This callback indicates that the user has successfully joined the specified channel with an assigned channel ID and user ID. The channel ID is assigned based on the channel name specified in the join() API. If the user ID is not specified when join() is called, the server allocates one automatically.

Name Description
channel Channel name.
uid

User ID.

If the uid is specified in the joinChannel method, it returns the specified ID; if not, it returns an ID that is automatically assigned by the Agora server.

elapsed Time elapsed (milliseconds) from calling joinChannel until this event occurs.

Rejoin Channel Callback (onRejoinChannelSuccess)

public void onRejoinChannelSuccess(   String channel,
                                      int uid,
                                      int elapsed );

When the client machine loses connection with the server because of network problems, the SDK automatically attempts to reconnect, and triggers this callback method upon reconnection.

Name Description
channel Channel name.
uid User ID.
elapsed Time elapsed (milliseconds) from calling joinChannel until this event occurs.

Warning Occurred Callback (onWarning)

public void onWarning(int warn, const char* msg )

This callback indicates that some warning occurred during the runtime of the SDK. In most cases the application can ignore the warnings reported by the SDK because the SDK usually can fix the issue and resume running. For instance, the SDK may report an ERR_OPEN_CHANNEL_TIMEOUT warning upon disconnection with the server, and in the meantime the SDK attempts to reconnect.

Name Description
warn Warning code.
msg Warning message.

Error Occurred Callback (onError)

public void onError(int err);

This callback indicates that a network or media error occurred during the runtime of the SDK.

In most cases reporting an error means that the SDK cannot fix the issue and resume running, and therefore requires actions from the application or simply informs the user about the issue. For instance, the SDK reports an ERR_START_CALL error when it fails to initialize a call. In this case, the application informs the user that the call initialization has failed and at the same time calls the leaveChannel method to exit the channel.

Name Description
err

Error codes:

  • ERR_INVALID_VENDOR_KEY(101): Invalid App ID.
  • ERR_INVALID_CHANNEL_NAME(102): Invalid channel name.
  • ERR_LOOKUP_CHANNEL_REJECTED(105): Failed to look up the channel because the server rejected the request.
  • ERR_OPEN_CHANNEL_REJECTED(107): Failed to join the channel because the media server rejected the request.
  • ERR_LOAD_MEDIA_ENGINE(1001): Failed to load the media engine.
  • ERR_START_CALL(1002): Failed to open the local audio devices and thus failed to start a call.
  • ERR_START_CAMERA(1003): Failed to start the local camera.

Leave Channel Callback (onLeaveChannel)

public void onLeaveChannel( RtcStats stats );

When the application calls the leaveChannel() method, the SDK uses this callback to notify the application that the user has successfully left the channel. With this callback function, the application retrieves information such as the call duration and the statistics of data received/transmitted by the Audio Quality Callback SDK (onAudioQuality).

Name Description
stats

Statistics about the call.

  • totalDuration: Call duration in seconds, represented by an aggregate value.
  • txBytes: Total number of bytes transmitted, represented by an aggregate value.
  • rxBytes: Total number of bytes received, represented by an aggregate value.
  • txKBitRate: Transmission bitrate in kbps, represented by an instantaneous value.
  • rxKBitRate: Receive bitrate in kbps, represented by an instantaneous value.
  • lastmileQuality: Network connection quality of the client machine, represented by an instantaneous value.
  • cpuTotalQuality: System CPU usage (%).
  • cpuAppQuality: Application CPU usage (%).
struct SessionStat {
    int totalDuration;
    int txBytes;
    int rxBytes;
    int txKBitRate;
    int rxKBitRate;
    int lastmileQuality;
    int cpuTotalUsage;
    int cpuAppUsage;
    };

Audio Route Changed Callback (onAudioRouteChanged)

public void onAudioRouteChanged(int routing);

The SDK notifies the application that the audio route has changed after calling setEnableSpeakerphone successfully.

It notifies that the current audio route has switched to the earpiece, speakerphone, headset, or bluetooth.

Audio Quality Callback (onAudioQuality)

public void onAudioQuality(int    uid,
                           int    quality,
                           short  delay,
                           short  lost );

During a call, this callback is triggered once every two seconds to report the audio quality of the current call. By default it is enabled.

Name Description
uid User ID of the speaker
quality

Rating of the audio quality:

  • QUALITY_UNKNOWN( = 0)
  • QUALITY_EXCELLENT( = 1)
  • QUALITY_GOOD( = 2)
  • QUALITY_POOR( = 3)
  • QUALITY_BAD( = 4)
  • QUALITY_VBAD( = 5)
  • QUALITY_DOWN( = 6)
delay Time delay (milliseconds).
lost Packet loss rate (%).

Audio Volume Indication Callback (onAudioVolumeIndication)

public void onAudioVolumeIndication( AudioVolumeInfo[] speakers,
       int totalVolume )

This callback indicates who is speaking and the speaker’s volume.

The indication is disabled by default. If needed, use the enableAudioVolumeIndication() method to configure it.

Name Description
speakers

The speaker (array). Each speaker () includes:

  • uid: User ID of the speaker
  • Volume: The volume of the speaker between 0 (lowest) to 255 (highest).
totalVolume Total volume after audio mixing between 0 (lowest) to 255 (highest).

Other User Joined Channel Callback (onUserJoined)

public void onUserJoined( int uid, int elapsed );

This callback method notifies the application that another user has joined the channel. If there are other users in the channel when that user joins, the SDK also reports to the application who the existing users are in the channel.

Name Description
uid The user ID.
elapsed The time delay (milliseconds) from calling joinChannel until this callback is triggered.

Other User Offline Callback (onUserOffline)

public void onUserOffline(int uid, int reason);

This callback notifies the application that a user has left the channel or is offline.

The SDK reads the timeout data to determine if a user has left the channel (or is offline). If no data package is received from a user in 15 seconds, the SDK assumes the user is offline. Sometimes a weak network connection may lead to false detection, therefore we recommend using signaling for reliable offline detection.

Name Description
uid User ID.
reason Reasons for user being offline:
  • USER_OFFLINE_QUIT(0): User has quit the call.
  • USER_OFFLINE_DROPPED(1): The SDK timed out and the user dropped offline because it did not receive any data package for a long time.

Sometimes when the other user quits the call but the message is not passed to the SDK due to an unreliable channel, the SDK may assume that the other user is timed out and dropped offline.

Other User Muted Audio Callback (onUserMuteAudio)

public void onUserMuteAudio( int uid, boolean muted );

This callback indicates that some other user has muted/unmuted his/her audio stream.

Note

Currently, this callback is invalid when the number of users in a channel exceeds 20.

Name Description
uid User ID.
muted
  • True: User has muted his/her audio.
  • False: User has unmuted his/her audio.

Rtc Engine Statistics Callback (onRtcStats)

public void onRtcStats( RtcStats stats )

The SDK updates the application on the statistics of the Rtc Engine runtime status once every two seconds.

Name Description
stats Refer to RtcStats.

Network Quality Callback (onLastmileQuality)

public void onLastmileQuality(int quality);

This callback reports the network quality of the local user. It is triggered once every two seconds after calling enableLastmileTest().

Name Description
quality
  • QUALITY_UNKNOWN( = 0)
  • QUALITY_EXCELLENT(1)
  • QUALITY_GOOD(2)
  • QUALITY_POOR(3)
  • QUALITY_BAD(4)
  • QUALITY_VBAD(5)
  • QUALITY_DOWN(6)

In-call Network Quality Callback (onNetworkQuality)

public void onNetworkQuality(uid_t uid, int txQuality, int rxQuality)

This callback is triggered regularly to update the application on the current network quality in a communication or live broadcast channel.

Name Description
uid

User ID. The network quality of the user with this UID will be reported.

If uid is 0, it reports the local network quality. The current release only reports the quality for the local user.

txQuality

The uplink network quality of the user:

  • QUALITY_UNKNOWN( = 0)
  • QUALITY_EXCELLENT(1)
  • QUALITY_GOOD(2)
  • QUALITY_POOR(3)
  • QUALITY_BAD(4)
  • QUALITY_VBAD(5)
  • QUALITY_DOWN(6)
rxQuality

The downlink network quality of the user:

  • QUALITY_UNKNOWN( = 0)
  • QUALITY_EXCELLENT(1)
  • QUALITY_GOOD(2)
  • QUALITY_POOR(3)
  • QUALITY_BAD(4)
  • QUALITY_VBAD(5)
  • QUALITY_DOWN(6)

Connection Interrupted Callback (onConnectionInterrupted)

public void onConnectionInterrupted()

This method indicates that the SDK has lost connection with the server.

This method is triggered upon connection lost, while the onConnectionLost method is triggered when the SDK attempts to reconnect after losing connection. Once the connection is lost, and if the application does not call leaveChannel, the SDK automatically tries to reconnect repeatedly.

Connection Lost Callback (onConnectionLost)

public void onConnectionLost()

This callback indicates that the SDK has lost connection with the network, and it has remained unconnected for a period of time (10 seconds by default) despite that it attempts to reconnect. The SDK will keep trying to reconnect after this callback is triggered. Upon reconnection, an onRejoinChannelSuccess callback will then be triggered.

Connection Banned Callback (onConnectionBanned)

public void onConnectionBanned()

This callback is triggered when your connection is banned by the Agora Server.

Data Stream Received Callback (onStreamMessage)

public void onStreamMessage(int uid, int streamId, byte[] data);

This callback indicates that the local user has received the data stream from the other user within five seconds.

Name Description
uid User ID
streamId Stream ID
data The data received by the recipients.

Data Stream Sent Failure Callback (onStreamMessageError)

public void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached);

This callback indicates that the local user has not received the data stream from the other user within five seconds.

Name Description
uid User ID
streamId Stream ID
code
  • ERR_OK = 0, No error
  • ERR_NOT_IN_CHANNEL=113, the user is not in a channel
  • ERR_SIZE_TOO_LARGE=114, data size is too big
  • ERR_BITRATE_LIMIT=115, limited bitrate
  • ERR_TOO_MANY_DATA_STREAMS =116, too many data streams
  • ERR_STREAM_MESSAGE_TIMEOUT=117, data stream timed out

For more error code description, see Error Code

missed The number of lost messages.
cached The number of incoming cached messages when the data stream is interrupted.

Channel Key Expired Callback (onRequestChannelKey)

public void onRequestChannelKey();

If a Channel Key was specified when calling joinChannel, a new Channel Key may be required to reconnect to the server if the Channel Key expires or if the SDK loses connection with the Agora server.

This callback notifies the application to generate a new Channel Key, and call renewChannelKey to specify the newly generated Channel Key.

This function was previously provided in the callback report for onError(): ERR_CHANNEL_KEY_EXPIRED(109)、ERR_INVALID_CHANNEL_KEY(110). Starting from v1.7.3, the old method still works, but it is recommended to use this callback.

Audio Mixing File Playback Finished Callback (onAudioMixingFinished)

public void onAudioMixingFinished()

This callback is triggered when the audio mixing file playback is finished after calling startAudioMixing. If you failed to execute the startAudioMixing method, it returns the error code in the onError callback.

Agora Native SDK Error Codes

Introduction

The Agora Native SDK will return error or warning codes when calling APIs or during runtime:

  • Error Codes occur when the SDK encountered an error that can be not recovered automatically without any application intervention. For example, the SDK returns an error if it fails to open a camera, and reminds the user not to use the camera.
  • Warning Codes occur when the SDK encountered an error that might be recovered automatically. A Warning Code is just for notification, which can usually be ignored.

Agora Native SDK

Error Codes

Error Code Value Description
ERR_OK 0 No error.
ERR_FAILED 1 General error (the reason is not classified specifically).
ERR_INVALID_ARGUMENT 2 Invalid parameter called. For example, the specific channel name includes illegal characters.
ERR_NOT_READY 3 The SDK module is not ready. For example, if some API relies on a specific module, and the module is not ready.
ERR_NOT_SUPPORTED 4 The SDK does not support this function.
ERR_REFUSED 5 The request is rejected. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_BUFFER_TOO_SMALL 6 The buffer size is not big enough to store the returned data.
ERR_NOT_INITIALIZED 7 The SDK is not initialized before calling this API.
ERR_NO_PERMISSION 9 No permission. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_TIMEDOUT 10 An API timeout. Some APIs require the SDK to return the execution result, and this error occurs if the request takes too long for the SDK to process.
ERR_CANCELED 11 The request is cancelled. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_TOO_OFTEN 12 The call frequency is too high. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_BIND_SOCKET 13 The SDK failed to bind to the network socket. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_NET_DOWN 14 The network is unavailable. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_NET_NOBUFS 15 No network buffers available. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_JOIN_CHANNEL_REJECTED 17 The request to join the channel is rejected. This error usually occurs when the user is already in the channel, and still calls the API to join the channel, for example, joinChannel.
ERR_LEAVE_CHANNEL_REJECTED 18 The request to leave the channel is rejected. This error usually occurs when the user has already left the channel, and still calls the API to leave the channel, for example, leaveChannel.
ERR_ALREADY_IN_USE 19 Resources have been occupied, and cannot be reused.
ERR_ABORTED 20 The SDK gave up the request due to too many requests. This is for internal SDK internal use only, and it will not return to the application through any API or callback event.
ERR_INIT_NET_ENGINE 21 In Windows, specific firewall settings can cause the SDK to fail to initialize and crash.
ERR_INVALID_VENDOR_KEY 101 The specified App ID is invalid.
ERR_INVALID_CHANNEL_NAME 102 The specified Channel Name is invalid.
ERR_CHANNEL_KEY_EXPIRED 109 The current Channel Key expired, and is no longer valid. See error_109 for details.
ERR_INVALID_CHANNEL_KEY 110 The specified Channel Key is invalid. Usually the Channel Key was generated incorrectly. See error_110 for details.
ERR_CONNECTION_INTERRUPTED 111

The CONNECTION_INTERRUPTED callback.

This is only applicable to the Agora Native SDK for the web.

ERR_CONNECTION_LOST = 112 112

The CONNECTION_LOST callback.

This is only applicable to the Agora Native SDK for the web.

ERR_NOT_IN_CHANNEL 113 The user is not in the channel.
ERR_SIZE_TOO_LARGE 114 The data size is too big.
ERR_BITRATE_LIMIT 115 The bitrate is limited.
ERR_TOO_MANY_DATA_STREAMS 116 Too many data streams.
ERR_STREAM_MESSAGE_TIMEOUT 117 A data stream timeout.
ERR_LOAD_MEDIA_ENGINE 1001 Failed to load the media engine.
ERR_START_CALL 1002 Failed to start the call after enabling the media engine.
ERR_START_CAMERA 1003 Failed to start the camera.
ERR_START_VIDEO_RENDER 1004 Failed to start the video rendering module.
ERR_ADM_GENERAL_ERROR 1005 General error on the Audio Device Module (the reason is not classified specifically).
ERR_ADM_JAVA_RESOURCE 1006 Audio Device Module: Error in using the java resources
ERR_ADM_SAMPLE_RATE 1007 Audio Device Module: Error in setting the sampling frequency.
ERR_ADM_INIT_PLAYOUT 1008 Audio Device Module: Error in initializing the playback device.
ERR_ADM_START_PLAYOUT 1009 Audio Device Module: Error in starting the playback device.
ERR_ADM_STOP_PLAYOUT 1010 Audio Device Module: Error in stopping the playback device.
ERR_ADM_INIT_RECORDING 1011 Audio Device Module: Error in initializing the recording device.
ERR_ADM_START_RECORDING 1012 Audio Device Module: Error in starting the recording device.
ERR_ADM_STOP_RECORDING 1013 Audio Device Module: Error in stopping the recording device.
ERR_ADM_RUNTIME_PLAYOUT_ERROR 1015 Audio Device Module: Runtime playback error.
ERR_ADM_RUNTIME_RECORDING_ERROR 1017 Audio Device Module: Runtime recording error.
ERR_ADM_RECORD_AUDIO_FAILED 1018 Audio Device Module: Failed to record.
ERR_ADM_INIT_LOOPBACK 1022 Audio Device Module: Error in initializing the loopback device.
ERR_ADM_START_LOOPBACK 1023 Audio Device Module: Error in starting the loopback device.
ERR_VDM_CAMERA_NOT_AUTHORIZED 1501 Video Device Module: The camera is not authorized.

Warning Codes

Warning Code Value Description
WARN_INVALID_VIEW 8 The specified view is invalid. It is required to specify a view when using the video call function.
WARN_INIT_VIDEO 16 Failed to initialize the video function.
WARN_PENDING 20 The request is pending, usually due to some module not being ready, and the SDK postponed processing the request.
WARN_NO_AVAILABLE_CHANNEL 103 No channel resources are available. Maybe because the server cannot allocate any channel resource.
WARN_LOOKUP_CHANNEL_TIMEOUT 104 A timeout when looking up the channel. When joining a channel, the SDK looks up the specified channel. The warning usually occurs when the network condition is too poor to connect to the server.
WARN_LOOKUP_CHANNEL_REJECTED 105 The server rejected the request to look up the channel. The server cannot process this request or the request is illegal.
WARN_OPEN_CHANNEL_TIMEOUT 106 A timeout when opening the channel. Once the specific channel is found, the SDK opens the channel. The warning usually occurs when the network condition is too poor to connect to the server.
WARN_OPEN_CHANNEL_REJECTED 107 The server rejected the request to open the channel. The server cannot process this request or the request is illegal.
WARN_ADM_RUNTIME_PLAYOUT_WARNING 1014 Audio Device Module: A warning in the runtime playback device.
WARN_ADM_RUNTIME_RECORDING_WARNING 1016 Audio Device Module: A warning in the runtime recording device.
WARN_ADM_RECORD_AUDIO_SILENCE 1019 Audio Device Module: No valid audio data is collected.
WARN_ADM_PLAYOUT_MALFUNCTION 1020 Audio Device Module: A playback device failure.
WARN_ADM_RECORD_MALFUNCTION 1021 Audio Device Module: A recording device failure.
WARN_ADM_HOWLING 1051 Audio Device Module: Howling is detected.