Inherited by io.agora.rtc2.RtcEngine2.
Public Member Functions | |
void | addHandler (IRtcEngineEventHandler handler) |
abstract int | joinChannel (String token, String channelName, String optionalInfo, int optionalUid) |
abstract int | joinChannel (String token, String channelId, int uid, ChannelMediaOptions options) |
abstract int | updateChannelMediaOptions (ChannelMediaOptions options) |
abstract int | leaveChannel () |
abstract boolean | enableHighPerfWifiMode (boolean enable) |
abstract int | startLastmileProbeTest (LastmileProbeConfig config) |
abstract int | stopLastmileProbeTest () |
abstract int | enableVideo () |
abstract int | disableVideo () |
abstract int | enableLocalVideo (boolean enabled) |
abstract int | startPreview () |
abstract int | stopPreview () |
abstract int | enableAudio () |
abstract int | disableAudio () |
abstract int | enableLocalAudio (boolean enabled) |
abstract int | registerMediaMetadataObserver (IMetadataObserver observer, int type) |
abstract String | getCallId () |
abstract RtcConnection.CONNECTION_STATE_TYPE | getConnectionState () |
abstract int | rate (String callId, int rating, String description) |
abstract int | complain (String callId, String description) |
abstract int | setLogFile (String filePath) |
abstract int | setLogFilter (int filter) |
abstract int | setupLocalVideo (VideoCanvas local) |
abstract int | setupRemoteVideo (VideoCanvas remote) |
abstract int | setLocalRenderMode (int mode) |
abstract int | setRemoteRenderMode (int userId, int mode) |
abstract int | switchCamera () |
abstract int | setVideoEncoderConfiguration (VideoEncoderConfiguration config) |
abstract int | setAudioProfile (int profile, int scenario) |
abstract int | setAudioProfile (int profile) |
abstract int | muteLocalVideoStream (boolean muted) |
abstract int | muteAllRemoteVideoStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteVideoStreams (boolean muted) |
abstract int | setEnableSpeakerphone (boolean enabled) |
abstract int | setDefaultAudioRoutetoSpeakerphone (boolean defaultToSpeaker) |
abstract boolean | isSpeakerphoneEnabled () |
abstract int | enableAudioVolumeIndication (int interval, int smooth) |
abstract int | muteLocalAudioStream (boolean muted) |
abstract int | muteAllRemoteAudioStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteAudioStreams (boolean muted) |
abstract int | muteRemoteAudioStream (int userId, boolean muted) |
abstract int | muteRemoteVideoStream (int userId, boolean muted) |
abstract int | renewToken (String token) |
abstract int | setChannelProfile (int profile) |
abstract int | setClientRole (int role) |
abstract int | setRemoteVideoStreamType (int userId, int streamType) |
abstract int | setRemoteDefaultVideoStreamType (int streamType) |
abstract int | startAudioMixing (String filePath, boolean loopback, boolean replace, int cycle) |
abstract int | stopAudioMixing () |
abstract int | createDataStream (boolean reliable, boolean ordered) |
abstract int | sendStreamMessage (int streamId, byte[] message) |
abstract int | enableDualStreamMode (boolean enabled) |
abstract int | setRecordingAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setPlaybackAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setMixedAudioFrameParameters (int sampleRate, int channel, int samplesPerCall) |
abstract int | setMixedAudioFrameParameters (int sampleRate, int channel, int samplesPerCall) |
abstract int | setPlaybackAudioFrameBeforeMixingParameters (int sampleRate, int channel) |
abstract int | adjustRecordingSignalVolume (int volume) |
abstract int | pauseAudioMixing () |
abstract int | resumeAudioMixing () |
abstract int | adjustAudioMixingVolume (int volume) |
abstract int | adjustAudioMixingPublishVolume (int volume) |
abstract int | getAudioMixingPublishVolume () |
abstract int | adjustAudioMixingPlayoutVolume (int volume) |
abstract int | getAudioMixingPlayoutVolume () |
abstract int | getAudioMixingDuration () |
abstract int | getAudioMixingCurrentPosition () |
abstract int | setAudioMixingPosition (int pos) |
abstract double | getEffectsVolume () |
abstract int | setEffectsVolume (double volume) |
abstract int | preloadEffect (int soundId, String filePath) |
abstract int | playEffect (int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) |
abstract int | playAllEffects (int loopCount, double pitch, double pan, double gain, boolean publish) |
abstract int | getVolumeOfEffect (int soundId) |
abstract int | setVolumeOfEffect (int soundId, double volume) |
abstract int | pauseEffect (int soundId) |
abstract int | pauseAllEffects () |
abstract int | resumeEffect (int soundId) |
abstract int | resumeAllEffects () |
abstract int | stopEffect (int soundId) |
abstract int | stopAllEffects () |
abstract int | unloadEffect (int soundId) |
abstract int | unloadAllEffects () |
abstract int | enableInEarMonitoring (boolean enabled) |
abstract int | enableInEarMonitoring (boolean enabled, boolean includeAudioFilter) |
abstract int | enableWebSdkInteroperability (boolean enabled) |
abstract int | registerAudioFrameObserver (IAudioFrameObserver observer) |
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels) |
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels, int sourceNumber) |
abstract int | pushExternalAudioFrame (byte[] data, long timestamp) |
abstract int | pushExternalAudioFrame (ByteBuffer data, long timestamp, int sourceId) |
abstract int | setLocalVoiceChanger (int voiceChanger) |
abstract int | setLocalVoiceReverbPreset (int reverbPreset) |
abstract int | setInEarMonitoringVolume (int volume) |
abstract int | setExternalVideoSource (boolean enable, boolean useTexture, boolean encodedFrame) |
abstract boolean | pushExternalVideoFrame (AgoraVideoFrame frame) |
abstract boolean | pushExternalVideoFrame (VideoFrame frame) |
abstract int | pushExternalEncodedVideoFrame (ByteBuffer data, EncodedVideoFrameInfo frameInfo) |
abstract int | startChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration) |
abstract int | stopChannelMediaRelay () |
abstract int | registerVideoFrameObserver (IVideoFrameObserver observer) |
abstract int | sendCustomReportMessage (String id, String category, String event, String label, int value) |
abstract int | setLogLevel (int level) |
Static Public Member Functions | |
static synchronized RtcEngine | create (Context context, String appId, IRtcEngineEventHandler handler) throws Exception |
static synchronized RtcEngine | create (RtcEngineConfig config) throws Exception |
static synchronized void | destroy () |
static String | getSdkVersion () |
Static Protected Attributes | |
static RtcEngineImpl | mInstance = null |
Main interface class of the Agora Native SDK.
Call the methods of this class to use all the functionalities of the SDK. Agora recommends calling the RtcEngine API methods in the same thread instead of in multiple threads. In previous versions, this class was named AgoraAudio, and was renamed to RtcEngine from version 1.0.
|
static |
Creates an RtcEngine instance.
Unless otherwise specified, all the methods provided by the RtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread.
context | The context of Android Activity. |
appId | The App ID issued to you by Agora. See How to get the App ID. Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only one RtcEngine instance. To change your App ID, call destroy to destroy the current RtcEngine instance and then call create to create an RtcEngine instance with the new App ID. |
handler | IRtcEngineEventHandler is an abstract class providing default implementation. The SDK uses this class to report to the app on SDK runtime events. |
Exception | Fails to create an RtcEngine instance. |
|
static |
Creates an RtcEngine instance.
Unless otherwise specified, all the methods provided by the RtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread.
config | Configurations for the RtcEngine instance. For details, see RtcEngineConfig. |
Exception | Fails to create an RtcEngine instance. |
|
static |
Releases all the resources used by the Agora SDK.
This method is useful for apps that occasionally make voice or video calls, to free up resources for other operations when not making calls.
|
static |
Gets the SDK version.
void io.agora.rtc2.RtcEngine.addHandler | ( | IRtcEngineEventHandler | handler | ) |
Adds the IRtcEngineEventHandler.
handler | The IRtcEngineEventHandler instance. |
|
abstract |
Joins a channel.
Users in the same channel can talk to each other; and multiple users in the same channel can start a group chat. Note that 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.
uid
s, that is, two users with the same uid. If you set uid
as 0, the system automatically assigns a user ID.token | The token for authentication.
|
channelName | The unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
|
optionalInfo | (Optional) Additional information about the channel that you want to add. It can be set as a NULL string or channel related information. Other users in the channel will not receive this message. |
optionalUid | (Optional) User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. If not assigned (or set to 0), the SDK assigns one and reports it in the onJoinChannelSuccess callback. Your app must record and maintain the returned value as the SDK does not maintain it. |
|
abstract |
Joins a channel with media options.
Users in the same channel can talk to each other; and multiple users in the same channel can start a group chat. Note that 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.
uid
s, that is, two users with the same uid. If you set uid
as 0, the system automatically assigns a user ID.token | The token for authentication.
|
channelId | The unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
|
uid | (Optional) User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. If not assigned (or set to 0), the SDK assigns one and reports it in the onJoinChannelSuccess callback. Your app must record and maintain the returned value as the SDK does not maintain it. |
options | The channel media options: ChannelMediaOptions. |
|
abstract |
Updates the channel media options after joining the channel.
options | The channel media options: ChannelMediaOptions. |
|
abstract |
Leaves the channel.
This method allows a user to leave the channel, for example, by hanging up or exiting a call.
After joining a channel, the user must call this method to end the current call before joining another one. This method also releases all resources related to the call.
This method is an asynchronous call, which means that the result of this method returns even before the user has not actually left the channel. Once the user successfully leaves the channel, the SDK triggers the onLeaveChannel callback.
onLeaveChannel
callback.
|
abstract |
Starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
Once this method is enabled, the SDK triggers the onLastmileProbeResult callback within 30 seconds, and reports the real-time statistics of the network conditions.
Call this method to check the uplink network quality before users join a channel or before an audience switches to a host.
config | The configurations of the last-mile network probe test. For details, see LastmileProbeConfig. |
|
abstract |
Stops the last-mile network probe test.
|
abstract |
Enables the video.
You can call this method either before joining a channel or during a call. If you call this method before entering a channel, the service starts the video; if you call it during a call, the audio call switches to a video call.
|
abstract |
Disables the video.
This method stops capturing the local video and receiving any remote video. To enable the local preview function, call enableLocalVideo (true).
|
abstract |
Disables or re-enables the local video capture.
Once you enable the video using enableVideo, the local video is enabled by default. This method disables or re-enables the local video capture.
enableLocalVideo(false)
applies to scenarios when the user wants to watch the remote video without sending any video stream to the other user.
enableVideo
. Otherwise, this method may not work properly.enabled | Determines whether to disable or re-enable the local video, including the capturer, renderer, and sender:
|
|
abstract |
Starts the local video preview before joining a channel.
Once you call this method to start the local video preview, if you leave the channel by calling leaveChannel, the local video preview remains until you call stopPreview to disable it.
|
abstract |
Stops the local video preview and the video.
|
abstract |
Enables the audio.
The audio is enabled by default.
|
abstract |
Disables the audio.
|
abstract |
Enables or disables the local audio capture.
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 capture and processing.
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.
enabled | Determines whether to disable or re-enable the local audio function:
|
|
abstract |
Registers the metadata observer.
You need to implement the IMetadataObserver class and 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.
A successful call of this method triggers the getMaxMetadataSize callback.
joinChannel
method.observer | The IMetadataObserver class. |
type | The metadata type. Currently, the SDK supports VIDEO_METADATA(0) only.
|
|
abstract |
Gets the current call ID.
When a user joins a channel on a client, a callId
is generated to identify the call.
After a call ends, you can call rate
or complain
to gather feedback from the customer. These methods require a callId
parameter. To use these feedback methods, call the this method first to retrieve the callId
during the call, and then pass the value as an argument in the rate
or complain
method after the call ends.
|
abstract |
Gets the connection state of the SDK.
CONNECTION_STATE_DISCONNECTED(1)
: The SDK is disconnected from Agora edge server.CONNECTION_STATE_CONNECTING(2)
: The SDK is connecting to Agora edge server.CONNECTION_STATE_CONNECTED(3)
: The SDK joined a channel and is connected to Agora edge server. You can now publish or subscribe to a media stream in the channel.CONNECTION_STATE_RECONNECTING(4)
: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues.
|
abstract |
Allows a user to rate the call.
It is usually called after the call ends.
callId | The call ID retrieved from the getCallId method. |
rating | The rating of the call between 1 (the lowest score) to 5 (the highest score). |
description | (Optional) The description of the rating. The string length must be less than 800 bytes. |
|
abstract |
Allows a user to complain about the call quality.
This method is usually called after the call ends.
callId | The call ID retrieved from the getCallId method. |
description | (Optional) The description of the complaint. The string length must be less than 800 bytes. |
|
abstract |
Specifies an SDK output log file.
The log file records all log data for the SDK’s operation. Ensure that the directory for the log file exists and is writable.
filePath | File path of the log file. The string of the log file is in UTF-8. |
|
abstract |
Sets the output log filter level of the SDK.
You can use one or a combination of the filters. The log level follows the sequence of OFF
, CRITICAL
, ERROR
, WARNING
, INFO
, and DEBUG
. Choose a level and you will see logs preceding that level. For example, if you set the log level to WARNING
, you see the logs within levels CRITICAL
, ERROR
, and WARNING
.
filter | Sets the log filter level:
|
|
abstract |
Initializes the local video view.
This method initializes the video view of the local stream on the local device. It affects only the video view that the local user sees, not the published local video stream.
To unbind the local video from the view, set view
in VideoCanvas as null
.
local | The local video view setting: VideoCanvas. |
|
abstract |
Initializes the video view of a remote user.
This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees.
Usually the app should specify the uid
of the remote video in the method call before the remote user joins the channel. If the remote uid
is unknown to the app, set it later when the app receives the onUserJoined callback.
To unbind the remote user from the view, set view
in VideoCanvas as null
.
remote | The remote video view settings: VideoCanvas. |
|
abstract |
Updates the display mode of the local video view.
After initializing the local video view, you can call this method to update its rendering mode. It affects only the video view that the local user sees, not the published local video stream.
mode | Sets the local display mode:
|
|
abstract |
Updates the display mode of the video view of a remote user.
After initializing the video view of a remote user, you can call this method to update its rendering and mirror modes. This method affects only the video view that the local user sees.
userId | ID of the remote user. |
mode | Sets the remote display mode:
|
|
abstract |
Switches between front and rear cameras.
|
abstract |
Sets the video encoder configuration.
Each configuration profile corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.
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.
config | The local video encoder configuration. See VideoEncoderConfiguration. |
|
abstract |
Sets the audio parameters and application scenarios.
mAudioScenario
member.joinChannel
.profile
as MUSIC_HIGH_QUALITY
(4) and scenario
as AUDIO_SCENARIO_GAME_STREAMING
(3).profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See AudioProfile. |
scenario | Sets the audio application scenarios. See AudioScenario. |
|
abstract |
Sets the audio profile.
joinChannel
method.profile
as MUSIC_HIGH_QUALITY
(4).mAudioScenario
member.profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See AudioProfile. |
|
abstract |
Stops or resumes sending the local video stream.
muted | Determines whether to send or stop sending the local video stream:
|
|
abstract |
Stops or resumes receiving all remote video streams.
This method works for all remote users that join or will join a channel using the joinChannel
method. It is equivalent to the autoSubscribeVideo
member in the ChannelMediaOptions class. You can call this method before, during, or after a call.
muteAllRemoteVideoStreams(true)
before joining a channel, the local user does not receive any video stream after joining the channel.muteAllRemoteVideoStreams(true)
after joining a channel, the local use stops receiving any video stream from any user in the channel, including any user who joins the channel after you call this method.muteAllRemoteVideoStreams(true)
after leaving a channel, the local user does not receive any video stream the next time the user joins a channel.After you successfully call muteAllRemoteVideoStreams(true)
, you can take the following actions:
muteAllRemoteVideoStreams(false)
.muteRemoteVideoStream(uid, false)
, where uid
is the ID of the user whose video stream you want to resume receiving.enableVideo
and disableVideo
. Settings in muteAllRemoteVideoStreams
stop taking effect if either of the following occurs:enableVideo
after muteAllRemoteVideoStreams(true)
.disableVideo
after muteAllRemoteVideoStreams(false)
.joinChannel
. To set whether to receive remote audio streams for a specific channel, Agora recommends using autoSubscribeVideo
in the ChannelMediaOptions class.muted | Whether to stop receiving remote video streams:
|
|
abstract |
Determines whether to receive all remote video streams by default.
joinChannel
.Use setDefaultMuteAllRemoteVideoStreams
to set whether to receive video streams of subsequent peer users. Agora recommends calling it before joining a channel.
A successful call of setDefaultMuteAllRemoteVideoStreams(true)
results in that the local user not receiving any video stream after joining a channel.
muted | Whether to receive remote video streams by default:
|
|
abstract |
Enables or disables the speakerphone temporarily.
When the audio route changes, the SDK triggers the onAudioRouteChanged callback.
You can call this method before, during, or after a call. However, Agora recommends calling this method only when you are in a channel to change the audio route temporarily.
enabled | Whether to set the speakerphone as the temporary audio route:
|
|
abstract |
Sets the default audio route.
Most mobile phones have two audio routes: an earpiece at the top, and a speakerphone at the bottom. The earpiece plays at a lower volume, and the speakerphone at a higher volume.
When setting the default audio route, you determine whether audio playback comes through the earpiece or speakerphone when no external audio device is connected.
Depending on the scenario, Agora uses different default audio routes:
Call this method before, during, or after a call, to change the default audio route. When the audio route changes, the SDK triggers the onAudioRouteChanged callback.
defaultToSpeaker | Whether to set the speakerphone as the default audio route:
|
|
abstract |
Checks whether the speakerphone is enabled.
|
abstract |
Enables the onAudioVolumeIndication
callback to report on which users are speaking and the speakers' volume.
Once the onAudioVolumeIndication callback is enabled, the SDK returns the volume indication in the at the time interval set in enableAudioVolumeIndication
, regardless of whether any user is speaking in the channel.
interval | Sets the time interval between two consecutive volume indications:
|
smooth | The smoothing factor that sets the sensitivity of the audio volume indicator. The value ranges is [0, 10]. The greater the value, the more sensitive the indicator. The recommended value is 3. |
|
abstract |
Stops or resumes sending the local audio stream.
muted | Determines whether to send or stop sending the local audio stream:
|
|
abstract |
Stops or resumes receiving all remote audio streams.
This method works for all remote users that join or will join a channel using the joinChannel
method. It is equivalent to the autoSubscribeAudio
member in the ChannelMediaOptions class. You can call this method before, during, or after a call.
muteAllRemoteAudioStreams(true)
before joining a channel, the local user does not receive any audio stream after joining the channel.muteAllRemoteAudioStreams(true)
after joining a channel, the local use stops receiving any audio stream from any user in the channel, including any user who joins the channel after you call this method.muteAllRemoteAudioStreams(true)
after leaving a channel, the local user does not receive any audio stream the next time the user joins a channel.After you successfully call muteAllRemoteAudioStreams(true)
, you can take the following actions:
muteAllRemoteAudioStreams(false)
.muteRemoteAudioStream(uid, false)
, where uid
is the ID of the user whose audio stream you want to resume receiving.enableAudio
and disableAudio
. Settings in muteAllRemoteAudioStreams
stop taking effect if either of the following occurs:enableAudio
after muteAllRemoteAudioStreams(true)
.disableAudio
after muteAllRemoteAudioStreams(false)
.joinChannel
. To set whether to receive remote audio streams for a specific channel, Agora recommends using autoSubscribeAudio
in the ChannelMediaOptions
class.muted | Whether to stop receiving remote audio streams:
|
|
abstract |
Determines whether to receive all remote audio streams by default.
joinChannel
.Use setDefaultMuteAllRemoteAudioStreams
to set whether to receive audio streams of subsequent peer users. Agora recommends calling it before joining a channel.
A successful call of setDefaultMuteAllRemoteAudioStreams(true)
results in that the local user not receiving any audio stream after joining a channel.
muted | Whether to receive remote audio streams by default:
|
|
abstract |
Stops or resumes receiving the audio stream of a specified user.
You can call this method before or after joining a channel. If a user leaves a channel, the settings in this method become invalid.
userId | The ID of the specified user. |
muted | Whether to stop receiving the audio stream of the specified user:
|
|
abstract |
Stops or resumes receiving the video stream of a specified user.
You can call this method before or after joining a channel. If a user leaves a channel, the settings in this method become invalid.
userId | The ID of the specified user. |
muted | Whether to stop receiving the video stream of the specified user:
|
|
abstract |
Renews the token.
Once a token is enabled and used, it expires after a certain period of time.
Under the following circumstances, generate a new token on your server, and then call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
ERR_TOKEN_EXPIRED(-109)
error is reported.token | The new token. |
|
abstract |
Sets the channel profile.
The RtcEngine differentiates channel profiles and applies different optimization algorithms accordingly. For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality for a video broadcast.
joinChannel
. You cannot set the channel profile once you have joined the channel.profile | The channel profile:
|
|
abstract |
Sets the role of a user.
This method sets the user role as either BROADCASTER or AUDIENCE (default).
By default, all users are audience regardless of the channel profile. Call this method to change the user role to BROADCASTER so that the user can send a stream.
role | The role of the client:
|
|
abstract |
Sets the remote video stream type.
If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video by Call this method to switch to the low-stream video.
userId | ID of the remote user sending the video stream. |
streamType | Sets the video stream type:
|
|
abstract |
Sets the default stream type of the remote video if the remote user has enabled dual-stream.
streamType | Sets the default video stream type:
|
|
abstract |
Starts playing and mixing the music file.
This method mixes the specified local or online audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local or remote audio file.
You can choose whether the other user can hear the local audio playback and specify the number of playback loops.
A successful startAudioMixing
method call triggers the onAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING) callback on the local client. When the audio mixing file playback finishes, the SDK triggers the onAudioMixingStateChanged(AUDIO_MIXING_STATE_STOPPED) callback on the local client.
filePath | Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. For example, /sdcard/emulated/0/audio.mp4 . Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv, and wav.
|
loopback | Sets which user can hear the audio mixing:
|
replace | Sets the audio mixing content:
|
cycle | Sets the number of playback loops:
|
AUDIO_FILE_OPEN_TOO_FREQUENT(702)
warning occurs.
|
abstract |
Stops playing or mixing the music file.
Call this method when you are in a channel.
|
abstract |
Creates a data stream.
You can call this method to create a data stream and improve the reliability and ordering of data transmission.
reliable
and ordered
.reliable | Sets whether the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether the recipients receive the data stream in the sent order:
|
|
abstract |
Sends a data stream.
After calling createDataStream, you can call this method to send a data stream to all users in the channel.
The SDK has the following restrictions on this method:
After the remote user receives the data stream within 5 seconds, the SDK triggers the onStreamMessage callback on the remote client. After the remote user does not receive the data stream within 5 seconds, the SDK triggers the onStreamMessageError callback.
COMMUNICATION
profile or to the hosts in the LIVE_BROADCASTING
profile. If an audience in the LIVE_BROADCASTING
profile calls this method, the audience may be switched to a host.streamId | ID of the sent data stream returned by the createDataStream method. |
message | Sent data. |
|
abstract |
Enables or disables the dual video stream mode.
If dual-stream mode is enabled, the subscriber can choose to receive the high-stream (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) video using setRemoteVideoStreamType.
enabled |
|
|
abstract |
Sets the audio frame format for the onRecordAudioFrame callback.
sampleRate | The sample rate (Hz) of the audio frame. You can set it as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channel | The number of audio channels of the audio frame. You can set it as 1 (mono channel) or 2 (dual channel). |
mode | Use mode of the audio frame:
|
samplesPerCall | The number of samples of the audio frame. For CDN live streaming, Agora recommends setting it as 1024 . |
onRecordAudioFrame
callback according to the sample interval (in seconds). The sample interval = samplesPerCall/(sampleRate x channel)
. Ensure that the sample interval is no less than 0.01 second.
|
abstract |
Sets the audio frame format for the onPlaybackAudioFrame callback.
sampleRate | The sample rate (Hz) of the audio frame. You can set it as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channel | The number of audio channels of the audio frame. You can set it as 1 (mono channel) or 2 (dual channel). |
mode | Use mode of the audio frame:
|
samplesPerCall | The number of samples of the audio frame. For CDN live streaming, Agora recommends setting it as 1024 . |
onPlaybackAudioFrame
callback according to the sample interval (in seconds). The sample interval = samplesPerCall/(sampleRate x channel)
. Ensure that the sample interval is no less than 0.01 second.
|
abstract |
Sets the mixed audio format for the onMixedAudioFrame callback.
sampleRate | The sample rate (Hz) of the audio frame. You can set it as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channel | The number of audio channels of the audio frame. You can set it as 1 (mono channel) or 2 (dual channel). |
samplesPerCall | The number of samples of the audio frame. For CDN live streaming, Agora recommends setting it as 1024 . |
onMixedAudioFrame
callback according to the sample interval (in seconds). The sample interval = samplesPerCall/(sampleRate x channel)
. Ensure that the sample interval is no less than 0.01 second.
|
abstract |
Sets the audio playback format before mixing for the onPlaybackAudioFrameBeforeMixing callback.
sampleRate
and samplesPerCall
parameters you set in this method. Sample interval (s) = samplePerCall/(sampleRate × channel). Ensure that the value of sample interval ≥ 0.01. The SDK triggers the onMixedAudioFrame
callback according to the sample interval.
|
abstract |
Sets the audio playback format before mixing for the onPlaybackAudioFrameBeforeMixing callback.
sampleRate | The sample rate (Hz) of the audio frame. You can set it as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channel | The number of audio channels of the audio frame. You can set it as 1 (mono channel) or 2 (dual channel). |
|
abstract |
Adjusts the recording volume.
volume | Recording volume. The value ranges from 0 to 400:
|
|
abstract |
Pauses playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Resumes playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Adjusts the volume of audio mixing.
Call this method when you are in a channel.
volume | Audio mixing volume. The value ranges between 0 and 100 (default). |
|
abstract |
Adjusts the audio mixing volume for publishing (for remote users).
volume | Audio mixing volume for publishing. The value ranges between 0 and 100 (default). |
|
abstract |
Retrieves the audio mixing volume for publishing. This method helps troubleshoot audio volume related issues.
|
abstract |
Adjusts the audio mixing volume for local playback.
volume | Audio mixing volume for local playback. The value ranges between 0 and 100 (default). |
|
abstract |
Retrieves the audio mixing volume for local playback. This method helps troubleshoot audio volume related issues.
|
abstract |
Gets the duration (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Gets the playback position (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Sets the playback position (ms) of the music file to a different starting position (the default plays from the beginning).
pos | The playback starting position (ms) of the audio mixing file. |
|
abstract |
Gets the volume of the audio effects.
|
abstract |
Sets the volume of audio effects.
volume | The volume of audio effects. The value ranges between 0.0 and 100.0 (default). |
|
abstract |
Preloads a specified audio effect.
This method preloads only one specified audio effect into the memory each time it is called. To preload multiple audio effects, call this method multiple times.
After preloading, you can call playEffect to play the preloaded audio effect or call playAllEffects to play all the preloaded audio effects.
soundId | The ID of the audio effect. |
filePath | The absolute path of the local audio effect file or the URL of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. |
|
abstract |
Plays a specified audio effect.
After calling preloadEffect, you can call this method to play the specified audio effect for all users in the channel.
This method plays only one specified audio effect each time it is called. To play multiple audio effects, call this method multiple times.
soundId | The ID of the audio effect. |
filePath | The absolute path of the local audio effect file or the URL of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. |
loopCount | The number of times the audio effect loops:
|
pitch | The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is 1.0 (original pitch). The lower the value, the lower the pitch. |
pan | The spatial position of the audio effect. The value ranges between -1.0 and 1.0:
|
gain | The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is 100 (original volume). The lower the value, the lower the volume of the audio effect. |
publish | Sets whether to publish the specified audio effect to the remote stream:
|
|
abstract |
Plays all audio effects.
After calling preloadEffect multiple times to preload multiple audio effects into the memory, you can call this method to play all the specified audio effects for all users in the channel.
loopCount | The number of times the audio effect loops:
|
pitch | The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is 1.0 (original pitch). The lower the value, the lower the pitch. |
pan | The spatial position of the audio effect. The value ranges between -1.0 and 1.0:
|
gain | The volume of the audio effect. The value ranges between 0.0 and 100.0. The default value is 100 (original volume). The lower the value, the lower the volume of the audio effect. |
publish | Sets whether to publish the specified audio effect to the remote stream:
|
|
abstract |
Get the volume of a specified sound effect.
soundId | The ID of the audio effect. |
|
abstract |
Sets the volume of the specified audio effect.
soundId | The ID of the audio effect. |
volume | The volume of the specified audio effect. The value ranges between 0.0 and 100.0 (default). |
|
abstract |
Pauses playing the specified audio effect.
soundId | The ID of the audio effect. |
|
abstract |
Pauses playing all audio effects.
|
abstract |
Resumes playing the specified audio effect.
soundId | The ID of the audio effect. |
|
abstract |
Resumes playing all audio effects.
|
abstract |
Stops playing the specified audio effect.
soundId | The ID of the audio effect. |
|
abstract |
Stops playing all audio effects.
|
abstract |
Releases the specific preloaded audio effect from the memory.
soundId | The ID of the audio effect. |
|
abstract |
Releases all preloaded audio effects from the memory.
|
abstract |
Enables in-ear monitoring.
enabled | Determines whether to enable in-ear monitoring.
|
|
abstract |
Enables in-ear monitoring.
enabled | Determines whether to enable in-ear monitoring.
|
includeAudioFilter | Determines whether to include audio filter, for example, voice changer or reverberation, in the in-ear monitoring.
|
|
abstract |
Enables interoperability with the Agora Web SDK (Live Broadcast only).
Use this method when the channel profile is Live Broadcast. Interoperability with the Agora Web SDK is enabled by default when the channel profile is Communication.
enabled | Determines whether to enable interoperability with the Agora Web SDK.
|
|
abstract |
Registers an audio frame observer.
joinChannel
.observer | The audio frame observer. See IAudioFrameObserver. |
|
abstract |
Sets the external audio source.
joinChannel
.enabled | Whether to enable the external audio source:
|
sampleRate | The sample rate (Hz) of the external audio source, which can set be as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channels | The number of channels of the external audio source, which can be set as 1 or 2 :
|
|
abstract |
Sets the external audio source.
joinChannel
.enabled | Determines whether to enable the external audio source:
|
sampleRate | The Sample rate (Hz) of the external audio source, which can set be as 8000 , 16000 , 32000 , 44100 , or 48000 . |
channels | The number of channels of the external audio source, which can be set as 1 or 2 :
|
sourceNumber | The number of the external audio sources. Ensure that the number is greater than 0. |
|
abstract |
Pushes the external audio data to the app.
data | The audio buffer data. |
timestamp | The timestamp of the audio data. |
|
abstract |
Pushes the external audio data to the app.
data | The audio buffer data. |
timestamp | The timestamp of the audio data. |
sourceId | The ID of the external audio data. |
|
abstract |
Sets the local voice changer option.
This method can be used to set the local voice effect for users in a communication channel or broadcasters in a live broadcast 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.AUDIO_PROFILE_MUSIC_HIGH_QUALITY
or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
.voiceChanger | The local voice changer option:
|
|
abstract |
Sets the local voice reverberation option.
This method sets the local voice reverberation for users in a communication channel or broadcasters in a live-broadcast channel. After successfully calling this method, all users in the channel can hear the voice with reverberation.
AUDIO_REVERB_FX
, ensure that you set profile in setAudioProfile as AUDIO_PROFILE_MUSIC_HIGH_QUALITY
or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
. Otherwise, this method call does not take effect.reverbPreset | The local voice reverberation option. To achieve better voice effects, Agora recommends the enumeration whose name begins with AUDIO_REVERB_FX .
|
|
abstract |
Sets the volume of the in-ear monitoring.
volume | The volume of the in-ear monitor, ranging from 0 to 100. The default value is 100. |
|
abstract |
Sets the external video source.
Once the external video source is enabled, the SDK prepares to accept the external video frame.
enable | Determines whether to enable the external video source.
|
useTexture | Determines whether to use textured video data.
|
encodedFrame | Determines whether the external video source is encoded.
|
|
abstract |
Pushes the video frame using the AgoraVideoFrame class and passes the video frame to the Agora SDK.
Call the setExternalVideoSource method and set pushMode
as true
before calling this method. Otherwise, a failure returns after calling this method.
frame | Video frame to be pushed. See AgoraVideoFrame. |
COMMUNICATION
profile, the SDK does not support textured video frames. true
: The frame is pushed successfully.false
: Failed to push the frame.
|
abstract |
Pushes the video frame using the VideoFrame
class and passes the video frame to the Agora SDK.
Call the setExternalVideoSource method and set pushMode
as true
before calling this method. Otherwise, a failure returns after calling this method.
frame | Video frame to be pushed. See VideoFrame:
|
COMMUNICATION
profile, the SDK does not support textured video frames. true
: The frame is pushed successfully.false
: Failed to push the frame.
|
abstract |
Pushes the encoded external video frame to Agora SDK.
data | The encoded external video data, which must be the direct buffer. |
frameInfo | The encoded external video frame info: EncodedVideoFrameInfo. |
|
abstract |
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 SDK starts relaying media streams between the original and the destination channel.onChannelMediaRelayStateChanged
callback returns RELAY_STATE_FAILURE(3)
, an exception occurs during the media stream relay.joinChannel
method.channelMediaRelayConfiguration | The configuration of the media stream relay. See ChannelMediaRelayConfiguration. |
|
abstract |
Stops the media stream relay.
Once the relay stops, the broadcaster quits all the destination channels. After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged callback. If the callback returns RELAY_STATE_IDLE(0)
and RELAY_OK(0)
, the broadcaster successfully stops the relay.
If the method call fails, the SDK triggers the onChannelMediaRelayStateChanged
callback with the RELAY_ERROR_SERVER_NO_RESPONSE(2)
or RELAY_ERROR_SERVER_CONNECTION_LOST(8)
state code. You can leave the channel by calling the leaveChannel method, and the media stream relay automatically stops.
|
abstract |
Registers a video frame observer object.
You need to implement the IVideoFrameObserver class in this method, and register callbacks according to your scenarios.
After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.
width
and height
parameters, which may be adapted under the following circumstances:observer | Video frame observer object instance. See IVideoFrameObserver. |
|
abstract |
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.
|
abstract |
Sets the output log level of the SDK.
You can set the SDK to output the log files of the specified level.
level | Sets the log level:
|