Public Member Functions | |
abstract int | setChannelProfile (int profile) |
abstract int | setClientRole (int role) |
abstract int | joinChannel (String token, String channelName, String optionalInfo, int optionalUid) |
abstract int | leaveChannel () |
abstract int | renewToken (String token) |
abstract int | enableWebSdkInteroperability (boolean enabled) |
abstract int | getConnectionState () |
abstract int | enableAudio () |
abstract int | disableAudio () |
abstract int | pauseAudio () |
abstract int | resumeAudio () |
abstract int | setAudioProfile (int profile, int scenario) |
abstract int | setHighQualityAudioParameters (boolean fullband, boolean stereo, boolean fullBitrate) |
abstract int | adjustRecordingSignalVolume (int volume) |
abstract int | adjustPlaybackSignalVolume (int volume) |
abstract int | enableAudioVolumeIndication (int interval, int smooth) |
abstract int | enableAudioQualityIndication (boolean enabled) |
abstract int | enableLocalAudio (boolean enabled) |
abstract int | muteLocalAudioStream (boolean muted) |
abstract int | muteRemoteAudioStream (int uid, boolean muted) |
abstract int | muteAllRemoteAudioStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteAudioStreams (boolean muted) |
abstract int | enableVideo () |
abstract int | disableVideo () |
abstract int | setVideoProfile (int profile, boolean swapWidthAndHeight) |
abstract int | setVideoProfile (int width, int height, int frameRate, int bitrate) |
abstract int | setVideoEncoderConfiguration (VideoEncoderConfiguration config) |
abstract int | setCameraCapturerConfiguration (CameraCapturerConfiguration config) |
abstract int | setupLocalVideo (VideoCanvas local) |
abstract int | setupRemoteVideo (VideoCanvas remote) |
abstract int | setLocalRenderMode (int mode) |
abstract int | setRemoteRenderMode (int uid, int mode) |
abstract int | startPreview () |
abstract int | stopPreview () |
abstract int | enableLocalVideo (boolean enabled) |
abstract int | muteLocalVideoStream (boolean muted) |
abstract int | muteRemoteVideoStream (int uid, boolean muted) |
abstract int | muteAllRemoteVideoStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteVideoStreams (boolean muted) |
abstract int | setBeautyEffectOptions (boolean enabled, BeautyOptions options) |
abstract int | setDefaultAudioRoutetoSpeakerphone (boolean defaultToSpeaker) |
abstract int | setEnableSpeakerphone (boolean enabled) |
abstract boolean | isSpeakerphoneEnabled () |
abstract int | enableInEarMonitoring (boolean enabled) |
abstract int | setInEarMonitoringVolume (int volume) |
abstract int | useExternalAudioDevice () |
abstract int | setLocalVoicePitch (double pitch) |
abstract int | setLocalVoiceEqualization (int bandFrequency, int bandGain) |
abstract int | setLocalVoiceReverb (int reverbKey, int value) |
abstract int | setLocalVoiceChanger (int voiceChanger) |
abstract int | setLocalVoiceReverbPreset (int preset) |
abstract int | enableSoundPositionIndication (boolean enabled) |
abstract int | setRemoteVoicePosition (int uid, double pan, double gain) |
abstract int | startAudioMixing (String filePath, boolean loopback, boolean replace, int cycle) |
abstract int | stopAudioMixing () |
abstract int | pauseAudioMixing () |
abstract int | resumeAudioMixing () |
abstract int | adjustAudioMixingVolume (int volume) |
abstract int | adjustAudioMixingPlayoutVolume (int volume) |
abstract int | adjustAudioMixingPublishVolume (int volume) |
abstract int | getAudioMixingDuration () |
abstract int | getAudioMixingCurrentPosition () |
abstract int | setAudioMixingPosition (int pos) |
abstract IAudioEffectManager | getAudioEffectManager () |
abstract int | startAudioRecording (String filePath, int quality) |
abstract int | stopAudioRecording () |
abstract int | startEchoTest () |
abstract int | startEchoTest (int intervalInSeconds) |
abstract int | stopEchoTest () |
abstract int | enableLastmileTest () |
abstract int | disableLastmileTest () |
abstract int | startLastmileProbeTest (LastmileProbeConfig config) |
abstract int | stopLastmileProbeTest () |
abstract int | setVideoSource (IVideoSource source) |
abstract int | setLocalVideoRenderer (IVideoSink render) |
abstract int | setRemoteVideoRenderer (int uid, IVideoSink render) |
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels) |
abstract int | pushExternalAudioFrame (byte[] data, long timestamp) |
abstract void | setExternalVideoSource (boolean enable, boolean useTexture, boolean pushMode) |
abstract boolean | pushExternalVideoFrame (AgoraVideoFrame frame) |
abstract boolean | isTextureEncodeSupported () |
abstract int | registerAudioFrameObserver (IAudioFrameObserver observer) |
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 samplesPerCall) |
abstract int | addVideoWatermark (AgoraImage watermark) |
abstract int | clearVideoWatermarks () |
abstract int | setRemoteUserPriority (int uid, int userPriority) |
abstract int | setLocalPublishFallbackOption (int option) |
abstract int | setRemoteSubscribeFallbackOption (int option) |
abstract int | enableDualStreamMode (boolean enabled) |
abstract int | setRemoteVideoStreamType (int uid, int streamType) |
abstract int | setRemoteDefaultVideoStreamType (int streamType) |
abstract int | setEncryptionSecret (String secret) |
abstract int | setEncryptionMode (String encryptionMode) |
abstract int | addInjectStreamUrl (String url, LiveInjectStreamConfig config) |
abstract int | removeInjectStreamUrl (String url) |
abstract int | addPublishStreamUrl (String url, boolean transcodingEnabled) |
abstract int | removePublishStreamUrl (String url) |
abstract int | setLiveTranscoding (LiveTranscoding transcoding) |
abstract int | configPublisher (PublisherConfiguration config) |
abstract int | setVideoCompositingLayout (VideoCompositingLayout layout) |
abstract int | clearVideoCompositingLayout () |
abstract int | createDataStream (boolean reliable, boolean ordered) |
abstract int | sendStreamMessage (int streamId, byte[] message) |
abstract int | setVideoQualityParameters (boolean preferFrameRateOverImageQuality) |
abstract int | setLocalVideoMirrorMode (int mode) |
abstract int | switchCamera () |
abstract boolean | isCameraZoomSupported () |
abstract boolean | isCameraTorchSupported () |
abstract boolean | isCameraFocusSupported () |
abstract boolean | isCameraExposurePositionSupported () |
abstract boolean | isCameraAutoFocusFaceModeSupported () |
abstract int | setCameraZoomFactor (float factor) |
abstract float | getCameraMaxZoomFactor () |
abstract int | setCameraFocusPositionInPreview (float positionX, float positionY) |
abstract int | setCameraExposurePosition (float positionXinView, float positionYinView) |
abstract int | setCameraTorchOn (boolean isOn) |
abstract int | setCameraAutoFocusFaceModeEnabled (boolean enabled) |
abstract String | getCallId () |
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 | setLogFileSize (int fileSizeInKBytes) |
abstract long | getNativeHandle () |
void | addHandler (IRtcEngineEventHandler handler) |
abstract boolean | enableHighPerfWifiMode (boolean enable) |
abstract void | monitorHeadsetEvent (boolean monitor) |
abstract void | monitorBluetoothHeadsetEvent (boolean monitor) |
abstract void | setPreferHeadset (boolean enabled) |
abstract int | setParameters (String parameters) |
abstract String | getParameter (String parameter, String args) |
Static Public Member Functions | |
static synchronized RtcEngine | create (Context context, String appId, IRtcEngineEventHandler handler) throws Exception |
static synchronized void | destroy () |
static SurfaceView | CreateRendererView (Context context) |
static int | getRecommendedEncoderType () |
static String | getSdkVersion () |
static String | getMediaEngineVersion () |
static String | getErrorDescription (int error) |
RtcEngine is the main interface class of the Agora SDK.
Call the methods of this class to use all 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 was renamed to RtcEngine from v1.0.
|
static |
Creates an RtcEngine instance.
The Agora SDK only supports one RtcEngine instance at a time, therefore the app should create one RtcEngine object only. Unless otherwise specified:
context | The context of Android Activity. |
appId | The App ID issued to you by Agora. Apply for a new App ID from Agora if it is missing from your kit. |
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 |
Destroys the RtcEngine instance and releases all 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.
|
abstract |
Sets the channel profile.
RtcEngine needs to know the application scenario to set the appropriate channel profile to apply different optimization methods.
profile | Sets the channel profile:
|
|
abstract |
Sets the role of a user (Live Broadcast only).
This method sets the role of a user, such as a host or an audience (default), before joining a channel.
This method can be used to switch the user role after a user joins a channel.
role | Sets the role of a user. See ClientRole. |
|
abstract |
Allows a user to join a channel.
Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.
You must call the leaveChannel method to exit the current call before joining another channel.
token | A token generated by the server. In most cases, the static App ID suffices. For added security, use a token.
|
channelName | 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 | Additional information about the channel. This parameter can be set as null or contain channel related information. Other users in the channel do not receive this message. |
optionalUid | (Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to (2^32-1). optionalUid must be unique. If optionalUid is not assigned (or set to 0), the SDK assigns and returns uid in the onJoinChannelSuccess callback. Your app must record and maintain the returned uid since the SDK does not do so. |
The uid
is represented as a 32-bit unsigned integer in the SDK. Since unsigned integers are not supported by Java, the uid
is handled as a 32-bit signed integer and larger numbers are interpreted as negative numbers in Java. If necessary, the uid
can be converted to a 64-bit integer through “uid&0xffffffffL”.
uid
. If you set uid
as 0, the system automatically assigns a uid
.
|
abstract |
Allows a user to leave a channel.
After joining a channel, the user must call the leaveChannel method to end the call before joining another channel. This method returns 0 if the user leaves the channel and releases all resources related to the call. This method call is asynchronous, and the user has not exited the channel when the method call returns. Once the user leaves the channel, the SDK triggers the onLeaveChannel callback.
|
abstract |
Renews the token when the current token expires.
The token expires after a period of time once the token schema is enabled when:
The app should retrieve a new token from the server and call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
token | The new token. |
|
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 | Sets whether to enable/disable interoperability with the Agora Web SDK:
|
|
abstract |
Gets the connection state of the SDK.
|
abstract |
Enables the audio module.
The audio module is enabled by default.
|
abstract |
Disables the audio module.
|
abstract |
Disables the audio function in the channel.
|
abstract |
Resumes the audio playback in the channel.
|
abstract |
Sets the audio parameters and application scenarios.
profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See Audio Profile. |
scenario | Sets the audio application scenarios. See Audio Scenario. |
profile
as AUDIO_SCENARIO_SHOWROOM(4) and scenario
as AUDIO_SCENARIO_GAME_STREAMING(3) in Audio Scenario.
|
abstract |
Sets the high-quality audio preferences.
fullband | Sets whether to enable/disable full-band codec (48-kHz sample rate), not compatible with versions earlier than v1.7.4:
|
stereo | Sets whether to enable/disable stereo codec, not compatible with versions earlier than v1.7.4:
|
fullBitrate | Sets whether to enable/disable high-bitrate mode. Recommended in voice-only mode:
|
|
abstract |
Adjusts the recording volume.
volume | Recording volume. The value ranges between 0 and 400:
|
|
abstract |
Adjusts the playback volume.
volume | Playback volume. The value ranges between 0 and 400:
|
|
abstract |
Enables the onAudioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.
Once this method is enabled, the SDK returns the volume indication in the onAudioVolumeIndication callback at the set time interval, regardless of whether any user is speaking in the channel.
interval | Sets the time interval between two consecutive volume indications:
|
smooth | The smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3. |
|
abstract |
Enables the audio quality callbacks.
The SDK triggers the onAudioQuality callback after this method is enabled.
enabled | Sets whether to enable/disable the audio quality callback:
|
|
abstract |
Enables/Disables the local audio capture.
The audio function is enabled by default. This method disables/re-enables the local audio function, that is, to stop or restart local audio capture and processing.
This method does not affect receiving or playing the remote audio streams, and is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
The SDK triggers the onMicrophoneEnabled callback once the local audio function is disabled or re-enabled.
enabled | Sets whether to disable/re-enable the local audio function:
|
|
abstract |
Sends/Stops sending the local audio stream.
muted | Sets whether to send/stop sending the local audio stream:
|
muted
is set as true
, this method does not disable the microphone and thus does not affect any ongoing recording.
|
abstract |
Receives/Stops receiving a specified audio stream.
uid | ID of the specified remote user. |
muted | Sets whether to receive/stop receiving the specified remote user's audio stream:
|
muted
as true
to stop receiving all remote video streams, ensure that the muteAllRemoteAudioStreams method is called and set muted
as false
before calling this method. The muteAllRemoteAudioStreams method sets all remote audio streams, while the muteRemoteAudioStream method sets a specified remote user's audio stream.
|
abstract |
Receives/Stops receiving all remote audio streams.
muted | Sets whether to receive/stop receiving all remote audio streams:
|
|
abstract |
Sets whether to receive all remote audio streams by default.
You can call this method either before or after joining a channel. If you call this method after joining a channel, the remote audio streams of all subsequent users are not received.
muted | Sets whether or not to receive/stop receiving all remote audio streams by default:
|
|
abstract |
Enables the video module.
You can call this method either before joining a channel or during a call. If you call this method before joining a channel, the service starts in the video mode. If you call this method during an audio call, the audio mode switches to the video mode. To disable the video, call the disableVideo method.
|
abstract |
Disables the video module.
You can call this method before joining a channel or during a call. If you call this method before joining a channel, the service starts in audio mode. If you call this method during a video call, the video mode switches to the audio mode. To enable the video mode, call the enableVideo method.
|
abstract |
Sets the video encoding profile.
If you do not need to change the video encoding profile after joining a channel, call this method before calling the enableVideo method to reduce the render time of the first video frame.
Each video encoding profile includes a set of parameters, such as the resolution, frame rate, and bitrate. When the camera does not support the specified resolution, the SDK chooses a suitable camera resolution, while the encoder resolution is specified by this method.
profile | Sets the video encoding profile. See VideoProfile. |
swapWidthAndHeight | The width and height of the output video is consistent with the set video profile. swapWidthAndHeight sets whether or not to swap the width and height of the stream:
|
|
abstract |
Manually sets the video encoding profile.
Each video encoding profile includes a set of parameters, such as the resolution, frame rate, and bitrate. If the camera device does not support the specified resolution, the SDK automatically chooses a suitable camera resolution, keeping the encoder resolution specified by this method. If the user does not set the video encoding profile after joining a channel, We recommend calling this method before calling the enableVideo method to minimize the time delay in receiving the first video frame.
width | Sets the width of the video. The maximum value of width × height is 1280 × 720. |
height | Sets the height of the video. The maximum value of width × height is 1280 × 720. |
frameRate | Sets the frame rate of the video. The highest value is 30. You can set frameRate as 5, 10, 15, 24, and 30. |
bitrate | Sets the bitrate of the video. You need to manually work out the bitrate according to the width, height, and frame rate. For the correlation between the width, height, and frame rate. See the table in Bitrate. |
With the same width and height, the bitrate varies with the frame rate:
If you set a bitrate beyond the proper range, the SDK automatically adjusts the bitrate to a value within the proper range.
|
abstract |
Sets the video encoder configuration.
Each video encoder configuration corresponds to a set of video parameters, including the resolution, frame rate, bitrate, and video orientation. The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.
If you do not set the video encoder configuration after joining the channel, you can call this method before calling the enableVideo method to reduce the render time of the first video frame.
config | The local video encoder configuration. See VideoEncoderConfiguration. |
|
abstract |
Sets the camera capture preference.
For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capture settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capture preference:
config
as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to avoid such problems. config
as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to optimize CPU and RAM usage. config
as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2)
. config | The camera capture preference. For details, see CameraCapturerConfiguration. |
|
abstract |
Sets the local video view and configures the video display settings on the local device.
You can call this method to bind each video window (view) of the local video streams and configure the video display settings. Call this method after initialization to configure the local video display settings before joining a channel. The binding is still valid after the user leaves the channel, which means that the window still displays. To unbind the view, set view
in Video Canvas as null
.
local | Sets the local video view and settings. See Video Canvas. |
|
abstract |
Sets the remote user's video view.
This method binds the remote user to the video display window (sets the view for the remote user of the specified uid
).
Typically, the app specifies the uid
of the remote user sending the video in the method call before the remote user joins a channel. If the uid
of the remote user is unknown to the app, set the uid
when the app receives the onUserJoined callback. If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the app view because the dummy client does not send any video streams. If your app does not recognize the dummy client, bind the remote user to the view when the SDK triggers the onFirstRemoteVideoDecoded callback.
To unbind the remote user from the view, set view
in Video Canvas as null
. Once the remote user leaves the channel, the SDK unbinds the remote user.
remote | Sets the remote video view and settings. See Video Canvas. |
|
abstract |
Sets the local video display mode.
This method may be invoked multiple times during a call to change the display mode.
mode | Sets the local video display mode:
|
|
abstract |
Sets the remote video display mode.
This method can be invoked multiple times during a call to change the display mode.
uid | User ID of the remote user. |
mode | Sets the remote video display mode:
|
|
static |
Creates the video renderer view.
CreateRendererView returns the SurfaceView type. The operation and layout of the view are managed by the app, and the Agora SDK renders the view provided by the app. The video display view must be created using this method instead of directly calling SurfaceView
.
context | The context of the Android Activity. |
|
abstract |
Starts the local video preview before joining a channel.
Before calling this method, you must:
|
abstract |
Stops the local video preview and the video.
|
abstract |
Disables/Re-enables the local video capture.
The local video is enabled by default. This method disables/re-enables the local video and is only applicable when the user wants to watch the remote video without sending any video stream to the other user. Call this method after calling the enableVideo method. Otherwise, this method may not work properly. Calling the enableVideo method enables the local video by default. This method is used to disable/re-enable the local video while the remote video remains unaffected.
enabled | Sets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
|
|
abstract |
Sends/Stops sending the local video stream.
muted | Sets whether to send/stop sending the local video stream:
|
muted
as true
, this method does not disable the camera and thus does not affect the retrieval of the local video streams. This method responds faster than calling the enableLocalVideo method and set muted
as false
, which controls sending the local video stream.
|
abstract |
Receives/Stops receiving a specified remote user's video stream.
uid | User ID of the specified remote user. |
muted | Sets whether to receive/stop receiving a specified remote user's video stream:
|
muted
as true
to stop receiving all remote video streams, ensure that the muteAllRemoteVideoStreams method is called and set muted
as false
before calling this method. The muteAllRemoteVideoStreams method sets all remote streams, while this method sets a specified remote user's stream.
|
abstract |
Receives/Stops receiving all remote video streams.
muted | Sets whether to receive/stop receiving all remote video streams:
|
|
abstract |
Sets whether to receive all remote video streams by default.
muted | Sets whether to receive/stop receiving all remote video streams by default:
|
|
abstract |
Enables/Disables image enhancement and sets the options.
enabled | Sets whether or not to enable image enhancement:
|
options | The image enhancement options. See BeautyOptions. |
|
abstract |
Sets the default audio playback route.
This method sets whether the received audio is routed to the earpiece or speakerphone by default before joining a channel. If a user does not call this method, the audio is routed to the earpiece by default. If you need to change the default audio route after joining a channel, call the setEnableSpeakerphone method.
The default setting for each mode:
defaultToSpeaker | Sets the default audio route:
|
|
abstract |
Enables/Disables the audio playback route to the speakerphone.
This method sets whether the audio is routed to the speakerphone or earpiece.
See the default audio route explanation in the setDefaultAudioRouteToSpeakerphone method and check whether it is necessary to call this method.
enabled | Sets whether to route the audio to the speakerphone or earpiece:
|
|
abstract |
Checks whether the speakerphone is enabled.
|
abstract |
Enables in-ear monitoring.
enabled | Sets whether to enable/disable in-ear monitoring:
|
|
abstract |
Sets the volume of the in-ear monitor.
volume | Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default). |
|
abstract |
Uses an external audio device.
|
abstract |
Changes the voice pitch of the local speaker.
pitch | Sets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch). |
|
abstract |
Sets the local voice equalization effect.
bandFrequency | Sets the band frequency. The value ranges between 0 and 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. |
bandGain | Sets the gain of each band (dB). The value ranges between -15 and 15. The default value is 0. |
|
abstract |
Sets the local voice reverberation.
reverbKey | Sets the reverberation key. This method contains five reverberation keys. For details, see the description of each @ value. |
value | Sets the local voice reverberation value:
|
|
abstract |
Sets the local voice changer option.
voiceChanger | The local voice changer option:
|
|
abstract |
Sets the preset local voice reverberation effect
preset | The local voice reverberation preset:
|
|
abstract |
Enables/Disables stereo panning for remote users.
Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling setRemoteVoicePosition.
enabled | Sets whether or not to enable stereo panning for remote users:
|
|
abstract |
Sets the sound position of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
uid | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0:
|
gain | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. |
|
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. When the audio mixing file playback finishes after calling this method, the SDK triggers the onAudioMixingFinished callback.
filePath | Specifies the absolute path of the local or online audio file to be mixed. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. See Supported Media Formats for details.
|
loopback | Sets which user can hear the audio mixing:
|
replace | Sets the audio mixing content:
|
cycle | Sets the number of playback loops:
|
|
abstract |
Stops playing or mixing the music file.
Call this method when you are in a channel.
|
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 volume of audio mixing for local playback.
volume | Audio mixing volume for local playback. The value ranges between 0 and 100 (default). |
|
abstract |
Adjusts the volume of audio mixing for publishing (sending to other users).
volume | Audio mixing volume for publishing. The value ranges between 0 and 100 (default). |
|
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 |
Retrieves the IAudioEffectManager object associated with the current RtcEngine instance.
|
abstract |
Starts an audio recording on the client.
The SDK allows recording during a call. Supported formats:
Ensure that the directory to save the recording file exists and is writable. This method is usually called after calling the joinChannel method. The recording automatically stops when you call the leaveChannel method.
filePath | Full file path of the recording file. The string of the file name is in UTF-8. |
quality | Sets the audio recording quality:
|
|
abstract |
Stops the audio recording on the client.
|
abstract |
Starts an audio call test.
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.
To conduct the test:
|
abstract |
Starts an audio call test.
In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
intervalInSeconds | The time interval (s) between when you speak and when the recording plays back. |
|
abstract |
Stops the audio call test.
|
abstract |
Enables the network connection quality test.
This method tests the quality of the users' network connections and is disabled by default.
Before users join a channel or before an audience switches to a host, call this method to check the uplink network quality. This method consumes additional network traffic, which may affect the communication quality. Call the disableLastmileTest method to disable this test after receiving the onLastmileQuality callback, and before the user joins a channel or switches the user role.
|
abstract |
Disables the network connection quality test.
|
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 returns the following callbacks:
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 |
Customizes the video source.
Call this method to add an external video source to the SDK.
source | Sets the video source. See IVideoSource. |
|
abstract |
Customizes the local video renderer.
Call this method to add an external local video renderer to the SDK.
render | Sets the local video renderer. See IVideoSink. |
|
abstract |
Customizes the remote video renderer.
Call this method to add an external remote video renderer to the SDK.
uid | The ID of the remote user. |
render | Sets the remote video renderer. See IVideoSink. |
|
abstract |
Sets the external audio source.
enabled | Sets whether to enable/disable the external audio source:
|
sampleRate | Sets the sample rate of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channels | Sets the number of external audio source channels (two channels maximum). |
|
abstract |
Pushes the external audio frame to the Agora SDK for encoding.
data | External audio data to be pushed. |
timestamp | Timestamp of the external audio frame to be synchronized with the external video source. |
|
abstract |
Configures the external video source.
enable | Sets whether or not to use the external video source:
|
useTexture | Sets whether or not to use texture as an input:
|
pushMode | Sets whether or not the external video source needs to call the PushExternalVideoFrame method to send the video frame to the Agora SDK:
|
|
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. |
|
abstract |
Checks whether texture encoding is supported.
|
abstract |
Registers the audio observer object.
observer | Audio observer object to be registered. See IAudioFrameObserver. Set the value as null to cancel registering, if necessary. |
|
abstract |
Sets the audio recording format for the onRecordFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onRecordFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channel | Sets the number of audio channels (channels ) returned in the onRecordFrame callback:
|
mode | Sets the use mode of the onRecordFrame callback:
|
samplesPerCall | Sets the sample points (samples ) returned in the onRecordFrame callback. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Sets the audio playback format for the onPlaybackFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onPlaybackFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channel | Sets the number of channels (channels ) returned in the onPlaybackFrame callback:
|
mode | Sets the use mode of the onPlaybackFrame callback:
|
samplesPerCall | Sets the sample points (samples ) returned in the onPlaybackFrame callback. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Sets the mixed audio format for the onMixedAudioFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onMixedAudioFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
samplesPerCall | Sets the sample points (samples ) returned in the onMixedAudioFrame callback. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video stream for the recording device, channel audience, or CDN live audience to see and capture. To add the PNG file to a CDN live publishing stream, see the setLiveTranscoding method.
watermark | Watermark image to be added to the local video stream. See Agora Image. |
url
in Agora Image refers to the absolute path of the added watermark image file in the local video stream. url
in Agora Image refers to the address of the added watermark image in the CDN live broadcast. orientationMode
as Adaptive in the setVideoEncoderConfiguration method, the watermark image rotates with the video frame around the upper left corner of the watermark image.
|
abstract |
Removes the watermark image from the video stream added by addVideoWatermark.
|
abstract |
Sets the priority of a remote user's media stream.
Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
uid | The ID of the remote user. |
userPriority | The priority of the remote user:
|
|
abstract |
Sets the fallback option for the locally published video stream based on the network conditions.
If option
is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK will:
When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the onLocalPublishFallbackToAudioOnly.
option | Sets the fallback option for the locally published video stream:
|
|
abstract |
Sets the fallback option for the remotely subscribed video stream based on the network conditions.
If option
is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network condition cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve. When the remotely subscribed video stream falls back to audio only, or the audio-only stream switches back to the video, the SDK triggers the onRemoteSubscribeFallbackToAudioOnly callback.
option | Sets the fallback option for the remotely subscribed video stream:
|
|
abstract |
Enables/Disables dual-stream mode.
If dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution high-bitrate video stream) or low stream (low-resolution low-bitrate video stream) video.
enabled | Sets the stream mode:
|
|
abstract |
Sets the video stream type of the remotely subscribed video stream when the remote user sends dual streams. This method allows the app to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.
The method result returns in the onApiCallExecuted callback. The Agora SDK receives the high-stream video by default to save the bandwidth. If needed, users may use this method to switch to the low-stream video. By default, the aspect ratio of the low-stream video is the same as the high-stream video. Once the resolution of the high-stream video is set, the system automatically sets the resolution, frame rate, and bitrate of the low-stream video.
uid | ID of the remote user sending the video stream. |
streamType | Sets the video-stream type:
|
|
abstract |
Sets the default video-stream type of the remotely subscribed video stream when the remote user sends dual streams.
streamType | Sets the default video-stream type:
|
|
abstract |
Enables built-in encryption with an encryption password before joining a channel.
All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user leaves the channel. If the encryption password is not specified or set to empty, the encryption functionality is disabled.
secret | Encryption password. |
|
abstract |
Sets the built-in encryption mode.
The Agora SDK supports built-in encryption, which is set to aes-128-xts
mode by default. Call this method to set the encryption mode to use other encryption modes. All users in the same channel must use the same encryption mode and password.
Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
encryptionMode | Sets the encryption mode:
|
|
abstract |
Injects an online media stream to a live broadcast.
The onStreamPublished callback returns the inject status. If this method call is successful, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all audience members in the channel can watch a live show and interact with each other.
The SDK triggers the onUserJoined and onFirstRemoteVideoDecoded callbacks and returns a stream uid of 666.
url | The URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and FLV.
|
config | The LiveInjectStreamConfig object which contains the configuration information for the added voice or video stream. |
|
abstract |
Removes the injected online media stream from a live broadcast.
This method removes the URL address (added by addInjectStreamUrl) from a live broadcast.
If this method call is successful, the SDK triggers the onUserOffline callback and returns a stream uid of 666.
url | HTTP/HTTPS URL address of the added stream to be removed. |
|
abstract |
Adds a CDN stream address.
The host publishes a stream to the specified CDN live HTTP/HTTPS URL address. This method triggers the onStreamPublished callback.
url | The RTMP address in the format of HTTP or HTTPS, to which the host publishes the stream. |
transcodingEnabled | Sets whether transcoding is enabled/disabled:
|
|
abstract |
Removes a CDN stream address.
This method removes the HTTP/HTTPS URL address (added by addPublishStreamUrl) from a CDN live stream.
url | The URL address in the format of HTTP or HTTPS to be removed. |
|
abstract |
Sets the video layout and audio settings for CDN live.
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
|
abstract |
Configures the CDN live streaming before joining a channel.
Builder class to configure the push-stream for CDN live: Builder Class.
config | Sets the CDN live stream settings. See PublisherConfiguration. |
|
abstract |
Sets the picture-in-picture layout for the CDN live broadcast. (CDN live only.)
This method sets the picture-in-picture layouts for live broadcasts. This method is only applicable when you want to push streams to the Agora server. When you push a stream to the Agora server:
The push stream app formats the information of the customized layouts as JSON and packages it in the Supplemental Enhancement Information (SEI) of each keyframe when generating the H.264 video stream and pushing it to the CDN live vendors through the RTMP protocol.
layout | Sets the picture-in-picture layout. See VideoCompositingLayout. |
|
abstract |
Removes the picture-in-picture layout settings created by the setVideoCompositingLayout method. (CDN live only.)
|
abstract |
Creates a data stream.
Each user can have up to five simultaneous data channels.
reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether or not the recipients receive the data stream in the sent order:
|
reliable
and ordered
parameters to true
or false
. Do not set one as true
and the other as false
.
|
abstract |
Sends data stream messages.
The SDK has the following restrictions on this method:
streamId | ID of the sent data stream returned by the createDataStream method. |
message | Sent data. |
|
abstract |
Sets the preference option for the video quality (Live Broadcast only).
preferFrameRateOverImageQuality | Sets the video quality preference:
|
|
abstract |
Sets the local video mirror mode.
Use this method before calling the startPreview method, or the mirror mode does not take effect until you call the startPreview method again.
mode | Sets the local video mirror mode:
|
|
static |
Gets the recommended encoder type.
|
abstract |
Switches between front and rear cameras.
|
abstract |
Checks whether the camera zoom function is supported.
|
abstract |
Checks whether the camera flash function is supported.
|
abstract |
Checks whether the camera manual focus function is supported.
|
abstract |
Checks whether the camera exposure function is supported.
|
abstract |
Checks whether the camera auto-face focus function is supported.
|
abstract |
Sets the camera zoom ratio.
factor | Sets the camera zoom factor. The value ranges between 1.0 and the maximum zoom supported by the device. |
|
abstract |
Gets the maximum zoom ratio supported by the camera.
|
abstract |
Sets the camera manual focus position.
positionX | The horizontal coordinate of the touch point in the view. |
positionY | The vertical coordinate of the touch point in the view. |
|
abstract |
Sets the camera exposure position.
positionXinView | The horizontal coordinate of the touch point in the view. |
positionYinView | The vertical coordinate of the touch point in the view. |
|
abstract |
Enables the camera flash function.
isOn | Sets whether to enable/disable the camera flash function:
|
|
abstract |
Enables the camera auto-face focus function.
enabled | Sets whether to enable/disable the camera auto-face focus function:
|
|
abstract |
Gets the current call ID.
When a user joins a channel on a client, a call ID is generated to identify the call from the client. Feedback methods, such as the rate and complain method, must be called after the call ends to submit feedback to the SDK.
The rate and complain methods require the callId
parameter retrieved from the getCallId method during a call. callId
is passed as an argument into the rate and complain methods after the call ends.
|
abstract |
Allows the user to rate a call after the call ends.
callId | ID of the call retrieved from the getCallId method. |
rating | Rating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the ERR_INVALID_ARGUMENT(-2) error occurs. |
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 after a call ends.
callId | ID of the call retrieved from the getCallId method. |
description | (Optional) The description of the complaint. The string length must be less than 800 bytes. |
|
static |
Gets the SDK version.
|
static |
Gets the media engine version.
|
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. The default file path is /sdcard/{Package name of the App}/agorasdk.log. |
|
abstract |
Sets the output log 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 to see the 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 |
Sets the log file size (KB).
The Agora SDK has two log files, each with a default size of 512 KB. If you set fileSizeInKBytes
as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.
fileSizeInKBytes | The SDK log file size (KB). |
|
abstract |
Gets the native handle of the SDK engine.
This interface is used to retrieve the native C++ handle of the SDK engine used in special scenarios, such as registering the audio and video frame observer.
void io.agora.rtc.RtcEngine.addHandler | ( | IRtcEngineEventHandler | handler | ) |
Adds the IRtcEngineEventHandler class.
The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the app, and the app inherits the methods of the IRtcEngineEventHandler interface class to retrieve the callbacks.
handler | IRtcEngineEventHandler |
|
abstract |
Enables the Wi-Fi mode.
enable | Sets whether to enable/disable the Wi-Fi mode:
|
|
static |
Gets the warning or error description.
error | Detailed warning or error description in Warning Code or Error Code. |
|
abstract |
Monitors external headset device events.
monitor | Sets whether to enable/disable monitoring external headset device events:
|
|
abstract |
Monitors Bluetooth headset device events.
monitor | Sets whether to enable/disable monitoring Bluetooth headset device events:
|
|
abstract |
Sets the default audio route to the headset.
enabled | Sets whether or not the default audio route is to the headset:
|
|
abstract |
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
parameters | Sets the parameter as a JSON string in the specified format. |
|
abstract |
Gets the Agora SDK’s parameters for customization purposes. This method is not disclosed yet. Contact support@agora.io for more information.