Agora Java API Reference for Android

Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
io.agora.rtc2.RtcEngine Class Referenceabstract
Inheritance diagram for io.agora.rtc2.RtcEngine:

## Public Member Functions
abstract int | setChannelProfile (int profile)
abstract int | setClientRole (int role)
abstract int | setClientRole (int role, ClientRoleOptions options)
abstract int | sendCustomReportMessage (String id, String category, String event, String label, int value)
abstract int | preloadChannel (String token, String channelName, int optionalUid)
abstract int | preloadChannelWithUserAccount (String token, String channelName, String userAccount)
abstract int | updatePreloadChannelToken (String token)
abstract int | joinChannel (String token, String channelId, String optionalInfo, int uid)
abstract int | joinChannel (String token, String channelId, int uid, ChannelMediaOptions options)
abstract int | registerLocalUserAccount (String appId, String userAccount)
abstract int | joinChannelWithUserAccount (String token, String channelName, String userAccount)
abstract int | joinChannelWithUserAccount (String token, String channelName, String userAccount, ChannelMediaOptions options)
abstract int | getUserInfoByUserAccount (String userAccount, UserInfo userInfo)
abstract int | getUserInfoByUid (int uid, UserInfo userInfo)
abstract int | leaveChannel ()
abstract int | leaveChannel (LeaveChannelOptions options)
abstract int | renewToken (String token)
abstract DeviceInfo | getAudioDeviceInfo ()
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)
abstract int | setAudioProfile (int profile, int scenario)
abstract int | setAudioScenario (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, boolean reportVad)
abstract int | enableLocalAudio (boolean enabled)
abstract int | muteLocalAudioStream (boolean muted)
abstract int | muteRemoteAudioStream (int uid, boolean muted)
abstract int | adjustUserPlaybackSignalVolume (int uid, int volume)
abstract int | muteAllRemoteAudioStreams (boolean muted)
abstract int | enableVideo ()
abstract int | disableVideo ()
abstract int | setVideoEncoderConfiguration (VideoEncoderConfiguration config)
abstract CodecCapInfo[] | queryCodecCapability ()
abstract int | queryDeviceScore ()
abstract AgoraFocalLengthInfo[] | queryCameraFocalLengthCapability ()
abstract int | setCameraCapturerConfiguration (CameraCapturerConfiguration config)
abstract int | setupLocalVideo (VideoCanvas local)
abstract int | setupRemoteVideo (VideoCanvas remote)
abstract int | setRemoteRenderMode (int uid, int renderMode)
abstract int | setLocalRenderMode (int renderMode)
abstract int | setRemoteRenderMode (int uid, int renderMode, int mirrorMode)
abstract int | setLocalRenderMode (int renderMode, int mirrorMode)
abstract int | startPreview ()
abstract int | startPreview (Constants.VideoSourceType sourceType)
abstract int | stopPreview ()
abstract int | stopPreview (Constants.VideoSourceType sourceType)
abstract int | enableLocalVideo (boolean enabled)
abstract int | startCameraCapture (Constants.VideoSourceType sourceType, CameraCapturerConfiguration config)
abstract int | stopCameraCapture (Constants.VideoSourceType sourceType)
abstract int | startLocalVideoTranscoder (LocalTranscoderConfiguration config)
abstract int | stopLocalVideoTranscoder ()
abstract int | updateLocalTranscoderConfiguration (LocalTranscoderConfiguration config)
abstract int | startLocalAudioMixer (LocalAudioMixerConfiguration config)
abstract int | updateLocalAudioMixerConfiguration (LocalAudioMixerConfiguration config)
abstract int | stopLocalAudioMixer ()
abstract int | muteLocalVideoStream (boolean muted)
abstract int | muteRemoteVideoStream (int uid, boolean muted)
abstract int | muteAllRemoteVideoStreams (boolean muted)
abstract int | setBeautyEffectOptions (boolean enabled, BeautyOptions options)
abstract int | setBeautyEffectOptions (boolean enabled, BeautyOptions options, Constants.MediaSourceType sourceType)
abstract int | setFaceShapeBeautyOptions (boolean enabled, FaceShapeBeautyOptions options)
abstract int | setFaceShapeBeautyOptions (boolean enabled, FaceShapeBeautyOptions options, Constants.MediaSourceType sourceType)
abstract FaceShapeBeautyOptions | getFaceShapeBeautyOptions ()
abstract FaceShapeBeautyOptions | getFaceShapeBeautyOptions (Constants.MediaSourceType sourceType)
abstract int | setFaceShapeAreaOptions (FaceShapeAreaOptions options)
abstract int | setFaceShapeAreaOptions (FaceShapeAreaOptions options, Constants.MediaSourceType sourceType)
abstract FaceShapeAreaOptions | getFaceShapeAreaOptions (int shapeArea)
abstract FaceShapeAreaOptions | getFaceShapeAreaOptions (int shapeArea, Constants.MediaSourceType sourceType)
abstract int | setFilterEffectOptions (boolean enabled, FilterEffectOptions options)
abstract int | setFilterEffectOptions (boolean enabled, FilterEffectOptions options, Constants.MediaSourceType sourceType)
abstract int | setLowlightEnhanceOptions (boolean enabled, LowLightEnhanceOptions options)
abstract int | setLowlightEnhanceOptions (boolean enabled, LowLightEnhanceOptions options, Constants.MediaSourceType sourceType)
abstract int | setVideoDenoiserOptions (boolean enabled, VideoDenoiserOptions options)
abstract int | setVideoDenoiserOptions (boolean enabled, VideoDenoiserOptions options, Constants.MediaSourceType sourceType)
abstract int | setColorEnhanceOptions (boolean enabled, ColorEnhanceOptions options)
abstract int | setColorEnhanceOptions (boolean enabled, ColorEnhanceOptions options, Constants.MediaSourceType sourceType)
abstract int | enableVirtualBackground (boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty)
abstract int | enableVirtualBackground (boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, Constants.MediaSourceType sourceType)
abstract int | setDefaultAudioRoutetoSpeakerphone (boolean defaultToSpeaker)
abstract int | setEnableSpeakerphone (boolean enabled)
abstract int | setRouteInCommunicationMode (int route)
abstract boolean | isSpeakerphoneEnabled ()
abstract int | enableInEarMonitoring (boolean enabled)
abstract int | enableInEarMonitoring (boolean enabled, int includeAudioFilters)
abstract int | setInEarMonitoringVolume (int volume)
abstract int | setLocalVoicePitch (double pitch)
abstract int | setLocalVoiceFormant (double formantRatio)
abstract int | setLocalVoiceEqualization (Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain)
abstract int | setLocalVoiceReverb (Constants.AUDIO_REVERB_TYPE reverbKey, int value)
abstract int | setHeadphoneEQPreset (int preset)
abstract int | setHeadphoneEQParameters (int lowGain, int highGain)
abstract int | setAudioEffectPreset (int preset)
abstract int | setVoiceBeautifierPreset (int preset)
abstract int | setVoiceConversionPreset (int preset)
abstract int | setAudioEffectParameters (int preset, int param1, int param2)
abstract int | setVoiceBeautifierParameters (int preset, int param1, int param2)
abstract int | setVoiceConversionParameters (int preset, int param1, int param2)
abstract int | enableSoundPositionIndication (boolean enabled)
abstract int | setRemoteVoicePosition (int uid, double pan, double gain)
abstract int | enableVoiceAITuner (boolean enabled, Constants.VOICE_AI_TUNER_TYPE type)
abstract int | startAudioMixing (String filePath, boolean loopback, int cycle)
abstract int | enableSpatialAudio (boolean enabled)
abstract int | setRemoteUserSpatialAudioParams (int uid, SpatialAudioParams params)
abstract int | setRemoteVideoSubscriptionOptions (int uid, VideoSubscriptionOptions options)
abstract int | setAINSMode (boolean enabled, int mode)
abstract int | startAudioMixing (String filePath, boolean loopback, int cycle, int startPos)
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 | getAudioMixingPlayoutVolume ()
abstract int | getAudioMixingPublishVolume ()
abstract int | getAudioMixingDuration ()
abstract int | getAudioMixingCurrentPosition ()
abstract int | setAudioMixingPosition (int pos)
abstract int | setAudioMixingDualMonoMode (Constants.AudioMixingDualMonoMode mode)
abstract int | setAudioMixingPitch (int pitch)
abstract int | setAudioMixingPlaybackSpeed (int speed)
abstract int | selectAudioTrack (int audioIndex)
abstract int | getAudioTrackCount ()
abstract IAudioEffectManager | getAudioEffectManager ()
abstract int | startAudioRecording (String filePath, int quality)
abstract int | startAudioRecording (AudioRecordingConfiguration config)
abstract int | stopAudioRecording ()
abstract int | startEchoTest (EchoTestConfiguration config)
abstract int | stopEchoTest ()
abstract int | startLastmileProbeTest (LastmileProbeConfig config)
abstract int | stopLastmileProbeTest ()
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels)
abstract int | setExternalAudioSink (boolean enabled, int sampleRate, int channels)
abstract int | setExternalRemoteEglContext (Object eglContext)
abstract int | pullPlaybackAudioFrame (byte[] data, int lengthInByte)
abstract int | pullPlaybackAudioFrame (ByteBuffer data, int lengthInByte)
abstract int | startRecordingDeviceTest (int indicationInterval)
abstract int | stopRecordingDeviceTest ()
abstract int | startPlaybackDeviceTest (String audioFileName)
abstract int | stopPlaybackDeviceTest ()
abstract int | createCustomAudioTrack (Constants.AudioTrackType trackType, AudioTrackConfig config)
abstract int | destroyCustomAudioTrack (int trackId)
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels, boolean localPlayback, boolean publish)
abstract int | pushExternalAudioFrame (byte[] data, long timestamp)
abstract int | pushExternalAudioFrame (ByteBuffer data, long timestamp, int trackId)
abstract int | pushExternalAudioFrame (byte[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId)
abstract int | pushExternalAudioFrame (ByteBuffer data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId)
abstract int | setExternalVideoSource (boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType)
abstract int | setExternalVideoSource (boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType, EncodedVideoTrackOptions encodedOpt)
abstract boolean | pushExternalVideoFrame (VideoFrame frame)
abstract int | pushExternalVideoFrameById (VideoFrame frame, int videoTrackId)
abstract int | pushExternalVideoFrameById (AgoraVideoFrame frame, int videoTrackId)
abstract int | pushExternalEncodedVideoFrame (ByteBuffer data, EncodedVideoFrameInfo frameInfo)
abstract int | pushExternalEncodedVideoFrameById (ByteBuffer data, EncodedVideoFrameInfo frameInfo, int videoTrackId)
abstract boolean | pushExternalVideoFrame (AgoraVideoFrame frame)
abstract boolean | isTextureEncodeSupported ()
abstract int | registerAudioFrameObserver (IAudioFrameObserver observer)
abstract int | registerAudioEncodedFrameObserver (AudioEncodedFrameObserverConfig config, IAudioEncodedFrameObserver 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 channel, int samplesPerCall)
abstract int | setEarMonitoringAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall)
abstract int | addVideoWatermark (AgoraImage watermark)
abstract int | addVideoWatermark (String watermarkUrl, WatermarkOptions options)
abstract int | clearVideoWatermarks ()
abstract int | setRemoteUserPriority (int uid, int userPriority)
abstract int | setLocalPublishFallbackOption (Constants.StreamFallbackOptions option)
abstract int | setLocalPublishFallbackOption (int option)
abstract int | setRemoteSubscribeFallbackOption (Constants.StreamFallbackOptions option)
abstract int | setRemoteSubscribeFallbackOption (int option)
abstract int | setHighPriorityUserList (int[] uidList, int option)
abstract int | enableDualStreamMode (boolean enabled)
abstract int | enableDualStreamMode (boolean enabled, SimulcastStreamConfig streamConfig)
abstract int | setDualStreamMode (Constants.SimulcastStreamMode mode)
abstract int | setDualStreamMode (Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig)
abstract int | setSimulcastConfig (SimulcastConfig simulcastConfig)
abstract int | setLocalRenderTargetFps (Constants.VideoSourceType sourceType, int targetFps)
abstract int | setRemoteRenderTargetFps (int targetFps)
abstract int | setRemoteVideoStreamType (int uid, Constants.VideoStreamType streamType)
abstract int | setRemoteVideoStreamType (int uid, int streamType)
abstract int | setRemoteDefaultVideoStreamType (Constants.VideoStreamType streamType)
abstract int | setRemoteDefaultVideoStreamType (int streamType)
abstract int | setSubscribeAudioBlocklist (int[] uidList)
abstract int | setSubscribeAudioAllowlist (int[] uidList)
abstract int | setSubscribeVideoBlocklist (int[] uidList)
abstract int | setSubscribeVideoAllowlist (int[] uidList)
abstract int | enableEncryption (boolean enabled, EncryptionConfig config)
abstract int | startRtmpStreamWithoutTranscoding (String url)
abstract int | startRtmpStreamWithTranscoding (String url, LiveTranscoding transcoding)
abstract int | updateRtmpTranscoding (LiveTranscoding transcoding)
abstract int | stopRtmpStream (String url)
abstract int | createDataStream (boolean reliable, boolean ordered)
abstract int | createDataStream (DataStreamConfig config)
abstract int | sendStreamMessage (int streamId, byte[] message)
abstract int | setVideoQualityParameters (boolean preferFrameRateOverImageQuality)
abstract int | setLocalVideoMirrorMode (int mode)
abstract int | switchCamera ()
abstract int | switchCamera (String cameraId)
abstract boolean | isCameraZoomSupported ()
abstract boolean | isCameraTorchSupported ()
abstract boolean | isCameraFocusSupported ()
abstract boolean | isCameraExposurePositionSupported ()
abstract boolean | isCameraAutoFocusFaceModeSupported ()
abstract boolean | isCameraFaceDetectSupported ()
abstract boolean | isCameraExposureSupported ()
abstract int | setCameraZoomFactor (float factor)
abstract float | getCameraMaxZoomFactor ()
abstract int | setCameraFocusPositionInPreview (float positionX, float positionY)
abstract int | setCameraExposurePosition (float positionXinView, float positionYinView)
abstract int | enableFaceDetection (boolean enabled)
abstract int | setCameraTorchOn (boolean isOn)
abstract int | setCameraAutoFocusFaceModeEnabled (boolean enabled)
abstract int | setCameraExposureFactor (int factor)
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 | setLogLevel (int level)
abstract int | setLogFileSize (long fileSizeInKBytes)
abstract String | uploadLogFile ()
abstract int | writeLog (int level, String format, Object... args)
abstract long | getNativeHandle ()
void | addHandler (IRtcEngineEventHandler handler)
void | removeHandler (IRtcEngineEventHandler handler)
abstract boolean | enableHighPerfWifiMode (boolean enable)
abstract long | getNativeMediaPlayer (int sourceId)
abstract int | queryScreenCaptureCapability ()
abstract void | monitorHeadsetEvent (boolean monitor)
abstract void | monitorBluetoothHeadsetEvent (boolean monitor)
abstract void | setPreferHeadset (boolean enabled)
abstract int | setParameters (String parameters)
abstract String | getParameters (String parameters)
abstract String | getParameter (String parameter, String args)
abstract int | registerMediaMetadataObserver (IMetadataObserver observer, int type)
abstract int | unregisterMediaMetadataObserver (IMetadataObserver observer, int type)
abstract int | startOrUpdateChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration)
abstract int | stopChannelMediaRelay ()
abstract int | pauseAllChannelMediaRelay ()
abstract int | resumeAllChannelMediaRelay ()
abstract int | updateChannelMediaOptions (ChannelMediaOptions options)
abstract int | muteRecordingSignal (boolean muted)
abstract int | setPlaybackAudioFrameBeforeMixingParameters (int sampleRate, int channel)
abstract int | enableAudioSpectrumMonitor (int intervalInMS)
abstract int | disableAudioSpectrumMonitor ()
abstract int | registerAudioSpectrumObserver (IAudioSpectrumObserver observer)
abstract int | unRegisterAudioSpectrumObserver (IAudioSpectrumObserver observer)
abstract double | getEffectsVolume ()
abstract int | setEffectsVolume (double volume)
abstract int | preloadEffect (int soundId, String filePath)
abstract int | preloadEffect (int soundId, String filePath, int startPos)
abstract int | playEffect (int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish)
abstract int | playEffect (int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos)
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 | getEffectDuration (String filePath)
abstract int | setEffectPosition (int soundId, int pos)
abstract int | getEffectCurrentPosition (int soundId)
abstract int | registerVideoEncodedFrameObserver (IVideoEncodedFrameObserver receiver)
abstract int | registerFaceInfoObserver (IFaceInfoObserver receiver)
abstract int | takeSnapshot (int uid, String filePath)
abstract int | takeSnapshot (int uid, SnapshotConfig config)
abstract int | enableContentInspect (boolean enabled, ContentInspectConfig config)
abstract int | loadExtensionProvider (String path)
abstract int | registerExtension (String provider, String extension, Constants.MediaSourceType sourceType)
abstract int | enableExtension (String provider, String extension, boolean enable)
abstract int | enableExtension (String provider, String extension, boolean enable, Constants.MediaSourceType sourceType)
abstract int | setExtensionProperty (String provider, String extension, String key, String value)
abstract int | setExtensionProperty (String provider, String extension, String key, String value, Constants.MediaSourceType sourceType)
abstract String | getExtensionProperty (String provider, String extension, String key)
abstract String | getExtensionProperty (String provider, String extension, String key, Constants.MediaSourceType sourceType)
abstract int | setExtensionProviderProperty (String provider, String key, String value)
abstract int | enableExtension (String provider, String extension, ExtensionInfo extensionInfo, boolean enable)
abstract int | setExtensionProperty (String provider, String extension, ExtensionInfo extensionInfo, String key, String value)
abstract String | getExtensionProperty (String provider, String extension, ExtensionInfo extensionInfo, String key)
abstract int | startScreenCapture (ScreenCaptureParameters screenCaptureParameters)
abstract int | setExternalMediaProjection (MediaProjection mediaProjection)
abstract int | setScreenCaptureScenario (Constants.ScreenScenarioType screenScenario)
abstract int | stopScreenCapture ()
abstract int | setVideoScenario (Constants.VideoScenario scenarioType)
abstract int | setVideoQoEPreference (Constants.QoEPreference qoePreference)
abstract int | updateScreenCaptureParameters (ScreenCaptureParameters screenCaptureParameters)
abstract int | registerVideoFrameObserver (IVideoFrameObserver observer)
abstract IMediaPlayer | createMediaPlayer ()
abstract AgoraMediaRecorder | createMediaRecorder (RecorderStreamInfo info)
abstract void | destroyMediaRecorder (AgoraMediaRecorder mediaRecorder)
abstract IMediaPlayerCacheManager | getMediaPlayerCacheManager ()
abstract IH265Transcoder | getH265Transcoder ()
abstract int | enableExternalAudioSourceLocalPlayback (boolean enabled)
abstract int | adjustCustomAudioPublishVolume (int trackId, int volume)
abstract int | adjustCustomAudioPlayoutVolume (int trackId, int volume)
abstract int | startRhythmPlayer (String sound1, String sound2, AgoraRhythmPlayerConfig config)
abstract int | stopRhythmPlayer ()
abstract int | configRhythmPlayer (AgoraRhythmPlayerConfig config)
abstract int | setDirectCdnStreamingAudioConfiguration (int profile)
abstract int | setDirectCdnStreamingVideoConfiguration (VideoEncoderConfiguration config)
abstract long | getCurrentMonotonicTimeInMs ()
abstract int | startDirectCdnStreaming (IDirectCdnStreamingEventHandler eventHandler, String publishUrl, DirectCdnStreamingMediaOptions options)
abstract int | stopDirectCdnStreaming ()
abstract int | updateDirectCdnStreamingMediaOptions (DirectCdnStreamingMediaOptions options)
abstract int | createCustomVideoTrack ()
abstract int | createCustomEncodedVideoTrack (EncodedVideoTrackOptions encodedOpt)
abstract int | destroyCustomVideoTrack (int video_track_id)
abstract int | destroyCustomEncodedVideoTrack (int video_track_id)
abstract int | setCloudProxy (int proxyType)
abstract int | setLocalAccessPoint (LocalAccessPointConfiguration config)
abstract int | enableCustomAudioLocalPlayback (int trackId, boolean enabled)
abstract int | setAdvancedAudioOptions (AdvancedAudioOptions options)
abstract int | setAVSyncSource (String channelId, int uid)
abstract int | enableVideoImageSource (boolean enabled, ImageTrackOptions options)
abstract int | enableWirelessAccelerate (boolean enabled)
abstract int | getNetworkType ()
abstract long | getNtpWallTimeInMs ()
abstract int | startMediaRenderingTracing ()
| Start tracing media rendering events. More...
abstract int | enableInstantMediaRendering ()
| Enable instant media rendering. More...
abstract int | setupAudioAttributes (AudioAttributes attr)
abstract boolean | isFeatureAvailableOnDevice (int type)
| Whether the target feature is available for the device. More...
abstract int | sendAudioMetadata (byte[] metadata)
| Send audio metadata. More...

## 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 int | getRecommendedEncoderType ()
static String | getSdkVersion ()
static String | getMediaEngineVersion ()
static String | getErrorDescription (int error)

## Static Protected Attributes
static RtcEngineImpl | mInstance = null

## Detailed Description

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.

## Member Function Documentation

## ◆ create() [1/2]

static synchronized RtcEngine io.agora.rtc2.RtcEngine.create | ( | Context | context,
|  | String | appId,
|  | IRtcEngineEventHandler | handler
| ) |  | throws Exception
| 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.

Note
  - You must create an RtcEngine instance before calling any other method.
  - You can create an RtcEngine instance either by calling this method or by calling create2. The difference between create2 and this method is that create2 enables you to specify the connection area.
  - The Agora RTC Native SDK supports creating only one RtcEngine instance for an app for now.

Parameters

  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.

Returns
  - The RtcEngine instance, if the method call succeeds.
  - < 0, if the method call fails.

Exceptions

  Exception | Fails to create an RtcEngine instance.

## ◆ create() [2/2]

static synchronized RtcEngine io.agora.rtc2.RtcEngine.create | ( | RtcEngineConfig | config | ) | throws Exception
| static

Creates an RtcEngine instance.

The Agora Native SDK only supports one RtcEngine instance at a time, therefore the app should create one RtcEngine object only. Unless otherwise specified:

- All called methods provided by the RtcEngine class are executed asynchronously. We recommends calling these methods in the same thread.
- The following rule applies to all APIs whose return values are integer types:
  - 0: The method call succeeds.
  - < 0: The method call fails.

Note
  - Ensure that you call this method before calling any other API.
  - Only users with the same App ID can join the same channel and call each other.
  - An App ID can create only one RtcEngine object. For multiple App IDs in an app, you need to create multiple RtcEngine objects. Call destroy first to destroy the current RtcEngine instance before calling this method.

Parameters

  config | Configurations for the RtcEngine instance. For details, see {}. An RtcEngine object. Exception Fails to create an RtcEngine instance.

## ◆ destroy()

static synchronized void io.agora.rtc2.RtcEngine.destroy | ( |  | ) |
| 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.

Note
  - Do not immediately uninstall the SDK's dynamic library after the call, or it may crash because the SDK clean-up thread has not quit.
  - Call this method in the sub-thread.
  - Once the app destroys the created RtcEngine instance, you cannot use any method or callback in the SDK.

## ◆ setChannelProfile()

abstract int io.agora.rtc2.RtcEngine.setChannelProfile | ( | int | profile | ) |
| 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.

Note
  - To ensure the quality of real-time communication, we recommend that all users in a channel use the same channel profile.
  - Call this method before calling `joinChannel`. You cannot set the channel profile once you have joined the channel.

Parameters

  profile | The channel profile: `CHANNEL_PROFILE_COMMUNICATION`(0): Communication. Use this profile when there are two users in the channel. `CHANNEL_PROFILE_LIVE_BROADCASTING`(1): (Default) Live Broadcast.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setClientRole() [1/2]

abstract int io.agora.rtc2.RtcEngine.setClientRole | ( | int | role | ) |
| abstract

Sets the role of a user.

This method sets the user role as either BROADCASTER or AUDIENCE (default).

- The broadcaster sends and receives streams.
- The audience receives streams only.

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.

Note
  After calling the setClientRole() method to CLIENT_ROLE_AUDIENCE, the SDK stops audio recording. However, CLIENT_ROLE_AUDIENCE will keep audio recording with AUDIO_SCENARIO_CHATROOM(5). Normally, app developer can also use mute api to achieve the same result, and we implement this 'non-orthogonal' behavior only to make API backward compatible.

Parameters

  role | The role of the client: `CLIENT_ROLE_BROADCASTER`(1): The broadcaster. `CLIENT_ROLE_AUDIENCE(2)`: The audience.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setClientRole() [2/2]

abstract int io.agora.rtc2.RtcEngine.setClientRole | ( | int | role,
|  | ClientRoleOptions | options
| ) |  |
| abstract

Sets the role of a user (`LIVE_BROADCASTING` profile 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. In the `LIVE_BROADCASTING` profile, when a user switches user roles after joining a channel, a successful setClientRole method call triggers the following callbacks:

- The local client: onClientRoleChanged.
- The remote client: onUserJoined or {onUserOffline}(USER_OFFLINE_BECOME_AUDIENCE). role Sets the role of a user:`CLIENT_ROLE_BROADCASTER`(1): Host. A host can both send and receive streams.`CLIENT_ROLE_AUDIENCE`(2): Audience, the default role. An audience can only receive streams. options Client role options of a user, see #ClientRoleOptions. 0(ERR_OK): Success.< 0: Failure.-1(ERR_FAILED): A general error occurs (no specified reason).-2(ERR_INVALID_ARGUMENT): The parameter is invalid.-7(ERR_NOT_INITIALIZED): The SDK is not initialized.

## ◆ sendCustomReportMessage()

abstract int io.agora.rtc2.RtcEngine.sendCustomReportMessage | ( | String | id,
|  | String | category,
|  | String | event,
|  | String | label,
|  | int | value
| ) |  |
| 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.

## ◆ preloadChannel()

abstract int io.agora.rtc2.RtcEngine.preloadChannel | ( | String | token,
|  | String | channelName,
|  | int | optionalUid
| ) |  |
| abstract

Preload a channel.

This method enables users to preload a channel.

A successful call of this method will reduce the time of joining the same channel.

Note:

1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available.
2. Renew the token of the preloaded channel by calling this method with the same 'channelName' and 'uid'.

Parameters

  token | The token generated on your server for authentication.
  channelName | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  uid | The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 2<h>32</h>-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain the returned user ID, because the SDK does not do so.

Returns
  - 0: Success.
  - < 0: Failure.
    - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
    - -102: The channel name is invalid. You need to pass in a valid channel name in channelName to preload the channel again.

## ◆ preloadChannelWithUserAccount()

abstract int io.agora.rtc2.RtcEngine.preloadChannelWithUserAccount | ( | String | token,
|  | String | channelName,
|  | String | userAccount
| ) |  |
| abstract

Preload a channel.

This method enables users to preload a channel.

A successful call of this method will reduce the time of joining the same channel.

Note:

1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available.
2. Renew the token of the preloaded channel by calling this method with the same 'channelName' and 'userAccount'.

Parameters

  token | The token generated on your server for authentication.
  channelName | The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  userAccount | The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".

Returns
  - 0: Success.
  - < 0: Failure.
    - -2: The parameter is invalid. For example, the userAccount parameter is empty. You need to pass in a valid parameter and preload the channel again.
    - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
    - -102: The channel name is invalid. You need to pass in a valid channel name in channelName to preload the channel again.

## ◆ updatePreloadChannelToken()

abstract int io.agora.rtc2.RtcEngine.updatePreloadChannelToken | ( | String | token | ) |
| abstract

Update token of the preloaded channels.

An easy way to update all preloaded channels' tokens, if all preloaded channels use the same token.

If preloaded channels use different tokens, we need to call the 'preloadChannel' method with the same 'channelName' and 'uid' or 'userAccount' to update the corresponding token.

Parameters

  token | The token generated on your server for authentication.

Returns
  - 0: Success.
  - < 0: Failure.
    - -2: The token is invalid. You need to pass in a valid token and update the token again.
    - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.

## ◆ joinChannel() [1/2]

abstract int io.agora.rtc2.RtcEngine.joinChannel | ( | String | token,
|  | String | channelId,
|  | String | optionalInfo,
|  | int | uid
| ) |  |
| 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.

Note
  - This method allows you to join only one channel at a time.
  - A channel does not accept duplicate `uid`s, that is, two users with the same uid. If you set `uid` as 0, the system automatically assigns a user ID.
  - Ensure that the app ID you use to generate the token is the same app ID that you pass in the create method.

Parameters

  token | The token for authentication. In situations not requiring high security: You can use the temporary token generated at Console. For details, see Get a temporary token. In situations requiring high security: Set it as the token generated at you server. For details, see Generate a token.
  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: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  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.
  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ joinChannel() [2/2]

abstract int io.agora.rtc2.RtcEngine.joinChannel | ( | String | token,
|  | String | channelId,
|  | int | uid,
|  | ChannelMediaOptions | options
| ) |  |
| 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.

Note
  - This method allows you to join only one channel at a time.
  - A channel does not accept duplicate `uid`s, that is, two users with the same uid. If you set `uid` as 0, the system automatically assigns a user ID.
  - Ensure that the app ID you use to generate the token is the same app ID that you pass in the create method.

Parameters

  token | The token for authentication. In situations not requiring high security: You can use the temporary token generated at Console. For details, see Get a temporary token. In situations requiring high security: Set it as the token generated at you server. For details, see Generate a token.
  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: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ registerLocalUserAccount()

abstract int io.agora.rtc2.RtcEngine.registerLocalUserAccount | ( | String | appId,
|  | String | userAccount
| ) |  |
| abstract

Registers a user account.

Once registered, the user account can be used to identify the local user when the user joins the channel. After the user successfully registers a user account, the SDK triggers the onLocalUserRegistered callback on the local client, reporting the user ID and user account of the local user.

To join a channel with a user account, you can choose either of the following:

- Call the registerLocalUserAccount method to create a user account, and then the joinChannelWithUserAccount method to join the channel.
- Call the joinChannelWithUserAccount method to join the channel.

The difference between the two is that for the former, the time elapsed between calling the joinChannelWithUserAccount method and joining the channel is shorter than the latter.

Note
  - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect.
  - Ensure that the value of the `userAccount` parameter is unique in the channel.
  - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.

Parameters

  appId | The App ID of your project.
  userAccount | The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ joinChannelWithUserAccount() [1/2]

abstract int io.agora.rtc2.RtcEngine.joinChannelWithUserAccount | ( | String | token,
|  | String | channelName,
|  | String | userAccount
| ) |  |
| abstract

Joins the channel with a user account.

After the user successfully joins the channel, the SDK triggers the following callbacks:

- The local client: onLocalUserRegistered and onJoinChannelSuccess . The remote client: onUserJoined and onUserInfoUpdated , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile.

Note
  To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.

Parameters

  token | The token generated at your server: For low-security requirements: You can use the temporary token generated at Console. For details, see Get a temporary toke. For high-security requirements: Set it as the token generated at your server. For details, see Get a token.
  channelName | The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  userAccount | The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. The space character. Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  options | The channel media options: ChannelMediaOptions

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_INVALID_ARGUMENT (-2)
    - #ERR_NOT_READY (-3)
    - #ERR_REFUSED (-5)

## ◆ joinChannelWithUserAccount() [2/2]

abstract int io.agora.rtc2.RtcEngine.joinChannelWithUserAccount | ( | String | token,
|  | String | channelName,
|  | String | userAccount,
|  | ChannelMediaOptions | options
| ) |  |
| abstract

Joins the channel with a user account, and configures whether to automatically subscribe to audio or video streams after joining the channel.

Since
  v3.3.0.

After the user successfully joins the channel, the SDK triggers the following callbacks:

- The local client: onLocalUserRegistered and onJoinChannelSuccess.
- The remote client: onUserJoined and {onUserInfoUpdated}, if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. Compared with RtcEngine#joinChannelWithUserAccount(String token, String channelName, String userAccount) joinChannelWithUserAccount}[1/2], this method has the `options` parameter to configure whether the end user automatically subscribes to all remote audio and video streams in a channel when joining the channel. By default, the user subscribes to the audio and video streams of all the other users in the channel, thus incurring all associated usage costs. To unsubscribe, set the `options` parameter or call the `mute` methods accordingly.To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. token The token generated at your server. For details, see Generate a token.
  Parameters

    channelName | The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:

- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  Parameters

    userAccount | The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null.

- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  Parameters

    options | The channel media options: ChannelMediaOptions.

  Returns
- 0: Success.
- < 0: Failure.
  - ERR_INVALID_ARGUMENT(-2)
  - ERR_NOT_READY(-3)
  - ERR_REFUSED(-5)

## ◆ getUserInfoByUserAccount()

abstract int io.agora.rtc2.RtcEngine.getUserInfoByUserAccount | ( | String | userAccount,
|  | UserInfo | userInfo
| ) |  |
| abstract

Gets the user information by passing in the user account.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`userInfo`), and triggers the onUserInfoUpdated callback on the local client.

After receiving the oonUserInfoUpdated callback, you can call this method to get the user ID of the remote user from the `userInfo` object by passing in the user account.

Parameters

  userAccount | The user account of the user. Ensure that you set this parameter.
  userInfo | A userInfo object that identifies the user

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getUserInfoByUid()

abstract int io.agora.rtc2.RtcEngine.getUserInfoByUid | ( | int | uid,
|  | UserInfo | userInfo
| ) |  |
| abstract

Gets the user information by passing in the user ID.

After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`userInfo`), and triggers the onUserInfoUpdated callback on the local client.

After receiving the onUserInfoUpdated callback, you can call this method to get the user account of the remote user from the `userInfo` object by passing in the user ID.

Parameters

  uid | The user ID of the remote user. Ensure that you set this parameter.
  userInfo | A userInfo object that identifies the user

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ leaveChannel() [1/2]

abstract int io.agora.rtc2.RtcEngine.leaveChannel | ( |  | ) |
| 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.

Note
  If you call destroy immediately after this method, the leaveChannel process will be interrupted, and the SDK will not trigger the `onLeaveChannel` callback.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ leaveChannel() [2/2]

abstract int io.agora.rtc2.RtcEngine.leaveChannel | ( | LeaveChannelOptions | options | ) |
| abstract

Leaves the channel.

Parameters

  options | The leave channel options.

This method allows a user to leave the channel, for example, by hanging up or exiting a 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.

Note
  If you call release immediately after this method, the leaveChannel process will be interrupted, and the SDK will not trigger the `onLeaveChannel` callback.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ renewToken()

abstract int io.agora.rtc2.RtcEngine.renewToken | ( | String | token | ) |
| 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.

- The onTokenPrivilegeWillExpire callback is triggered;
- The onRequestToken callback is triggered;
- The `ERR_TOKEN_EXPIRED(-109)` error is reported.

Parameters

  token | The new token.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getAudioDeviceInfo()

abstract DeviceInfo io.agora.rtc2.RtcEngine.getAudioDeviceInfo | ( |  | ) |
| abstract

Gets the the Audio device Info

Returns
  deviceInfo
  - not null: Success.
  - null: Failure.

## ◆ enableWebSdkInteroperability()

abstract int io.agora.rtc2.RtcEngine.enableWebSdkInteroperability | ( | boolean | enabled | ) |
| 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.

Parameters

  enabled | Determines whether to enable interoperability with the Agora Web SDK. true: Enable interoperability with the Agora Native SDK. false: Disable interoperability with the Agora Native SDK.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getConnectionState()

abstract int io.agora.rtc2.RtcEngine.getConnectionState | ( |  | ) |
| abstract

Gets the connection state of the SDK.

Returns
  The connection state:
  - CONNECTION_STATE_DISCONNECTED(1): The SDK is disconnected from Agora's edge server.
  - CONNECTION_STATE_CONNECTING(2): The SDK is connecting to Agora's edge server.
  - CONNECTION_STATE_CONNECTED(3): The SDK joined a channel and is connected to Agora's 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.
  - CONNECTION_STATE_FAILED(5): The SDK fails to join the channel.

## ◆ enableAudio()

abstract int io.agora.rtc2.RtcEngine.enableAudio | ( |  | ) |
| abstract

Enables the audio.

The audio is enabled by default.

Note
  This method controls the underlying states of the Engine. It is still valid after one leaves channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ disableAudio()

abstract int io.agora.rtc2.RtcEngine.disableAudio | ( |  | ) |
| abstract

Disables the audio.

Note
  This method controls the underlying states of the Engine. It is still valid after one leaves channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pauseAudio()

abstract int io.agora.rtc2.RtcEngine.pauseAudio | ( |  | ) |
| abstract

Disables the audio function in the channel.

Note: This method controls the underlying states of the Engine. It is still valid after one leaves channel.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ resumeAudio()

abstract int io.agora.rtc2.RtcEngine.resumeAudio | ( |  | ) |
| abstract

Enables the audio function in the channel.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setAudioProfile() [1/2]

abstract int io.agora.rtc2.RtcEngine.setAudioProfile | ( | int | profile | ) |
| abstract

Sets the audio profile.

Note
  - Call this method before calling `joinChannel` method.
  - In scenarios requiring high-quality audio, Agora recommends setting `profile` as `MUSIC_HIGH_QUALITY`(4).
  - To set the audio scenario, call create2 and pass value in the `mAudioScenario` member.

Parameters

  profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See AudioProfile.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioProfile() [2/2]

abstract int io.agora.rtc2.RtcEngine.setAudioProfile | ( | int | profile,
|  | int | scenario
| ) |  |
| abstract

Sets the audio parameters and application scenarios.

Note
  - Call this method before calling `joinChannel`.
  - In scenarios requiring high-quality audio, we recommend setting `profile` as `MUSIC_HIGH_QUALITY`(4) and `scenario` as `AUDIO_SCENARIO_GAME_STREAMING`(3).

Parameters

  profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See AudioProfile.
  scenario | Sets the audio application scenarios. See AudioScenario.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setHighQualityAudioParameters()

abstract int io.agora.rtc2.RtcEngine.setHighQualityAudioParameters | ( | boolean | fullband,
|  | boolean | stereo,
|  | boolean | fullBitrate
| ) |  |
| abstract

Sets high-quality audio preferences.

Call this method and set all the modes before joining a channel. Do NOT call this method again after joining a channel.

Note: Agora does not recommend using this method. If you want to set the audio profile, see setAudioProfile.

Parameters

  fullband | Full-band codec (48 kHz sampling rate), not compatible with versions before v1.7.4. True: Enable full-band codec. False: Disable full-band codec.
  stereo | Stereo codec, not compatible with versions before v1.7.4. True: Enable stereo codec. False: Disable stereo codec.
  fullBitrate | High bitrate. Recommended in voice-only mode. True: Enable high bitrate mode. False: Disable high bitrate mode.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ adjustRecordingSignalVolume()

abstract int io.agora.rtc2.RtcEngine.adjustRecordingSignalVolume | ( | int | volume | ) |
| abstract

Adjusts the recording volume.

Parameters

  volume | Recording volume, ranges from 0 to 400: 0: Mute 100: Original volume 400: (Maximum) Four times the original volume with signal clipping protection

Returns
  - 0: Success.
  - <0: Failure.

## ◆ adjustPlaybackSignalVolume()

abstract int io.agora.rtc2.RtcEngine.adjustPlaybackSignalVolume | ( | int | volume | ) |
| abstract

Adjusts the playback volume.

Parameters

  volume | Playback volume, ranges from 0 to 400: 0: Mute 100: Original volume 400: (Maximum) Four times the original volume with signal clipping protection

Returns
  - 0: Success.
  - <0: Failure.

## ◆ enableAudioVolumeIndication()

abstract int io.agora.rtc2.RtcEngine.enableAudioVolumeIndication | ( | int | interval,
|  | int | smooth,
|  | boolean | reportVad
| ) |  |
| 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.

Parameters

  interval | Sets the time interval between two consecutive volume indications: <= 0: Disables the volume indication. > 0: Time interval (ms) between two consecutive volume indications, and should be integral multiple of 200 (less than 200 will be set to 200).
  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableLocalAudio()

abstract int io.agora.rtc2.RtcEngine.enableLocalAudio | ( | boolean | enabled | ) |
| 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.

Parameters

  enabled | Determines whether to disable or re-enable the local audio function: true: (Default) Re-enable the local audio function, that is, to start local audio capture and processing. false: Disable the local audio function, that is, to stop local audio capture and processing.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteLocalAudioStream()

abstract int io.agora.rtc2.RtcEngine.muteLocalAudioStream | ( | boolean | muted | ) |
| abstract

Stops or resumes sending the local audio stream.

Parameters

  muted | Determines whether to send or stop sending the local audio stream: true: Stop sending the local audio stream. false: (Default) Send the local audio stream.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteRemoteAudioStream()

abstract int io.agora.rtc2.RtcEngine.muteRemoteAudioStream | ( | int | uid,
|  | boolean | muted
| ) |  |
| 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.

Parameters

  uid | The ID of the specified user.
  muted | Whether to stop receiving the audio stream of the specified user: true: Stop receiving the specified audio stream. false: (Default) Receive the specified audio stream.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ adjustUserPlaybackSignalVolume()

abstract int io.agora.rtc2.RtcEngine.adjustUserPlaybackSignalVolume | ( | int | uid,
|  | int | volume
| ) |  |
| abstract

Adjust the playback volume of the user specified by uid.

You can call this method to adjust the playback volume of the user specified by uid in call. If you want to adjust playback volume of the multi user, you can call this this method multi times.

Note
  Please call this method after join channel. This method adjust the playback volume of specified user.

Parameters

  uid | Remote user ID.
  volume | The playback volume, range is [0,100]: 0: mute, 100: The original volume

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteAllRemoteAudioStreams()

abstract int io.agora.rtc2.RtcEngine.muteAllRemoteAudioStreams | ( | boolean | muted | ) |
| 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.

- Ensure that you call this method after joining a channel.
- If you call `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.
- If you call `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:

- To resume receiving all remote audio streams, call `muteAllRemoteAudioStreams(false)`.
- To resume receiving the audio stream of a specified user, call `muteRemoteAudioStream(uid, false)`, where `uid` is the ID of the user whose audio stream you want to resume receiving.

Note
  - The result of calling this method is affected by calling `enableAudio` and `disableAudio`. Settings in `muteAllRemoteAudioStreams` stop taking effect if either of the following occurs:
    - Calling `enableAudio` after `muteAllRemoteAudioStreams(true)`.
    - Calling `disableAudio` after `muteAllRemoteAudioStreams(false)`.
  - This method only works for the channel created by calling `joinChannel`. To set whether to receive remote audio streams for a specific channel, Agora recommends using `autoSubscribeAudio` in the `ChannelMediaOptions` class.

Parameters

  muted | Whether to stop receiving remote audio streams: true: Stop receiving any remote audio stream. false: (Default) Resume receiving all remote audio streams.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableVideo()

abstract int io.agora.rtc2.RtcEngine.enableVideo | ( |  | ) |
| 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.

Note
  This method controls the underlying states of the Engine. It is still valid after one leaves the channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ disableVideo()

abstract int io.agora.rtc2.RtcEngine.disableVideo | ( |  | ) |
| 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).

Returns

- 0: Success.
- < 0: Failure.

## ◆ setVideoEncoderConfiguration()

abstract int io.agora.rtc2.RtcEngine.setVideoEncoderConfiguration | ( | VideoEncoderConfiguration | config | ) |
| 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.

Parameters

  config | The local video encoder configuration: VideoEncoderConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ queryCodecCapability()

abstract CodecCapInfo [] io.agora.rtc2.RtcEngine.queryCodecCapability | ( |  | ) |
| abstract

queryCodecCapability. query current device codec capacity. and will return actual codecCapInfo.

## ◆ queryDeviceScore()

abstract int io.agora.rtc2.RtcEngine.queryDeviceScore | ( |  | ) |
| abstract

Queries the score of the current device.

Returns

  > 0: The score of the current device. Most devices score between 60-100, with higher scores

  indicating better performance.

< 0: Failure.

## ◆ queryCameraFocalLengthCapability()

abstract AgoraFocalLengthInfo [] io.agora.rtc2.RtcEngine.queryCameraFocalLengthCapability | ( |  | ) |
| abstract

Query all focal attributes supported by the camera.

Returns
  - AgoraFocalLengthInfo: The camera supports the collection of focal segments.

## ◆ setCameraCapturerConfiguration()

abstract int io.agora.rtc2.RtcEngine.setCameraCapturerConfiguration | ( | CameraCapturerConfiguration | config | ) |
| abstract

Sets the camera capturer configuration.

Parameters

  config | The camera capturer configuration. For details, see {CameraCapturerConfiguration}. Call this method before enabling the local camera. That said, you can call this method before calling RtcEngine#joinChannel joinChannel}, RtcEngine#enableVideo enableVideo}, or RtcEngine#enableLocalVideo enableLocalVideo}, depending on which method you use to turn on your local camera. 0: Success.< 0: Failure.

## ◆ setupLocalVideo()

abstract int io.agora.rtc2.RtcEngine.setupLocalVideo | ( | VideoCanvas | local | ) |
| 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`.

Note
  Call this method before joining a channel.

Parameters

  local | The local video view setting: VideoCanvas.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setupRemoteVideo()

abstract int io.agora.rtc2.RtcEngine.setupRemoteVideo | ( | VideoCanvas | remote | ) |
| 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`.

Note
  Ensure that you call this method in the UI thread.

Parameters

  remote | The remote video view settings: VideoCanvas.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteRenderMode() [1/2]

abstract int io.agora.rtc2.RtcEngine.setRemoteRenderMode | ( | int | uid,
|  | int | renderMode
| ) |  |
| 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.

Note
  - Ensure that you have called setupRemoteVideo to initialize the remote video view before calling this method.
  - During a call, you can call this method as many times as necessary to update the display mode of the video view of a remote user.

Parameters

  uid | ID of the remote user.
  renderMode | Sets the remote display mode: `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLocalRenderMode() [1/2]

abstract int io.agora.rtc2.RtcEngine.setLocalRenderMode | ( | int | renderMode | ) |
| 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.

Note
  - Ensure that you have called setupLocalVideo to initialize the local video view before this method.
  - During a call, you can call this method as many times as necessary to update the local video view.

Parameters

  renderMode | Sets the local display mode: `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteRenderMode() [2/2]

abstract int io.agora.rtc2.RtcEngine.setRemoteRenderMode | ( | int | uid,
|  | int | renderMode,
|  | int | mirrorMode
| ) |  |
| 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.

Note
  - Ensure that you have called setupRemoteVideo to initialize the remote video view before calling this method.
  - During a call, you can call this method as many times as necessary to update the display mode of the video view of a remote user.

Parameters

  uid | ID of the remote user.
  renderMode | Sets the remote display mode: `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.
  mirrorMode | Sets the remote video mirror mode: `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode. `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLocalRenderMode() [2/2]

abstract int io.agora.rtc2.RtcEngine.setLocalRenderMode | ( | int | renderMode,
|  | int | mirrorMode
| ) |  |
| 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.

Note
  - Ensure that you have called setupLocalVideo to initialize the local video view before this method.
  - During a call, you can call this method as many times as necessary to update the local video view.

Parameters

  renderMode | Sets the local display mode: `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.
  mirrorMode | Sets the local video mirror mode: `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK. If you use the front camera, the SDK enables the mirror mode; if you use the rear camera, the SDK disables the mirror mode. `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode. `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startPreview() [1/2]

abstract int io.agora.rtc2.RtcEngine.startPreview | ( |  | ) |
| 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.

Returns
  - 0: Success.
  - <0: Failure.
    - ERR_NOT_INITIALIZED(-7).
    - ERR_INVALID_STATE(-8)

## ◆ startPreview() [2/2]

abstract int io.agora.rtc2.RtcEngine.startPreview | ( | Constants.VideoSourceType | sourceType | ) |
| abstract

Starts the local video preview before joining a channel.

Parameters

  sourceType | - The video source type.

## ◆ stopPreview() [1/2]

abstract int io.agora.rtc2.RtcEngine.stopPreview | ( |  | ) |
| abstract

Stops the local video preview and the video.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopPreview() [2/2]

abstract int io.agora.rtc2.RtcEngine.stopPreview | ( | Constants.VideoSourceType | sourceType | ) |
| abstract

Stops the local video preview and the video.

Parameters

  sourceType | - The video source type.

## ◆ enableLocalVideo()

abstract int io.agora.rtc2.RtcEngine.enableLocalVideo | ( | boolean | enabled | ) |
| 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.

Note
  Call this method after `enableVideo`. Otherwise, this method may not work properly.

Parameters

  enabled | Determines whether to disable or re-enable the local video, including the capturer, renderer, and sender: true: (Default) Re-enable the local video. false: Disable the local video. Once the local video is disabled, the remote users can no longer receive the video stream of this user, while this user can still receive the video streams of other remote users. When you set `enabled` as `false`, this method does not require a local camera.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startCameraCapture()

abstract int io.agora.rtc2.RtcEngine.startCameraCapture | ( | Constants.VideoSourceType | sourceType,
|  | CameraCapturerConfiguration | config
| ) |  |
| abstract

Starts video capture with a specified camera.

Parameters

  sourceType | - The video source type.
  config | - Camera capture configuration. See #CameraCapturerConfiguration.

## ◆ stopCameraCapture()

abstract int io.agora.rtc2.RtcEngine.stopCameraCapture | ( | Constants.VideoSourceType | sourceType | ) |
| abstract

Stops video capture with a specified camera.

Parameters

  sourceType | - The video source type.

## ◆ startLocalVideoTranscoder()

abstract int io.agora.rtc2.RtcEngine.startLocalVideoTranscoder | ( | LocalTranscoderConfiguration | config | ) |
| abstract

Starts the local video with a transcoding video stream.

Parameters

  config | Sets the transcoding video stream layout settings. See LocalTranscoderConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ stopLocalVideoTranscoder()

abstract int io.agora.rtc2.RtcEngine.stopLocalVideoTranscoder | ( |  | ) |
| abstract

Stops a transcoding video stream.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ updateLocalTranscoderConfiguration()

abstract int io.agora.rtc2.RtcEngine.updateLocalTranscoderConfiguration | ( | LocalTranscoderConfiguration | config | ) |
| abstract

Update the video layout settings for the transcoding video stream.

Parameters

  config | Update the transcoding video stream layout settings. See LocalTranscoderConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ startLocalAudioMixer()

abstract int io.agora.rtc2.RtcEngine.startLocalAudioMixer | ( | LocalAudioMixerConfiguration | config | ) |
| abstract

Starts the local audio with a mixed audio stream.

Parameters

  config | Sets the mixed audio stream source settings.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ updateLocalAudioMixerConfiguration()

abstract int io.agora.rtc2.RtcEngine.updateLocalAudioMixerConfiguration | ( | LocalAudioMixerConfiguration | config | ) |
| abstract

Update the source stream settings for the mixed audio stream.

Parameters

  config | Update the source audio stream settings. See

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ stopLocalAudioMixer()

abstract int io.agora.rtc2.RtcEngine.stopLocalAudioMixer | ( |  | ) |
| abstract

Stops a mixed audio track.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.

## ◆ muteLocalVideoStream()

abstract int io.agora.rtc2.RtcEngine.muteLocalVideoStream | ( | boolean | muted | ) |
| abstract

Stops or resumes sending the local video stream.

Parameters

  muted | Determines whether to send or stop sending the local video stream: true: Stop sending the local video stream. false: (Default) Send the local video stream.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteRemoteVideoStream()

abstract int io.agora.rtc2.RtcEngine.muteRemoteVideoStream | ( | int | uid,
|  | boolean | muted
| ) |  |
| 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.

Parameters

  uid | The ID of the specified user.
  muted | Whether to stop receiving the video stream of the specified user: true: Stop receiving the video stream of the specified user. false: (Default) Resume receiving the video stream of the specified user.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteAllRemoteVideoStreams()

abstract int io.agora.rtc2.RtcEngine.muteAllRemoteVideoStreams | ( | boolean | muted | ) |
| 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. Ensure that you call this method after joining a channel.

- If you call `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.
- If you call `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:

- To resume receiving all remote video streams, call `muteAllRemoteVideoStreams(false)`.
- To resume receiving the video stream of a specified user, call `muteRemoteVideoStream(uid, false)`, where `uid` is the ID of the user whose video stream you want to resume receiving.

Note
  - The result of calling this method is affected by calling `enableVideo` and `disableVideo`. Settings in `muteAllRemoteVideoStreams` stop taking effect if either of the following occurs:
    - Calling `enableVideo` after `muteAllRemoteVideoStreams(true)`.
    - Calling `disableVideo` after `muteAllRemoteVideoStreams(false)`.
  - This method only works for the channel created by calling `joinChannel`. To set whether to receive remote audio streams for a specific channel, Agora recommends using `autoSubscribeVideo` in the ChannelMediaOptions class.

Parameters

  muted | Whether to stop receiving remote video streams: true: Stop receiving any remote video stream. false: (Default) RResume receiving all remote video streams.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setBeautyEffectOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setBeautyEffectOptions | ( | boolean | enabled,
|  | BeautyOptions | options
| ) |  |
| abstract

Enables/Disables image enhancement and sets the options.

Since
  v2.4.0.

Note
  - Call this method after calling enableVideo.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable image enhancement: `true`: Enables image enhancement. `false`: Disables image enhancement.
  options | The image enhancement options. See BeautyOptions.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ setBeautyEffectOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setBeautyEffectOptions | ( | boolean | enabled,
|  | BeautyOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Enables/Disables image enhancement and sets the options.

Since
  v2.4.0.

Note
  - Call this method after calling enableVideo.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable image enhancement: `true`: Enables image enhancement. `false`: Disables image enhancement.
  options | The image enhancement options. See BeautyOptions.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. 0: Success.< 0: Failure.ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ setFaceShapeBeautyOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setFaceShapeBeautyOptions | ( | boolean | enabled,
|  | FaceShapeBeautyOptions | options
| ) |  |
| abstract

Enables/Disables face shape and sets the beauty options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable face shape: `true`: Enables face shape. `false`: Disables face shape.
  options | The face shape beauty options. See {FaceShapeBeautyOptions}. 0: Success.< 0: Failure.ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ setFaceShapeBeautyOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setFaceShapeBeautyOptions | ( | boolean | enabled,
|  | FaceShapeBeautyOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Enables/Disables face shape and sets the beauty options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable face shape: `true`: Enables face shape. `false`: Disables face shape.
  options | The face shape beauty options. See {FaceShapeBeautyOptions}. sourceType The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See { Constants#MediaSourceType}. 0: Success.< 0: Failure.ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ getFaceShapeBeautyOptions() [1/2]

abstract FaceShapeBeautyOptions io.agora.rtc2.RtcEngine.getFaceShapeBeautyOptions | ( |  | ) |
| abstract

Gets the face shape beauty options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Returns
  FaceShapeBeautyOptions

## ◆ getFaceShapeBeautyOptions() [2/2]

abstract FaceShapeBeautyOptions io.agora.rtc2.RtcEngine.getFaceShapeBeautyOptions | ( | Constants.MediaSourceType | sourceType | ) |
| abstract

Gets the face shape beauty options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Parameters

  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. FaceShapeBeautyOptions

## ◆ setFaceShapeAreaOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setFaceShapeAreaOptions | ( | FaceShapeAreaOptions | options | ) |
| abstract

Sets the face shape area options. @technical preview

Note
  - Call this method after calling setFaceShapeBeautyOptions.
  - This method applies to Android 4.4 or later.

Parameters

  options | The face shape area options. See FaceShapeAreaOptions.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ setFaceShapeAreaOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setFaceShapeAreaOptions | ( | FaceShapeAreaOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets the face shape area options. @technical preview

Note
  - Call this method after calling setFaceShapeBeautyOptions.
  - This method applies to Android 4.4 or later.

Parameters

  options | The face shape area options. See FaceShapeAreaOptions.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. 0: Success.< 0: Failure.ERR_NOT_SUPPORTED(4): The system version is earlier than Android 4.4, which does not support this function.

## ◆ getFaceShapeAreaOptions() [1/2]

abstract FaceShapeAreaOptions io.agora.rtc2.RtcEngine.getFaceShapeAreaOptions | ( | int | shapeArea | ) |
| abstract

Gets the face shape area options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Parameters

  shapeArea | The face shape area. See io.agora.rtc2.video.FaceShapeAreaOptions.

Returns
  FaceShapeAreaOptions

## ◆ getFaceShapeAreaOptions() [2/2]

abstract FaceShapeAreaOptions io.agora.rtc2.RtcEngine.getFaceShapeAreaOptions | ( | int | shapeArea,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Gets the face shape area options. @technical preview

Note
  - Call this method after calling the enableVideo method.
  - This method applies to Android 4.4 or later.

Parameters

  shapeArea | The face shape area. See io.agora.rtc2.video.FaceShapeAreaOptions.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. FaceShapeAreaOptions

## ◆ setFilterEffectOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setFilterEffectOptions | ( | boolean | enabled,
|  | FilterEffectOptions | options
| ) |  |
| abstract

Sets filter effect option.

Since
  v4.4.1

You can call this method to enable the filter effect feature and set the options of the filter effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after calling the enableVideo method.
  - You can call this method either before or after joining a channel.
  - The filter effect feature has specific performance requirements for devices. If your device overheats after enabling the filter effect, Agora recommends disabling it entirely.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable filter beauty: `true`: Enabled. `false`: (Default) Disabled.
  options | The filter effect options. See {FilterEffectOptions}. 0: Success.< 0: Failure.

## ◆ setFilterEffectOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setFilterEffectOptions | ( | boolean | enabled,
|  | FilterEffectOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets filter effect option.

Since
  v4.4.1.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after calling the enableVideo method.
  - You can call this method either before or after joining a channel.
  - The filter effect feature has specific performance requirements for devices. If your device overheats after enabling the filter effect, Agora recommends disabling it entirely.
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Whether to enable filter beauty: `true`: Enabled. `false`: (Default) Disabled.
  options | The filter effect options. See {FilterEffectOptions}. sourceType The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See { Constants#MediaSourceType}. 0: Success.< 0: Failure.

## ◆ setLowlightEnhanceOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setLowlightEnhanceOptions | ( | boolean | enabled,
|  | LowLightEnhanceOptions | options
| ) |  |
| abstract

Sets low-light enhancement.

Since
  v3.6.2

The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video.

You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely.

Parameters

  enabled | Sets whether to enable low-light enhancement: `true`: Enable. `false`: (Default) Disable.
  options | The low-light enhancement options. See {LowLightEnhanceOptions}. 0: Success.< 0: Failure.

## ◆ setLowlightEnhanceOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setLowlightEnhanceOptions | ( | boolean | enabled,
|  | LowLightEnhanceOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets low-light enhancement.

Since
  v3.6.2

The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video.

You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely.

Parameters

  enabled | Sets whether to enable low-light enhancement: `true`: Enable. `false`: (Default) Disable.
  options | The low-light enhancement options. See {LowLightEnhanceOptions}. sourceType The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See { Constants#MediaSourceType}. 0: Success.< 0: Failure.

## ◆ setVideoDenoiserOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setVideoDenoiserOptions | ( | boolean | enabled,
|  | VideoDenoiserOptions | options
| ) |  |
| abstract

Sets video noise reduction.

Since
  v3.6.2

Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding.

You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely.

Parameters

  enabled | Sets whether to enable video noise reduction: `true`: Enable. `false`: (Default) Disable.
  options | The video noise reduction options. See {VideoDenoiserOptions}. 0: Success.< 0: Failure.

## ◆ setVideoDenoiserOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setVideoDenoiserOptions | ( | boolean | enabled,
|  | VideoDenoiserOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets video noise reduction.

Since
  v3.6.2

Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding.

You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely.

Parameters

  enabled | Sets whether to enable video noise reduction: `true`: Enable. `false`: (Default) Disable.
  options | The video noise reduction options. See {VideoDenoiserOptions}. sourceType The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See { Constants#MediaSourceType}. 0: Success.< 0: Failure.

## ◆ setColorEnhanceOptions() [1/2]

abstract int io.agora.rtc2.RtcEngine.setColorEnhanceOptions | ( | boolean | enabled,
|  | ColorEnhanceOptions | options
| ) |  |
| abstract

Sets color enhancement.

Since
  v3.6.2

The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid.

You can call this method to enable the color enhancement feature and set the options of the color enhancement effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely.

Parameters

  enabled | Sets whether to enable color enhancement: `true`: Enable. `false`: (Default) Disable.
  options | The color enhancement options. See ColorEnhanceOptions.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setColorEnhanceOptions() [2/2]

abstract int io.agora.rtc2.RtcEngine.setColorEnhanceOptions | ( | boolean | enabled,
|  | ColorEnhanceOptions | options,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets color enhancement.

Since
  v3.6.2

The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid.

You can call this method to enable the color enhancement feature and set the options of the color enhancement effect.

Note
  - Before calling this method, ensure that you have integrated the `libagora_clear_vision_extension.so` dynamic library.
  - Call this method after enableVideo.
  - The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely.

Parameters

  enabled | Sets whether to enable color enhancement: `true`: Enable. `false`: (Default) Disable.
  options | The color enhancement options. See ColorEnhanceOptions.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. 0: Success.< 0: Failure.

## ◆ enableVirtualBackground() [1/2]

abstract int io.agora.rtc2.RtcEngine.enableVirtualBackground | ( | boolean | enabled,
|  | VirtualBackgroundSource | backgroundSource,
|  | SegmentationProperty | segproperty
| ) |  |
| abstract

Enables/Disables portrait segmentation and repalce the background(not portrait area) with specified source.

Note
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Sets whether or not to enable capture image background subtitution: true: enables background subtitution. false: disables background subtitution.
  backgroundSource | Sets the background source data. See {VirtualBackgroundSource}. segproperty 0: Success.< 0: Failure. VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3,

## ◆ enableVirtualBackground() [2/2]

abstract int io.agora.rtc2.RtcEngine.enableVirtualBackground | ( | boolean | enabled,
|  | VirtualBackgroundSource | backgroundSource,
|  | SegmentationProperty | segproperty,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Enables/Disables portrait segmentation and repalce the background(not portrait area) with specified source.

Note
  - This method applies to Android 4.4 or later.

Parameters

  enabled | Sets whether or not to enable capture image background subtitution: true: enables background subtitution. false: disables background subtitution.
  VirtualBackgroundSource | Sets the background source data. See {VirtualBackgroundSource}. SegmentationProperty sourceType The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See { Constants#MediaSourceType}. 0: Success.< 0: Failure. VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3,

## ◆ setDefaultAudioRoutetoSpeakerphone()

abstract int io.agora.rtc2.RtcEngine.setDefaultAudioRoutetoSpeakerphone | ( | boolean | defaultToSpeaker | ) |
| 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:

- Voice call: Earpiece.
- Video call: Speakerphone.
- Audio broadcast: Speakerphone.
- Video broadcast: Speakerphone.

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.

Note
  The system audio route changes when an external audio device, such as a headphone or a Bluetooth audio device, is connected. See Principles for Changing the Audio Route.

Parameters

  defaultToSpeaker | Whether to set the speakerphone as the default audio route: true: Set the speakerphone as the default audio route. false: Do not set the speakerphone as the default audio route.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setEnableSpeakerphone()

abstract int io.agora.rtc2.RtcEngine.setEnableSpeakerphone | ( | boolean | enabled | ) |
| 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. This method sets the audio route temporarily. Plugging in or unplugging a headphone, or the SDK re-enabling the audio device module (ADM) to adjust the media volume in some scenarios relating to audio, leads to a change in the audio route. See Principles for Changing the Audio Route. enabled Whether to set the speakerphone as the temporary audio route:true: Set the speakerphone as the audio route temporarily.false: Do not set the speakerphone as the audio route. 0: Success.<0: Failure.

## ◆ setRouteInCommunicationMode()

abstract int io.agora.rtc2.RtcEngine.setRouteInCommunicationMode | ( | int | route | ) |
| abstract

Select preferred route in android communication mode.

Parameters

  route | The preferred route. For example, when a Bluetooth headset is connected, you can use this API to switch the route to a wired headset.

Returns
  meanless, route switch result is pass through CallbackOnRoutingChanged

## ◆ isSpeakerphoneEnabled()

abstract boolean io.agora.rtc2.RtcEngine.isSpeakerphoneEnabled | ( |  | ) |
| abstract

Checks whether the speakerphone is enabled.

Returns
  - true: The speakerphone is enabled, and the audio plays from the speakerphone.
  - false: The speakerphone is not enabled, and the audio plays from devices other than the speakerphone. For example, the headset or earpiece.

## ◆ enableInEarMonitoring() [1/2]

abstract int io.agora.rtc2.RtcEngine.enableInEarMonitoring | ( | boolean | enabled | ) |
| abstract

Enables in-ear monitoring.

Parameters

  enabled | Determines whether to enable in-ear monitoring. true: Enable in-ear monitoring. false: Disable in-ear monitoring.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableInEarMonitoring() [2/2]

abstract int io.agora.rtc2.RtcEngine.enableInEarMonitoring | ( | boolean | enabled,
|  | int | includeAudioFilters
| ) |  |
| abstract

Enables in-ear monitoring.

Parameters

  enabled | Determines whether to enable in-ear monitoring. true: Enable in ear monitoring. false: Disable in ear monitoring.
  includeAudioFilters | The type of the ear monitoring

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setInEarMonitoringVolume()

abstract int io.agora.rtc2.RtcEngine.setInEarMonitoringVolume | ( | int | volume | ) |
| abstract

Sets the volume of the in-ear monitoring.

Parameters

  volume | The volume of the in-ear monitor, ranging from 0 to 100. The default value is 100.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLocalVoicePitch()

abstract int io.agora.rtc2.RtcEngine.setLocalVoicePitch | ( | double | pitch | ) |
| abstract

Sets the voice pitch of the local speaker.

Parameters

  pitch | Voice frequency, in the range of 0.5 to 2.0. The default value is 1.0.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setLocalVoiceFormant()

abstract int io.agora.rtc2.RtcEngine.setLocalVoiceFormant | ( | double | formantRatio | ) |
| abstract

Sets the voice formant ratio for local speaker.

Parameters

  formantRatio | Voice frequency, in the range of -1.0 to 1.0. The default value is 0.0.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setLocalVoiceEqualization()

abstract int io.agora.rtc2.RtcEngine.setLocalVoiceEqualization | ( | Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY | bandFrequency,
|  | int | bandGain
| ) |  |
| abstract

Sets the local voice equalization effect.

Parameters

  bandFrequency | The band frequency ranging from 0 to 9; representing the respective 10-band center frequencies of voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. Constants#AUDIO_EQUALIZATION_BAND_FREQUENCY
  bandGain | Gain of each band in dB; ranging from -15 to 15.

## ◆ setLocalVoiceReverb()

abstract int io.agora.rtc2.RtcEngine.setLocalVoiceReverb | ( | Constants.AUDIO_REVERB_TYPE | reverbKey,
|  | int | value
| ) |  |
| abstract

Sets the local voice reverberation.

Parameters

  reverbKey | The reverberation key. This method contains five reverberation keys. For details, see the description of each value.
  value | Local voice reverberation value: AUDIO_REVERB_DRY_LEVEL(0) AUDIO_REVERB_WET_LEVEL(1) AUDIO_REVERB_ROOM_SIZE(2) AUDIO_REVERB_WET_DELAY(3) AUDIO_REVERB_STRENGTH(4)

## ◆ setHeadphoneEQPreset()

abstract int io.agora.rtc2.RtcEngine.setHeadphoneEQPreset | ( | int | preset | ) |
| abstract

Sets preset audio playback effect for remote headphones after remote audio is mixed.

Parameters

  preset | The preset key: #HEADPHONE_EQUALIZER_PRESET. HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones. HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only. HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only.

Returns
  - 0: Success.
  - < 0: Failure.
    - -1(ERR_FAILED): A general error occurs (no specified reason).

## ◆ setHeadphoneEQParameters()

abstract int io.agora.rtc2.RtcEngine.setHeadphoneEQParameters | ( | int | lowGain,
|  | int | highGain
| ) |  |
| abstract

Sets the parameters of audio playback effect for remote headphones after remote audio is mixed.

Parameters

  lowGain | The higher the parameter value, the deeper the sound. The value range is [-10,10].
  highGain | The higher the parameter value, the sharper the sound. The value range is [-10,10].

Returns
  - 0: Success.
  - < 0: Failure.
    - -1(ERR_FAILED): A general error occurs (no specified reason).

## ◆ setAudioEffectPreset()

abstract int io.agora.rtc2.RtcEngine.setAudioEffectPreset | ( | int | preset | ) |
| abstract

Sets an SDK preset audio effect.

Since
  v3.2.0

Call this method to set an SDK preset audio effect for the local user who sends an audio stream. This audio effect does not change the gender characteristics of the original voice. After setting an audio effect, all users in the channel can hear the effect.

You can set different audio effects for different scenarios. See Set the Voice Effect.

To achieve better audio effect quality, Agora recommends calling {setAudioProfile} and setting the `scenario` parameter to `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. You can call this method either before or after joining a channel.Do not set the profile parameter of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)`; otherwise, this method call does not take effect.This method works best with the human voice. Agora does not recommend using this method for audio containing music.If you call this method and set the preset parameter to enumerators except `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call setAudioEffectParameters setAudioEffectParameters}; otherwise, `setAudioEffectParameters` overrides this method.After calling this method, Agora recommends not calling the following methods, because they can override `setAudioEffectPreset`: RtcEngine#setVoiceBeautifierPreset setVoiceBeautifierPreset} RtcEngine#setLocalVoicePitch setLocalVoicePitch} RtcEngine#setLocalVoiceFormant setLocalVoiceFormant} RtcEngine#setLocalVoiceEqualization setLocalVoiceEqualization} RtcEngine#setLocalVoiceReverb setLocalVoiceReverb} RtcEngine#setVoiceBeautifierParameters setVoiceBeautifierParameters} preset The options for SDK preset audio effects Constants#AUDIO_EFFECT_OFF AUDIO_EFFECT_OFF} Constants#ROOM_ACOUSTICS_KTV ROOM_ACOUSTICS_KTV} Constants#ROOM_ACOUSTICS_VOCAL_CONCERT ROOM_ACOUSTICS_VOCAL_CONCERT} Constants#ROOM_ACOUSTICS_STUDIO ROOM_ACOUSTICS_STUDIO} Constants#ROOM_ACOUSTICS_PHONOGRAPH ROOM_ACOUSTICS_PHONOGRAPH} Constants#ROOM_ACOUSTICS_VIRTUAL_STEREO ROOM_ACOUSTICS_VIRTUAL_STEREO} Constants#ROOM_ACOUSTICS_SPACIAL ROOM_ACOUSTICS_SPACIAL} Constants#ROOM_ACOUSTICS_ETHEREAL ROOM_ACOUSTICS_ETHEREAL} Constants#ROOM_ACOUSTICS_3D_VOICE ROOM_ACOUSTICS_3D_VOICE} Constants#ROOM_ACOUSTICS_CHORUS ROOM_ACOUSTICS_CHORUS} Constants#VOICE_CHANGER_EFFECT_UNCLE VOICE_CHANGER_EFFECT_UNCLE} Constants#VOICE_CHANGER_EFFECT_OLDMAN VOICE_CHANGER_EFFECT_OLDMAN} Constants#VOICE_CHANGER_EFFECT_BOY VOICE_CHANGER_EFFECT_BOY} Constants#VOICE_CHANGER_EFFECT_SISTER VOICE_CHANGER_EFFECT_SISTER} Constants#VOICE_CHANGER_EFFECT_GIRL VOICE_CHANGER_EFFECT_GIRL} Constants#VOICE_CHANGER_EFFECT_PIGKING VOICE_CHANGER_EFFECT_PIGKING} Constants#VOICE_CHANGER_EFFECT_HULK VOICE_CHANGER_EFFECT_HULK} Constants#STYLE_TRANSFORMATION_RNB STYLE_TRANSFORMATION_RNB} Constants#STYLE_TRANSFORMATION_POPULAR STYLE_TRANSFORMATION_POPULAR} Constants#PITCH_CORRECTION PITCH_CORRECTION} 0: Success.< 0: Failure.

## ◆ setVoiceBeautifierPreset()

abstract int io.agora.rtc2.RtcEngine.setVoiceBeautifierPreset | ( | int | preset | ) |
| abstract

Sets an SDK preset voice beautifier effect.

Since
  v3.2.0

Call this method to set an SDK preset voice beautifier effect for the local user who sends an audio stream. After setting a voice beautifier effect, all users in the channel can hear the effect.

You can set different voice beautifier effects for different scenarios. See Set the Voice Effect.

To achieve better audio effect quality, Agora recommends calling {setAudioProfile} and setting the `scenario` parameter to `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before calling this method. You can call this method either before or after joining a channel.Do not set the profile parameter of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)`; otherwise, this method call does not take effect.This method works best with the human voice. Agora does not recommend using this method for audio containing music.After calling this method, Agora recommends not calling the following methods, because they can override RtcEngine#setVoiceBeautifierPreset setVoiceBeautifierPreset}: RtcEngine#setAudioEffectPreset setAudioEffectPreset} RtcEngine#setAudioEffectParameters setAudioEffectParameters} RtcEngine#setLocalVoicePitch setLocalVoicePitch} RtcEngine#setLocalVoiceFormant setLocalVoiceFormant} RtcEngine#setLocalVoiceEqualization setLocalVoiceEqualization} RtcEngine#setLocalVoiceReverb setLocalVoiceReverb} RtcEngine#setVoiceBeautifierParameters setVoiceBeautifierParameters} RtcEngine#setVoiceConversionPreset setVoiceConversionPreset} preset The options for SDK preset voice beautifier effects: Constants#VOICE_BEAUTIFIER_OFF VOICE_BEAUTIFIER_OFF} Constants#CHAT_BEAUTIFIER_MAGNETIC CHAT_BEAUTIFIER_MAGNETIC} Constants#CHAT_BEAUTIFIER_FRESH CHAT_BEAUTIFIER_FRESH} Constants#CHAT_BEAUTIFIER_VITALITY CHAT_BEAUTIFIER_VITALITY} Constants#TIMBRE_TRANSFORMATION_VIGOROUS TIMBRE_TRANSFORMATION_VIGOROUS} Constants#TIMBRE_TRANSFORMATION_DEEP TIMBRE_TRANSFORMATION_DEEP} Constants#TIMBRE_TRANSFORMATION_MELLOW TIMBRE_TRANSFORMATION_MELLOW} Constants#TIMBRE_TRANSFORMATION_FALSETTO TIMBRE_TRANSFORMATION_FALSETTO} Constants#TIMBRE_TRANSFORMATION_FULL TIMBRE_TRANSFORMATION_FULL} Constants#TIMBRE_TRANSFORMATION_CLEAR TIMBRE_TRANSFORMATION_CLEAR} Constants#TIMBRE_TRANSFORMATION_RESOUNDING TIMBRE_TRANSFORMATION_RESOUNDING} Constants#TIMBRE_TRANSFORMATION_RINGING TIMBRE_TRANSFORMATION_RINGING Constants#ULTRA_HIGH_QUALITY_VOICE ULTRA_HIGH_QUALITY_VOICE} 0: Success.< 0: Failure.

## ◆ setVoiceConversionPreset()

abstract int io.agora.rtc2.RtcEngine.setVoiceConversionPreset | ( | int | preset | ) |
| abstract

Sets an SDK preset voice conversion effect.

Since
  v3.3.1

Call this method to set an SDK preset voice conversion effect for the local user who sends an audio stream. After setting a voice conversion effect, all users in the channel can hear the effect.

You can set different voice conversion effects for different scenarios. See Set the Voice Effect.

To achieve better audio effect quality, Agora recommends calling {setAudioProfile} and setting the `scenario` parameter to `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before calling this method. You can call this method either before or after joining a channel.Do not set the `profile` parameter of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)`; otherwise, this method call does not take effect.This method works best with the human voice. Agora does not recommend using this method for audio containing music.After calling this method, Agora recommends not calling the following methods, because they can override RtcEngine#setVoiceConversionPreset setVoiceConversionPreset}: RtcEngine#setAudioEffectPreset setAudioEffectPreset} RtcEngine#setAudioEffectParameters setAudioEffectParameters} RtcEngine#setVoiceBeautifierPreset setVoiceBeautifierPreset} RtcEngine#setVoiceBeautifierParameters setVoiceBeautifierParameters} RtcEngine#setLocalVoicePitch setLocalVoicePitch} RtcEngine#setLocalVoiceFormant setLocalVoiceFormant} RtcEngine#setLocalVoiceEqualization setLocalVoiceEqualization} RtcEngine#setLocalVoiceReverb setLocalVoiceReverb} preset The options for SDK preset voice conversion effects: Constants#VOICE_CONVERSION_OFF VOICE_CONVERSION_OFF} Constants#VOICE_CHANGER_NEUTRAL VOICE_CHANGER_NEUTRAL} Constants#VOICE_CHANGER_SWEET VOICE_CHANGER_SWEET} Constants#VOICE_CHANGER_SOLID VOICE_CHANGER_SOLID} Constants#VOICE_CHANGER_BASS VOICE_CHANGER_BASS} Constants#VOICE_CHANGER_CARTOON VOICE_CHANGER_CARTOON} Constants#VOICE_CHANGER_CHILDLIKE VOICE_CHANGER_CHILDLIKE} Constants#VOICE_CHANGER_PHONE_OPERATOR VOICE_CHANGER_PHONE_OPERATOR} Constants#VOICE_CHANGER_MONSTER VOICE_CHANGER_MONSTER} Constants#VOICE_CHANGER_TRANSFORMERS VOICE_CHANGER_TRANSFORMERS} Constants#VOICE_CHANGER_GROOT VOICE_CHANGER_GROOT} Constants#VOICE_CHANGER_DARTH_VADER VOICE_CHANGER_DARTH_VADER} Constants#VOICE_CHANGER_IRON_LADY VOICE_CHANGER_IRON_LADY} Constants#VOICE_CHANGER_SHIN_CHAN VOICE_CHANGER_SHIN_CHAN} Constants#VOICE_CHANGER_GIRLISH_MAN VOICE_CHANGER_GIRLISH_MAN} Constants#VOICE_CHANGER_CHIPMUNK VOICE_CHANGER_CHIPMUNK} 0: Success.< 0: Failure.

## ◆ setAudioEffectParameters()

abstract int io.agora.rtc2.RtcEngine.setAudioEffectParameters | ( | int | preset,
|  | int | param1,
|  | int | param2
| ) |  |
| abstract

Sets parameters for SDK preset audio effects.

Since
  v3.2.0

Call this method to set the following parameters for the local user who sends an audio stream:

- 3D voice effect: Sets the cycle period of the 3D voice effect.
- Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. Different songs have different modes and tonic pitches. Agora recommends bounding this method with interface elements to enable users to adjust the pitch correction interactively.

After setting parameters, all users in the channel can hear the relevant effect.

Note
  - You can call this method either before or after joining a channel.
  - To achieve better audio effect quality, Agora recommends calling `setAudioProfile` and setting the scenario parameter to `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method.
  - Do not set the profile parameter of setAudioProfile to `AUDIO_PROFILE_SPEECH_STANDARD(1)`; otherwise, this method call does not take effect.
  - This method works best with the human voice. Agora does not recommend using this method for audio containing music.
  - After calling this method, Agora recommends not calling the following methods, because they can override `setAudioEffectParameters`:
    - setAudioEffectPreset
    - setVoiceBeautifierPreset
    - setLocalVoicePitch
    - setLocalVoiceFormant
    - setLocalVoiceEqualization
    - setLocalVoiceReverb
    - setVoiceBeautifierParameters
    - setVoiceConversionPreset

Parameters

  preset | The options for SDK preset audio effects: 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE` Call `setAudioProfile` and set the `profile` parameter to `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator; otherwise, the enumerator setting does not take effect. If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear the anticipated voice effect. Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora recommends calling `setAudioProfile` and setting the `profile` parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator.
  param1 | If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the 3D voice effect. The value range is [1, 60] and the unit is a second. The default value is 10 seconds, indicating that the voice moves around you every 10 seconds. If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch correction effect: `1`: (Default) Natural major scale. `2`: Natural minor scale. `3`: Japanese pentatonic scale.
  param2 | You need to set `param2` to `0`. If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch correction effect: `1`: A `2`: A# `3`: B `4`: (Default) C `5`: C# `6`: D `7`: D# `8`: E `9`: F `10`: F# `11`: G `12`: G#

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setVoiceBeautifierParameters()

abstract int io.agora.rtc2.RtcEngine.setVoiceBeautifierParameters | ( | int | preset,
|  | int | param1,
|  | int | param2
| ) |  |
| abstract

Sets parameters for SDK preset voice beautifier effects.

Since
  3.3.0.

Call this method to set a gender characteristic and a reverberation effect for the singing beautifier effect. This method sets parameters for the local user who sends an audio stream.

After you call this method successfully, all users in the channel can hear the relevant effect.

To achieve better audio effect quality, before you call this method, Agora recommends calling setAudioProfile, and setting the scenario parameter to `AUDIO_SCENARIO_GAME_STREAMING(3)` and the profile parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`.

Note
  - You can call this method either before or after joining a channel.
  - Do not set the `profile` parameter of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)`; otherwise, this method call does not take effect.
  - This method works best with the human voice. Agora does not recommend using this method for audio containing music.
  - After you call this method, Agora recommends not calling the following methods, because they can override `setVoiceBeautifierParameters`:
    - setAudioEffectPreset
    - setAudioEffectParameters
    - setVoiceBeautifierPreset
    - setLocalVoicePitch
    - setLocalVoiceFormant
    - setLocalVoiceEqualization
    - setLocalVoiceReverb
    - setVoiceConversionPreset

Parameters

  preset | The options for SDK preset voice beautifier effects: `SINGING_BEAUTIFIER`: Singing beautifier effect.
  param1 | The gender characteristics options for the singing voice: `1`: A male-sounding voice. `2`: A female-sounding voice.
  param2 | The reverberation effects options: `1`: The reverberation effect sounds like singing in a small room. `2`: The reverberation effect sounds like singing in a large room. `3`: The reverberation effect sounds like singing in a hall.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setVoiceConversionParameters()

abstract int io.agora.rtc2.RtcEngine.setVoiceConversionParameters | ( | int | preset,
|  | int | param1,
|  | int | param2
| ) |  |
| abstract

Set parameters for SDK preset voice conversion.

Note
  - reserved interface

Parameters

  preset | The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET.
  param1 | reserved.
  param2 | reserved.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableSoundPositionIndication()

abstract int io.agora.rtc2.RtcEngine.enableSoundPositionIndication | ( | boolean | enabled | ) |
| 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.

Parameters

  enabled | Sets whether or not to enable stereo panning for remote users: true: enables stereo panning. false: disables stereo panning.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteVoicePosition()

abstract int io.agora.rtc2.RtcEngine.setRemoteVoicePosition | ( | int | uid,
|  | double | pan,
|  | double | gain
| ) |  |
| abstract

Sets the sound position and gain of a remote user. When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.

Note
  - For this method to work, enable stereo panning for remote users by calling the enableSoundPositionIndication method before joining a channel.
  - This method requires hardware support. For the best sound positioning, we recommend using a wired headset.
  - Ensure that you call this method after joining a channel.

Parameters

  uid | The ID of the remote user.
  pan | The sound position of the remote user. The value ranges from -1.0 to 1.0: 0.0: the remote sound comes from the front. -1.0: the remote sound comes from the left. 1.0: the remote sound comes from the right.
  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableVoiceAITuner()

abstract int io.agora.rtc2.RtcEngine.enableVoiceAITuner | ( | boolean | enabled,
|  | Constants.VOICE_AI_TUNER_TYPE | type
| ) |  |
| abstract

Enables or disables the voice AI tuner.

Parameters

  enabled | Determines whether to enable the voice AI tuner: true: Enable the voice AI tuner false: (default) Disable the voice AI tuner.
  type. | The options for SDK voice AI tuner types. See #VOICE_AI_TUNER_TYPE.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startAudioMixing() [1/2]

abstract int io.agora.rtc2.RtcEngine.startAudioMixing | ( | String | filePath,
|  | boolean | loopback,
|  | int | cycle
| ) |  |
| 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 { IRtcEngineEventHandler#onAudioMixingStateChanged 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.If the path begins with /assets/, the audio file is in the /assets/ directory.Otherwise, the audio file is in the absolute path. loopback Sets which user can hear the audio mixing:true: Only the local user can hear the audio mixing.false: Both users can hear the audio mixing. cycle Sets the number of playback loops:Positive integer: Number of playback loops.-1: Infinite playback loops. To use this method, ensure that the Android device is v4.2 or later, and the API version is v16 or later.Call this method when you are in the channel, otherwise it may cause issues.If you want to play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `AUDIO_FILE_OPEN_TOO_FREQUENT(702)` warning occurs.If you want to play an online music file, Agora does not recommend using the redirected URL address. Some Android devices may fail to open a redirected URL address.If you call this method on an emulator, only the MP3 file format is supported. 0: Success.< 0: Failure. Constants#WARN_AUDIO_MIXING_OPEN_ERROR WARN_AUDIO_MIXING_OPEN_ERROR (701)}: If the local audio file does not exist, or the online audio packet is not received within five seconds after it is opened, the SDK assumes that the media file cannot be used and returns this warning.

## ◆ setAINSMode()

abstract int io.agora.rtc2.RtcEngine.setAINSMode | ( | boolean | enabled,
|  | int | mode
| ) |  |
| abstract

Enables/Disables Agora AI Noise Suppression(AINS) with preset mode.

Parameters

  enabled | Sets whether or not to enable AINS. true: Enables the AINS. false: Disables the AINS.
  mode | The preset AINS mode, range is [0,1,2]: 0: AINS mode with soft suppression level. 1: AINS mode with aggressive suppression level. 2: AINS mode with aggressive suppression level and low algorithm latency.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startAudioMixing() [2/2]

abstract int io.agora.rtc2.RtcEngine.startAudioMixing | ( | String | filePath,
|  | boolean | loopback,
|  | int | cycle,
|  | int | startPos
| ) |  |
| 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 { IRtcEngineEventHandler#onAudioMixingStateChanged 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.If the path begins with /assets/, the audio file is in the /assets/ directory.Otherwise, the audio file is in the absolute path. loopback Sets which user can hear the audio mixing:true: Only the local user can hear the audio mixing.false: Both users can hear the audio mixing. cycle Sets the number of playback loops:Positive integer: Number of playback loops.-1: Infinite playback loops. startPos The playback position (ms) of the music file. To use this method, ensure that the Android device is v4.2 or later, and the API version is v16 or later.Call this method when you are in the channel, otherwise it may cause issues.If you want to play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `AUDIO_FILE_OPEN_TOO_FREQUENT(702)` warning occurs.If you want to play an online music file, Agora does not recommend using the redirected URL address. Some Android devices may fail to open a redirected URL address.If you call this method on an emulator, only the MP3 file format is supported. 0: Success.< 0: Failure. Constants#WARN_AUDIO_MIXING_OPEN_ERROR WARN_AUDIO_MIXING_OPEN_ERROR (701)}: If the local audio file does not exist, or the online audio packet is not received within five seconds after it is opened, the SDK assumes that the media file cannot be used and returns this warning.

## ◆ stopAudioMixing()

abstract int io.agora.rtc2.RtcEngine.stopAudioMixing | ( |  | ) |
| abstract

Stops playing or mixing the music file.

Call this method when you are in a channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pauseAudioMixing()

abstract int io.agora.rtc2.RtcEngine.pauseAudioMixing | ( |  | ) |
| abstract

Pauses playing and mixing the music file.

Call this method when you are in a channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ resumeAudioMixing()

abstract int io.agora.rtc2.RtcEngine.resumeAudioMixing | ( |  | ) |
| abstract

Resumes playing and mixing the music file.

Call this method when you are in a channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ adjustAudioMixingVolume()

abstract int io.agora.rtc2.RtcEngine.adjustAudioMixingVolume | ( | int | volume | ) |
| abstract

Adjusts the volume of audio mixing.

Call this method when you are in a channel.

Note
  Calling this method does not affect the volume of the audio effect file playback invoked by the playEffect method.

Parameters

  volume | Audio mixing volume. The value ranges between 0 and 100 (default).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ adjustAudioMixingPlayoutVolume()

abstract int io.agora.rtc2.RtcEngine.adjustAudioMixingPlayoutVolume | ( | int | volume | ) |
| abstract

Adjusts the audio mixing volume for local playback.

Note
  Call this method when you are in a channel.

Parameters

  volume | Audio mixing volume for local playback. The value ranges between 0 and 100 (default).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ adjustAudioMixingPublishVolume()

abstract int io.agora.rtc2.RtcEngine.adjustAudioMixingPublishVolume | ( | int | volume | ) |
| abstract

Adjusts the audio mixing volume for publishing (for remote users).

Note
  Call this method when you are in a channel.

Parameters

  volume | Audio mixing volume for publishing. The value ranges between 0 and 100 (default).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getAudioMixingPlayoutVolume()

abstract int io.agora.rtc2.RtcEngine.getAudioMixingPlayoutVolume | ( |  | ) |
| abstract

Retrieves the audio mixing volume for local playback. This method helps troubleshoot audio volume related issues.

Note
  Call this method when you are in a channel.

Returns
  - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
  - < 0: Failure.

## ◆ getAudioMixingPublishVolume()

abstract int io.agora.rtc2.RtcEngine.getAudioMixingPublishVolume | ( |  | ) |
| abstract

Retrieves the audio mixing volume for publishing. This method helps troubleshoot audio volume related issues.

Note
  Call this method when you are in a channel.

Returns
  - ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100].
  - < 0: Failure.

## ◆ getAudioMixingDuration()

abstract int io.agora.rtc2.RtcEngine.getAudioMixingDuration | ( |  | ) |
| abstract

Gets the duration (ms) of the music file.

Call this method when you are in a channel.

Returns
  - Returns the audio mixing duration, if the method call is successful.
  - < 0: Failure.

## ◆ getAudioMixingCurrentPosition()

abstract int io.agora.rtc2.RtcEngine.getAudioMixingCurrentPosition | ( |  | ) |
| abstract

Gets the playback position (ms) of the music file.

Call this method when you are in a channel.

Returns
  - Returns the current playback position of the audio mixing, if the method call is successful.
  - < 0: Failure.

## ◆ setAudioMixingPosition()

abstract int io.agora.rtc2.RtcEngine.setAudioMixingPosition | ( | int | pos | ) |
| abstract

Sets the playback position (ms) of the music file to a different starting position (the default plays from the beginning).

Parameters

  pos | The playback starting position (ms) of the audio mixing file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioMixingDualMonoMode()

abstract int io.agora.rtc2.RtcEngine.setAudioMixingDualMonoMode | ( | Constants.AudioMixingDualMonoMode | mode | ) |
| abstract

In dual-channel music files, different audio data can be stored on the left and right channels. According to actual needs, you can set the channel mode as the original mode, the left channel mode, the right channel mode or the mixed mode

Parameters

  mode | The mode of channel mode

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioMixingPitch()

abstract int io.agora.rtc2.RtcEngine.setAudioMixingPitch | ( | int | pitch | ) |
| abstract

Sets the pitch of the music file.

Parameters

  pitch | The pitch of the music file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioMixingPlaybackSpeed()

abstract int io.agora.rtc2.RtcEngine.setAudioMixingPlaybackSpeed | ( | int | speed | ) |
| abstract

Sets the playback speed of the current music file.

Parameters

  speed | The playback speed. Agora recommends that you limit this value to between 50 and 400, defined as follows: 50: Half the original speed. 100: The original speed. 400: 4 times the original speed.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ selectAudioTrack()

abstract int io.agora.rtc2.RtcEngine.selectAudioTrack | ( | int | audioIndex | ) |
| abstract

select the track of the mixing music file.

Call this method after startAudioMixing is called.

Parameters

  audioIndex | Audio track index. The value begin from 0.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getAudioTrackCount()

abstract int io.agora.rtc2.RtcEngine.getAudioTrackCount | ( |  | ) |
| abstract

Get the audio track count of mixing music file.

Call this method After startAudioMixing is called.

Returns
  - >0: Success.
  - < 0: Failure.

## ◆ getAudioEffectManager()

abstract IAudioEffectManager io.agora.rtc2.RtcEngine.getAudioEffectManager | ( |  | ) |
| abstract

Gets the IAudioEffectManager object associated with the current RTC engine.

Returns
  IAudioEffectManager

## ◆ startAudioRecording() [1/2]

abstract int io.agora.rtc2.RtcEngine.startAudioRecording | ( | String | filePath,
|  | int | quality
| ) |  |
| abstract

Starts an audio recording.

The SDK allows recording during a call, which supports either one of the following formats:

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

Ensure that the directory to save the recording file exists and is writable. This method is usually called after the token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid) joinChannel method. The recording automatically stops when the leaveChannel method is called.

Parameters

  filePath | Full file path of the recording file. The string of the file name is in UTF-8 code.
  quality | Audio recording quality: AUDIO_RECORDING_QUALITY_LOW(0) AUDIO_RECORDING_QUALITY_MEDIUM(1) AUDIO_RECORDING_QUALITY_HIGH(2)

Returns
  - 0: Success.
  - <0: Failure.

## ◆ startAudioRecording() [2/2]

abstract int io.agora.rtc2.RtcEngine.startAudioRecording | ( | AudioRecordingConfiguration | config | ) |
| abstract

Starts an audio recording.

The SDK allows recording during a call, which supports either one of the following formats:

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

Ensure that the directory to save the recording file exists and is writable. This method is usually called after the token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid) joinChannel method. The recording automatically stops when the leaveChannel method is called.

Parameters

  config | audio file recording config

Returns
  - 0: Success.
  - <0: Failure.

## ◆ stopAudioRecording()

abstract int io.agora.rtc2.RtcEngine.stopAudioRecording | ( |  | ) |
| abstract

Stops the audio recording on the client.

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

Returns
  - 0: Success.
  - <0: Failure.

## ◆ startEchoTest()

abstract int io.agora.rtc2.RtcEngine.startEchoTest | ( | EchoTestConfiguration | config | ) |
| abstract

Starts a video call test.

Note
  - Call this method before joining a channel.
  - After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or call the {joinchannel} method. In the Live Broadcast profile, only a host can call this method.

Parameters

  config | The configuration of the echo test.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopEchoTest()

abstract int io.agora.rtc2.RtcEngine.stopEchoTest | ( |  | ) |
| abstract

Stops an audio call test.

Returns
  - 0: Succeeded.
  - <0: Failed.
    - ERR_REFUSED(-5). Failed to stop the echo test. The echo test may not be running.

## ◆ startLastmileProbeTest()

abstract int io.agora.rtc2.RtcEngine.startLastmileProbeTest | ( | LastmileProbeConfig | config | ) |
| 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. This method consumes extra network traffic and may affect communication quality.Do not call other methods before receiving the { IRtcEngineEventHandler#onLastmileProbeResult onLastmileProbeResult} callback. Otherwise, the callback may be interrupted by other methods. config The configurations of the last-mile network probe test. For details, see io.agora.rtc2.internal.LastmileProbeConfig LastmileProbeConfig}. 0: Success.< 0: Failure.

## ◆ stopLastmileProbeTest()

abstract int io.agora.rtc2.RtcEngine.stopLastmileProbeTest | ( |  | ) |
| abstract

Stops the last-mile network probe test.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalAudioSource() [1/2]

abstract int io.agora.rtc2.RtcEngine.setExternalAudioSource | ( | boolean | enabled,
|  | int | sampleRate,
|  | int | channels
| ) |  |
| abstract

Sets the external audio source.

Deprecated:
  This method is deprecated. Use createCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) instead.

Note
  Ensure that you call this method before calling `joinChannel`.

Parameters

  enabled | Determines whether to enable the external audio source: true: Enable the external audio source. false: (default) Disable 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: 1: Mono. 2: Stereo.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalAudioSink()

abstract int io.agora.rtc2.RtcEngine.setExternalAudioSink | ( | boolean | enabled,
|  | int | sampleRate,
|  | int | channels
| ) |  |
| abstract

Sets the external audio sink.

Parameters

  enabled | Sets whether or not to the external audio sink. true: Enables the external audio sink. false: Disables the external audio sink.
  sampleRate | The sample rate (Hz) of the external audio sink. You can set this parameter as 16000, 32000, 44100, or 48000.
  channels | The number of audio channels of the external audio sink: 1: Mono. 2: Stereo.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalRemoteEglContext()

abstract int io.agora.rtc2.RtcEngine.setExternalRemoteEglContext | ( | Object | eglContext | ) |
| abstract

Set remote eglContext.

When engine destroy, the SDK will automatically release the eglContext internally.

Parameters

  eglContext. |

Note
  setExternalRemoteEglContext needs to be called before joining the channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pullPlaybackAudioFrame() [1/2]

abstract int io.agora.rtc2.RtcEngine.pullPlaybackAudioFrame | ( | byte[] | data,
|  | int | lengthInByte
| ) |  |
| abstract

Pulls the remote audio frame.

Before calling this method, call the int, int) method to enable and set the external audio sink.

Ensure that you call this method after joining a channel.

After a successful method call, the app pulls the decoded and mixed audio data for playback.

Parameters

  data | The audio data that you want to pull. The data format is in byte[].
  lengthInByte | The data length (byte) of the external audio data. The value of this parameter is related to the audio duration, and the values of the `sampleRate` and `channels` parameters that you set in setExternalAudioSink. Agora recommends setting the audio duration no shorter than 10 ms. The formula for `lengthInByte` is: lengthInByte = sampleRate/1000 × 2 × channels × audio duration (ms).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pullPlaybackAudioFrame() [2/2]

abstract int io.agora.rtc2.RtcEngine.pullPlaybackAudioFrame | ( | ByteBuffer | data,
|  | int | lengthInByte
| ) |  |
| abstract

Pulls the remote audio frame.

Before calling this method, call the setExternalAudioSink(enabled: true) method to enable and set the external audio sink.

Ensure that you call this method after joining a channel.

After a successful method call, the app pulls the decoded and mixed audio data for playback.

Note
  - Once you call the `pullPlaybackAudioFrame` method successfully, the app will not retrieve any audio data from the int, int, int, int, ByteBuffer, long, int) onPlaybackFrame} callback.
  - The difference between the `onPlaybackFrame` callback and the `pullPlaybackAudioFrame` method is as follows:
    - `onPlaybackFrame`: The SDK sends the audio data to the app through this callback. Any delay in processing the audio frames may result in audio jitter.
    - `pullPlaybackAudioFrame`: The app pulls the remote audio data. After setting the audio data parameters, the SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback.

Parameters

  data | The audio data that you want to pull. The data format is in ByteBuffer.
  lengthInByte | The data length (byte) of the external audio data. The value of this parameter is related to the audio duration, and the values of the `sampleRate` and `channels` parameters that you set in setExternalAudioSink. Agora recommends setting the audio duration no shorter than 10 ms. The formula for `lengthInByte` is: lengthInByte = sampleRate/1000 × 2 × channels × audio duration (ms).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startRecordingDeviceTest()

abstract int io.agora.rtc2.RtcEngine.startRecordingDeviceTest | ( | int | indicationInterval | ) |
| abstract

Starts the microphone test.

This method tests whether the microphone works properly. Once the test starts, the SDK uses the IRtcEngineEventHandler::onAudioVolumeIndication() callback to notify the application on the volume information.

Parameters

  indicationInterval | The time interval (ms) between which the SDK triggers the onAudioVolumeIndication() callback.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopRecordingDeviceTest()

abstract int io.agora.rtc2.RtcEngine.stopRecordingDeviceTest | ( |  | ) |
| abstract

Stops the microphone test.

This method stops the microphone test. To stop the test, call this method after calling the startRecordingDeviceTest() method.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startPlaybackDeviceTest()

abstract int io.agora.rtc2.RtcEngine.startPlaybackDeviceTest | ( | String | audioFileName | ) |
| abstract

Starts a playback device test.

This method tests whether the playback device works properly with the specified playback audio file.

Parameters

  audioFileName | File path of the audio file for the test, which is in utf8 absolute path:

- Supported File Format: wav, mp3, m4a, and aac
- Supported File Sampling Rate: 8000, 16000, 32000, 44100, and 48000

Returns
  * 0: Success. <0: Failure.

## ◆ stopPlaybackDeviceTest()

abstract int io.agora.rtc2.RtcEngine.stopPlaybackDeviceTest | ( |  | ) |
| abstract

Stops the playback device test.

This method stops testing the playback device. You must call this method to stop the test after calling [startPlaybackDeviceTest](startPlaybackDeviceTest:).

Returns
  * 0: Success. <0: Failure.

## ◆ createCustomAudioTrack()

abstract int io.agora.rtc2.RtcEngine.createCustomAudioTrack | ( | Constants.AudioTrackType | trackType,
|  | AudioTrackConfig | config
| ) |  |
| abstract

Create a custom audio track and get the audio track id.

Note
  Ensure that you call this method before calling `joinChannel`.

Parameters

  trackType | The type of custom audio track: AUDIO_TRACK_MIXABLE(0): Mixable audio track AUDIO_TRACK_DIRECT(1): direct audio track
  config | The config of custom audio track:

- Returns
- If the call is successful, SDK returns audio track id.
- If the call fails, SDK returns 0xffffffff.

## ◆ destroyCustomAudioTrack()

abstract int io.agora.rtc2.RtcEngine.destroyCustomAudioTrack | ( | int | trackId | ) |
| abstract

Destroy custom audio track by trackId

Parameters

  trackId | The custom audio track id

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalAudioSource() [2/2]

abstract int io.agora.rtc2.RtcEngine.setExternalAudioSource | ( | boolean | enabled,
|  | int | sampleRate,
|  | int | channels,
|  | boolean | localPlayback,
|  | boolean | publish
| ) |  |
| abstract

Sets the external audio source.

Deprecated:
  This method is deprecated. Use createCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) instead.

Note
  Ensure that you call this method before `joinChannel`.

Parameters

  enabled | Determines whether to enable the external audio source: true: Enable the external audio source. false: (default) Disable 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: 1: Mono. 2: Stereo.
  localPlayback | Enable/Disables the local playback of external audio track: true: Enable local playback false: Do not enable local playback
  publish | Determines whether to publish the external audio track: true: Publish the external audio track. false: Don`t publish the external audio track.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalAudioFrame() [1/4]

abstract int io.agora.rtc2.RtcEngine.pushExternalAudioFrame | ( | byte[] | data,
|  | long | timestamp
| ) |  |
| abstract

Pushes the external audio data to the app.

Deprecated:
  This method is deprecated. Use pushExternalAudioFrame(byte[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) instead.

Parameters

  data | The audio buffer data.
  timestamp | The timestamp of the audio data.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalAudioFrame() [2/4]

abstract int io.agora.rtc2.RtcEngine.pushExternalAudioFrame | ( | ByteBuffer | data,
|  | long | timestamp,
|  | int | trackId
| ) |  |
| abstract

Pushes the external audio data to the app.

Deprecated:
  This method is deprecated. Use pushExternalAudioFrame(ByteBuffer[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) instead.

Parameters

  data | The audio buffer data.
  timestamp | The timestamp of the audio data.
  trackId | The audio track ID.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalAudioFrame() [3/4]

abstract int io.agora.rtc2.RtcEngine.pushExternalAudioFrame | ( | byte[] | data,
|  | long | timestamp,
|  | int | sampleRate,
|  | int | channels,
|  | Constants.BytesPerSample | bytesPerSample,
|  | int | trackId
| ) |  |
| abstract

Pushes the external audio data to the app.

Parameters

  data | The audio buffer data.
  timestamp | The timestamp of the audio data.
  sampleRate | Sets the sample rate, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels 1: Mono. 2: Stereo.
  bytesPerSample | bytes per sample
  trackId | The audio track ID.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalAudioFrame() [4/4]

abstract int io.agora.rtc2.RtcEngine.pushExternalAudioFrame | ( | ByteBuffer | data,
|  | long | timestamp,
|  | int | sampleRate,
|  | int | channels,
|  | Constants.BytesPerSample | bytesPerSample,
|  | int | trackId
| ) |  |
| abstract

Pushes the external audio data to the app.

Parameters

  data | The audio buffer data.
  timestamp | The timestamp of the audio data.
  sampleRate | Sets the sample rate, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels 1: Mono. 2: Stereo.
  bytesPerSample | bytes per sample
  trackId | The audio track ID.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalVideoSource() [1/2]

abstract int io.agora.rtc2.RtcEngine.setExternalVideoSource | ( | boolean | enable,
|  | boolean | useTexture,
|  | Constants.ExternalVideoSourceType | sourceType
| ) |  |
| abstract

Sets the external video source.

Once the external video source is enabled, the SDK prepares to accept the external video frame.

Parameters

  enable | Determines whether to enable the external video source. true: Enable the external video source. Once set, the SDK creates the external source and prepares video data from `pushExternalVideoFrame` or `pushExternalEncodedVideoImage`. false: Disable the external video source.
  useTexture | Determines whether to use textured video data. true: Use texture, which is not supported now. False: Do not use texture.
  sourceType | Determines whether the external video source is encoded. VIDEO_FRAME(0): The external video source is not encoded. ENCODED_VIDEO_FRAME(1): The external video source is encoded.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExternalVideoSource() [2/2]

abstract int io.agora.rtc2.RtcEngine.setExternalVideoSource | ( | boolean | enable,
|  | boolean | useTexture,
|  | Constants.ExternalVideoSourceType | sourceType,
|  | EncodedVideoTrackOptions | encodedOpt
| ) |  |
| abstract

Sets the external video source.

Once the external video source is enabled, the SDK prepares to accept the external video frame.

Parameters

  enable | Determines whether to enable the external video source. true: Enable the external video source. Once set, the SDK creates the external source and prepares video data from `pushExternalVideoFrame` or `pushExternalEncodedVideoFrame`. false: Disable the external video source.
  useTexture | Determines whether to use textured video data. true: Use texture, which is not supported now. False: Do not use texture.
  sourceType | Determines whether the external video source is encoded. VIDEO_FRAME(0): The external video source is not encoded. ENCODED_VIDEO_FRAME(1): The external video source is encoded.
  encodedOpt | Determine encoded video track options including codec type, cc mode and target bitrate.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalVideoFrame() [1/2]

abstract boolean io.agora.rtc2.RtcEngine.pushExternalVideoFrame | ( | VideoFrame | frame | ) |
| abstract

Pushes the video frame using the `VideoFrame` class and passes the video frame to the Agora SDK.

Deprecated:
  This method is deprecated.

Call the setExternalVideoSource method and set `pushMode` as `true` before calling this method. Otherwise, a failure returns after calling this method.

Note
  You can push the video frame either by calling this method or by calling {pushExternalVideoFrame(AgoraVideoFrame frame)}. For textured video frames, Agora recommends using the pushExternalVideoFrame(VideoFrame frame) pushExternalVideoFrame(VideoFrame frame)} method, so that the SDK can better utilize the hardware performance. frame Video frame to be pushed. See VideoFrame VideoFrame}:`buffer`: Buffer The buffer of the video frame.`rotation`: int Rotation of the video frame in degrees.`timestampNs`: long Timestamp of the video frame in nanoseconds. In the `COMMUNICATION` profile, the SDK does not support textured video frames. `true`: The frame is pushed successfully.`false`: Failed to push the frame.

## ◆ pushExternalVideoFrameById() [1/2]

abstract int io.agora.rtc2.RtcEngine.pushExternalVideoFrameById | ( | VideoFrame | frame,
|  | int | videoTrackId
| ) |  |
| abstract

Pushes the external video frame to the app.

Note
  Ensure that you call setExternalVideoSource before calling this method.

Parameters

  frame | The external video frame: VideoFrame.
  videoTrackId | The id of the video track.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pushExternalVideoFrameById() [2/2]

abstract int io.agora.rtc2.RtcEngine.pushExternalVideoFrameById | ( | AgoraVideoFrame | frame,
|  | int | videoTrackId
| ) |  |
| abstract

Pushes the external video frame to the app with specified connection.

Note
  Ensure that you call setExternalVideoSource before calling this method.

Parameters

  frame | The external video frame: ExternalVideoFrame.
  videoTrackId | The id of the video track.

Returns
  - 0: Success, which means that the external video frame is pushed successfully.
  - < 0: Failure, which means that the external video frame fails to be pushed.

## ◆ pushExternalEncodedVideoFrame()

abstract int io.agora.rtc2.RtcEngine.pushExternalEncodedVideoFrame | ( | ByteBuffer | data,
|  | EncodedVideoFrameInfo | frameInfo
| ) |  |
| abstract

Pushes the encoded external video frame to Agora SDK.

Deprecated:
  This method is deprecated.

Note
  Ensure that you call setExternalVideoSource before calling this method.

Parameters

  data | The encoded external video data, which must be the direct buffer.
  frameInfo | The encoded external video frame info: {EncodedVideoFrameInfo}. 0: Success, which means that the encoded external video frame is pushed successfully.< 0: Failure, which means that the encoded external video frame fails to be pushed. preview

## ◆ pushExternalEncodedVideoFrameById()

abstract int io.agora.rtc2.RtcEngine.pushExternalEncodedVideoFrameById | ( | ByteBuffer | data,
|  | EncodedVideoFrameInfo | frameInfo,
|  | int | videoTrackId
| ) |  |
| abstract

Pushes the encoded external video frame to the app with specified connection.

Note
  Ensure that you call setExternalVideoSource before calling this method.

Parameters

  data | The encoded external video data, which must be the direct buffer.
  frameInfo | The encoded external video frame info: {EncodedVideoFrameInfo}. videoTrackId The id of the video track. 0: Success, which means that the encoded external video frame is pushed successfully.< 0: Failure, which means that the encoded external video frame fails to be pushed. preview

## ◆ pushExternalVideoFrame() [2/2]

abstract boolean io.agora.rtc2.RtcEngine.pushExternalVideoFrame | ( | AgoraVideoFrame | frame | ) |
| 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.

Note
  You can push the video frame either by calling this method or by calling {pushExternalVideoFrame(VideoFrame frame)}. For textured video frames, Agora recommends using the pushExternalVideoFrame(VideoFrame frame) pushExternalVideoFrame(VideoFrame frame)} method, so that the SDK can better utilize the hardware performance. frame Video frame to be pushed. See io.agora.rtc2.video.AgoraVideoFrame AgoraVideoFrame}. In the `COMMUNICATION` profile, the SDK does not support textured video frames. `true`: The frame is pushed successfully.`false`: Failed to push the frame.

## ◆ isTextureEncodeSupported()

abstract boolean io.agora.rtc2.RtcEngine.isTextureEncodeSupported | ( |  | ) |
| abstract

Checks whether texture encoding is supported.

Returns
  True/False.

## ◆ registerAudioFrameObserver()

abstract int io.agora.rtc2.RtcEngine.registerAudioFrameObserver | ( | IAudioFrameObserver | observer | ) |
| abstract

Registers an audio frame observer object.

Note
  Call this method before calling `joinChannel`.

Parameters

  observer | The IAudioFrameObserver interface, null means unregistering observer instead.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ registerAudioEncodedFrameObserver()

abstract int io.agora.rtc2.RtcEngine.registerAudioEncodedFrameObserver | ( | AudioEncodedFrameObserverConfig | config,
|  | IAudioEncodedFrameObserver | observer
| ) |  |
| abstract

Registers an encoded audio frame observer object.

Note
  Ensure that you call this method before joining the channel.

Parameters

  observer | The IAudioEncodedFrameObserver interface, null means unregistering observer instead.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRecordingAudioFrameParameters()

abstract int io.agora.rtc2.RtcEngine.setRecordingAudioFrameParameters | ( | int | sampleRate,
|  | int | channel,
|  | int | mode,
|  | int | samplesPerCall
| ) |  |
| abstract

Sets the audio recording format for the onRecordAudioFrame callback.

Parameters

  sampleRate | Sets the sample rate (`samplesPerSec`) returned in the `onRecordAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels (channels) returned in the `onRecordAudioFrame` callback: 1: Mono. 2: Stereo.
  mode | Sets the use mode of the onRecordAudioFrame callback: `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the audio data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP streams. `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and perform some voice pre-processing, such as a voice change.
  samplesPerCall | Sets the number of samples the `onRecordAudioFrame` callback returns. In RTMP streaming scenarios, set it as 1024.

Returns
  - 0: Success.
  - < 0: Failure.

Note
  The SDK calculates the sample interval according to the value of the `sampleRate`, `channel`, 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 `onRecordAudioFrame` callback according to the sample interval.

## ◆ setPlaybackAudioFrameParameters()

abstract int io.agora.rtc2.RtcEngine.setPlaybackAudioFrameParameters | ( | int | sampleRate,
|  | int | channel,
|  | int | mode,
|  | int | samplesPerCall
| ) |  |
| abstract

Sets the audio recording format for the onPlaybackAudioFrame callback.

Parameters

  sampleRate | Sets the sample rate (`samplesPerSec`) returned in the `onPlaybackAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels (channels) returned in the `onPlaybackAudioFrame` callback: 1: Mono. 2: Stereo.
  mode | Sets the use mode of the onPlaybackAudioFrame callback: `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the audio data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP streams. `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and perform some voice pre-processing, such as a voice change.
  samplesPerCall | Sets the number of samples the `onPlaybackAudioFrame` callback returns. In RTMP streaming scenarios, set it as 1024.

Returns
  - 0: Success.
  - < 0: Failure.

Note
  The SDK calculates the sample interval according to the value of the `sampleRate`, `channel`, 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 `onPlaybackAudioFrame` callback according to the sample interval.

## ◆ setMixedAudioFrameParameters()

abstract int io.agora.rtc2.RtcEngine.setMixedAudioFrameParameters | ( | int | sampleRate,
|  | int | channel,
|  | int | samplesPerCall
| ) |  |
| abstract

Sets the mixed audio format for the onMixedAudioFrame callback.

Parameters

  sampleRate | Sets the sample rate (`samplesPerSec`) returned in the `onMixedAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels (channels) returned in the `onPlaybackAudioFrame` callback: 1: Mono. 2: Stereo.
  samplesPerCall | Sets the number of samples the `onMixedAudioFrame` callback returns. In RTMP streaming scenarios, set it as 1024.

Returns
  - 0: Success.
  - < 0: Failure.

Note
  The SDK calculates the sample interval according to the value of the `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.

## ◆ setEarMonitoringAudioFrameParameters()

abstract int io.agora.rtc2.RtcEngine.setEarMonitoringAudioFrameParameters | ( | int | sampleRate,
|  | int | channel,
|  | int | mode,
|  | int | samplesPerCall
| ) |  |
| abstract

Sets the audio ear monitoring format for the onEarMonitoringAudioFrame callback.

Parameters

  sampleRate | Sets the sample rate (`samplesPerSec`) returned in the `onEarMonitoringAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Sets the number of audio channels (channels) returned in the `onEarMonitoringAudioFrame` callback: 1: Mono. 2: Stereo.
  mode | Sets the use mode of the onEarMonitoringAudioFrame callback: `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the audio data without modifying anything. For example, when users acquire the data with the Agora SDK then push the RTMP streams. `RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY(1)`: Write-only mode: Users replace the audio data with their own data and pass the data to the SDK for encoding. For example, when users acquire the data. `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and perform some voice pre-processing, such as a voice change.
  samplesPerCall | Sets the number of samples the `onEarMonitoringAudioFrame` callback returns. In RTMP streaming scenarios, set it as 1024.

Returns
  - 0: Success.
  - < 0: Failure.

Note
  The SDK calculates the sample interval according to the value of the `sampleRate`, `channel`, 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 `onEarMonitoringAudioFrame` callback according to the sample interval.

## ◆ addVideoWatermark() [1/2]

abstract int io.agora.rtc2.RtcEngine.addVideoWatermark | ( | AgoraImage | watermark | ) |
| abstract

Adds a watermark image to the local video.

Deprecated:
  From v2.9.1. We recommend using the WatermarkOptions) addVideoWatermark2 method instead.

This method adds a PNG watermark image to the local video stream for the sampling 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.

Parameters

  watermark | Watermark image to be added to the local video stream. See {Agora Image}. The URL descriptions are different for the local video and CDN live streams: In a local video stream, `url` in Agora Image refers to the absolute path of the added watermark image file in the local video stream. In a CDN live stream, `url` in Agora Image refers to the address of the added watermark image in the CDN live streaming. The source file of the watermark image must be in the PNG file format. If the width and height of the PNG file differ from your settings in this method, the PNG file is cropped to conform to your settings. The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one. If you set `orientationMode` as Adaptive in the {setVideoEncoderConfiguration} method, the watermark image rotates with the video frame around the upper left corner of the watermark image.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ addVideoWatermark() [2/2]

abstract int io.agora.rtc2.RtcEngine.addVideoWatermark | ( | String | watermarkUrl,
|  | WatermarkOptions | options
| ) |  |
| abstract

Adds a watermark image to the local video.

Since
  v2.9.1 to replace addVideoWatermark1.

This method adds a PNG watermark image to the local video stream in a live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the sampling device can see and capture it.

Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one.

The watermark position depends on the settings in the {setVideoEncoderConfiguration} method:If the orientation mode of the encoding video is ORIENTATION_MODE_FIXED_LANDSCAPE, or the landscape mode in ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation.If the orientation mode of the encoding video is ORIENTATION_MODE_FIXED_PORTRAIT, or the portrait mode in ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation.When setting the watermark position, the region must be less than the dimensions set in the setVideoEncoderConfiguration method. Otherwise, the watermark image will be cropped. Ensure that you have called the RtcEngine#enableVideo enableVideo} method to enable the video module before calling this method.If you only want to add a watermark image to the local video for the audience in the CDN live streaming channel to see and capture, you can call this method or the { RtcEngine#setLiveTranscoding setLiveTranscoding} method.This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray.If the dimensions the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings.If you have enabled the local video preview by calling the RtcEngine#startPreview startPreview} method, you can use the `visibleInPreview` member in the `WatermarkOptions` class to set whether or not the watermark is visible in preview.If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from either the local file path or the assets file path. If you use the assets file path, you need to start with `/assets/` when filling in this parameter. options The options of the watermark image to be added. See { io.agora.rtc.video.WatermarkOptions Watermark Options}. 0: Success.< 0: Failure.

## ◆ clearVideoWatermarks()

abstract int io.agora.rtc2.RtcEngine.clearVideoWatermarks | ( |  | ) |
| abstract

Removes the watermark image from the video stream added by {addVideoWatermark}. 0: Success.< 0: Failure.

## ◆ setRemoteUserPriority()

abstract int io.agora.rtc2.RtcEngine.setRemoteUserPriority | ( | int | uid,
|  | int | userPriority
| ) |  |
| abstract

Sets the priority of a remote user's media stream.

Since
  v2.4.0.

Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.

Note
  The SDK supports setting userPriority as high for one user only.

Parameters

  uid | The ID of the remote user.
  userPriority | The priority of the remote user: USER_PRIORITY_HIGH(50): the user's priority is high. USER_PRIORITY_NORANL(100): (default) the user's priority is normal.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setLocalPublishFallbackOption()

abstract int io.agora.rtc2.RtcEngine.setLocalPublishFallbackOption | ( | Constants.StreamFallbackOptions | option | ) |
| 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:

- Disable the upstream video but enable audio only when the network conditions deteriorate and cannot support both video and audio.
- Re-enable the video when the network conditions improve.

When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the {onLocalPublishFallbackToAudioOnly}. Ensure that you call this method before joining a channel. option The fallback option for the locally published video stream: io.agora.rtc.Constants#STREAM_FALLBACK_OPTION_DISABLED STREAM_FALLBACK_OPTION_DISABLED(0)}: (Default) No fallback behavior for the locally published video stream when the uplink network condition is poor. The stream quality is not guaranteed. io.agora.rtc.Constants#STREAM_FALLBACK_OPTION_AUDIO_ONLY STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)}: The locally published video stream falls back to audio only when the uplink network condition is poor. Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the locally published video stream falls back to audio only. 0: Success.< 0: Failure.

## ◆ setRemoteSubscribeFallbackOption()

abstract int io.agora.rtc2.RtcEngine.setRemoteSubscribeFallbackOption | ( | Constants.StreamFallbackOptions | option | ) |
| 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. Ensure that you call this method before joining a channel. option The fallback option for the remotely subscribed video stream: io.agora.rtc.Constants#STREAM_FALLBACK_OPTION_DISABLED STREAM_FALLBACK_OPTION_DISABLED(0)}: No fallback behavior for the remotely subscribed video stream when the downlink network condition is poor. The quality of the video stream is not guaranteed. io.agora.rtc.Constants#STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW(1)}: (Default) The remotely subscribed video stream falls back to the low-stream video when the downlink network condition worsens. This option works only for this method and not for the { io.agora.rtc.RtcEngine#setLocalPublishFallbackOption(int) setLocalPublishFallbackOption} method. io.agora.rtc.Constants#STREAM_FALLBACK_OPTION_AUDIO_ONLY STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)}: Under poor downlink network conditions, the remotely subscribed video stream first falls back to the low-stream video; and then to an audio-only stream if the network condition worsens. 0: Success.< 0: Failure.

## ◆ setHighPriorityUserList()

abstract int io.agora.rtc2.RtcEngine.setHighPriorityUserList | ( | int[] | uidList,
|  | int | option
| ) |  |
| abstract

Sets the high priority user list and related fallback option for the remotely subscribed video stream based on the network conditions in NASA2.

Parameters

  uidList | The id list of high priority users.
  option | The remote subscribe fallback option of high priority users.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableDualStreamMode() [1/2]

abstract int io.agora.rtc2.RtcEngine.enableDualStreamMode | ( | boolean | enabled | ) |
| abstract

Enables or disables the dual video stream mode.

Deprecated:
  v4.2.0. This method is deprecated. Use setDualStreamMode instead.

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.

Parameters

  enabled | true: Enable the dual-stream mode. false: (default) Disable the dual-stream mode.

## ◆ enableDualStreamMode() [2/2]

abstract int io.agora.rtc2.RtcEngine.enableDualStreamMode | ( | boolean | enabled,
|  | SimulcastStreamConfig | streamConfig
| ) |  |
| abstract

Enables or disables the dual video stream mode.

Deprecated:
  v4.2.0. This method is deprecated. Use setDualStreamMode instead.

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.

Parameters

  enabled | true: Enable the dual-stream mode. false: (default) Disable the dual-stream mode.
  streamConfig | The minor stream config

## ◆ setDualStreamMode() [1/2]

abstract int io.agora.rtc2.RtcEngine.setDualStreamMode | ( | Constants.SimulcastStreamMode | mode | ) |
| abstract

Enables, disables or auto enable 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.

Parameters

  mode | The dual-stream mode

## ◆ setDualStreamMode() [2/2]

abstract int io.agora.rtc2.RtcEngine.setDualStreamMode | ( | Constants.SimulcastStreamMode | mode,
|  | SimulcastStreamConfig | streamConfig
| ) |  |
| abstract

Enables, disables or auto enable 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.

Parameters

  mode | The dual-stream mode
  streamConfig | The minor stream config

## ◆ setSimulcastConfig()

abstract int io.agora.rtc2.RtcEngine.setSimulcastConfig | ( | SimulcastConfig | simulcastConfig | ) |
| abstract

Sets the multi-layer video stream configuration.

If multi-layer is configured, the subscriber can choose to receive the coresponding layer of video stream using setRemoteVideoStreamType.

Parameters

  simulcastConfig | The configuration for multi-layer video stream. It includes seven layers, ranging from STREAM_LAYER_1 to STREAM_LOW. A maximum of 3 layers can be enabled simultaneously.

Returns
  - 0: Success.
  - < 0: Failure. @technical preview

## ◆ setLocalRenderTargetFps()

abstract int io.agora.rtc2.RtcEngine.setLocalRenderTargetFps | ( | Constants.VideoSourceType | sourceType,
|  | int | targetFps
| ) |  |
| abstract

Sets the target frames per second (FPS) for the local render target.

Parameters

  sourceType | The type of video source.
  targetFps | The target frames per second to be set for the local render target.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteRenderTargetFps()

abstract int io.agora.rtc2.RtcEngine.setRemoteRenderTargetFps | ( | int | targetFps | ) |
| abstract

Sets the target frames per second (FPS) for the remote render target.

Parameters

  targetFps | The target frames per second to be set for the remote render target.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteVideoStreamType()

abstract int io.agora.rtc2.RtcEngine.setRemoteVideoStreamType | ( | int | uid,
|  | Constants.VideoStreamType | streamType
| ) |  |
| 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.

Note
  This method applies to scenarios where the remote user has enabled the dual-stream mode using enableDualStreamMode(true) before joining the channel.

Parameters

  uid | ID of the remote user sending the video stream.
  streamType | Sets the video stream type: 0: High-stream video. 1: Low-stream video.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setRemoteDefaultVideoStreamType()

abstract int io.agora.rtc2.RtcEngine.setRemoteDefaultVideoStreamType | ( | Constants.VideoStreamType | streamType | ) |
| abstract

Sets the default stream type of the remote video if the remote user has enabled dual-stream.

Parameters

  streamType | Sets the default video stream type: 0: High-stream video. 1: Low-stream video.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSubscribeAudioBlocklist()

abstract int io.agora.rtc2.RtcEngine.setSubscribeAudioBlocklist | ( | int[] | uidList | ) |
| abstract

Sets the blocklist of subscribe remote stream audio.

Parameters

  uidList | The id list of users who do not subscribe to audio.

Note
  If uid is in uidList, the remote user's audio will not be subscribed, even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSubscribeAudioAllowlist()

abstract int io.agora.rtc2.RtcEngine.setSubscribeAudioAllowlist | ( | int[] | uidList | ) |
| abstract

Sets the allowlist of subscribe remote stream audio.

Parameters

  uidList | The id list of users who do subscribe to audio.

Note
  If uid is in uidList, the remote user's audio will be subscribed, even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated.

If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSubscribeVideoBlocklist()

abstract int io.agora.rtc2.RtcEngine.setSubscribeVideoBlocklist | ( | int[] | uidList | ) |
| abstract

Sets the blocklist of subscribe remote stream video.

Parameters

  uidList | The id list of users who do not subscribe to video.

Note
  If uid is in uidList, the remote user's video will not be subscribed, even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setSubscribeVideoAllowlist()

abstract int io.agora.rtc2.RtcEngine.setSubscribeVideoAllowlist | ( | int[] | uidList | ) |
| abstract

Sets the whitelist of subscribe remote stream video.

Parameters

  uidList | The id list of users who do subscribe to video.

Note
  If uid is in uidList, the remote user's video will be subscribed, even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated.

If a user is in the blacklist and whitelist at the same time, the user will not subscribe to video.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableEncryption()

abstract int io.agora.rtc2.RtcEngine.enableEncryption | ( | boolean | enabled,
|  | EncryptionConfig | config
| ) |  |
| abstract

Enables/Disables the built-in encryption.

In scenarios requiring high security, Agora recommends calling `enableEncryption` to enable the built-in encryption before joining a channel.

All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared.

Note
  - If you enable the built-in encryption, you cannot use the RTMP streaming function.

Parameters

  enabled | Whether to enable the built-in encryption. `true`: Enable the built-in encryption. `false`: Disable the built-in encryption.
  config | Configurations of built-in encryption schemas. See {EncryptionConfig}. 0: Success.< 0: Failure.-2(ERR_INVALID_ARGUMENT): An invalid parameter is used. Set the parameter with a valid value.-7(ERR_NOT_INITIALIZED: The SDK is not initialized. Initialize the IRtcEngine instance before calling this method.-4(ERR_NOT_SUPPORTED): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library.

## ◆ startRtmpStreamWithoutTranscoding()

abstract int io.agora.rtc2.RtcEngine.startRtmpStreamWithoutTranscoding | ( | String | url | ) |
| abstract

Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.)

The SDK returns the result of this method call in the onStreamPublished callback.

The startRtmpStreamWithoutTranscoding method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.

Note
  - Ensure that the user joins the channel before calling this method.
  - This method adds only one stream RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.
    - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming.

## ◆ startRtmpStreamWithTranscoding()

abstract int io.agora.rtc2.RtcEngine.startRtmpStreamWithTranscoding | ( | String | url,
|  | LiveTranscoding | transcoding
| ) |  |
| abstract

Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.)

The SDK returns the result of this method call in the onStreamPublished callback.

The startRtmpStreamWithTranscoding method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.

Note
  - Ensure that the user joins the channel before calling this method.
  - This method adds only one stream RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.
  transcodingEnabled | Sets whether transcoding is enabled/disabled: true: Enable transcoding. To transcode the audio or video streams when publishing them to CDN live, often used for combining the audio and video streams of multiple hosts in CDN live. false: Disable transcoding.

Returns
  - 0: Success.
  - < 0: Failure.
    - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0.
    - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.
    - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming.

## ◆ updateRtmpTranscoding()

abstract int io.agora.rtc2.RtcEngine.updateRtmpTranscoding | ( | LiveTranscoding | transcoding | ) |
| abstract

Update the video layout and audio settings for CDN live. (CDN live only.)

Note
  This method applies to Live Broadcast only.

Parameters

  transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopRtmpStream()

abstract int io.agora.rtc2.RtcEngine.stopRtmpStream | ( | String | url | ) |
| abstract

Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.)

This method removes the RTMP URL address (added by the startRtmpStreamWithoutTranscoding method or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. The SDK returns the result of this method call in the onStreamUnpublished callback.

The stopRtmpStream method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of removing an RTMP stream from the CDN.

Note
  - This method removes only one RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ createDataStream() [1/2]

abstract int io.agora.rtc2.RtcEngine.createDataStream | ( | boolean | reliable,
|  | boolean | ordered
| ) |  |
| abstract

Creates a data stream.

You can call this method to create a data stream and improve the reliability and ordering of data transmission.

Note
  - Ensure that you set the same value for `reliable` and `ordered`.
  - Each user can only create a maximum of 5 data streams during an RtcEngine lifecycle.
  - The data channel allows a data delay of up to 5 seconds. If the receiver does not receive the data stream within 5 seconds, the data channel reports an error.

Parameters

  reliable | Sets whether the recipients are guaranteed to receive the data stream from the sender within five seconds: true: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the application. false: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream.
  ordered | Sets whether the recipients receive the data stream in the sent order: true: The recipients receive the data stream in the sent order. false: The recipients do not receive the data stream in the sent order.

Returns
  - Returns the stream ID, if the method call is successful.
  - <0: Failure.

## ◆ createDataStream() [2/2]

abstract int io.agora.rtc2.RtcEngine.createDataStream | ( | DataStreamConfig | config | ) |
| abstract

Creates a data stream.

Each user can create up to five data streams during the lifecycle of the RtcEngine.

Parameters

  config | The config of data stream.

Returns
  - Returns the stream ID, if the method call is successful.
  - < 0: Failure. The error code is related to the integer displayed in {Error Codes}. For example, if it returns -2, then it indicates Constants#ERR_INVALID_ARGUMENT ERR_INVALID_ARGUMENT(-2)} in { IRtcEngineEventHandler#onError(int) Error Codes}.

## ◆ sendStreamMessage()

abstract int io.agora.rtc2.RtcEngine.sendStreamMessage | ( | int | streamId,
|  | byte[] | message
| ) |  |
| 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:

- Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB.
- Each client can send up to 30 KB of data per second.
- Each user can have up to five data streams simultaneously.

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 { IRtcEngineEventHandler#onStreamMessageError() onStreamMessageError} callback. Call this method after calling RtcEngine#createDataStream() createDataStream}.This method applies only to the `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 { RtcEngine#createDataStream(boolean reliable, boolean ordered) createDataStream} method. message Sent data. 0: Success.< 0: Failure.

## ◆ setVideoQualityParameters()

abstract int io.agora.rtc2.RtcEngine.setVideoQualityParameters | ( | boolean | preferFrameRateOverImageQuality | ) |
| abstract

Sets the video quality preferences.

Parameters

  preferFrameRateOverImageQuality | The video preference to be set: True: Frame rate over image quality False: Image quality over frame rate (default)

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setLocalVideoMirrorMode()

abstract int io.agora.rtc2.RtcEngine.setLocalVideoMirrorMode | ( | int | mode | ) |
| 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.

Parameters

  mode | Sets the local video mirror mode: `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK. If you use the front camera, the SDK enables the mirror mode; if you use the rear camera, the SDK disables the mirror mode. `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode. `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getRecommendedEncoderType()

static int io.agora.rtc2.RtcEngine.getRecommendedEncoderType | ( |  | ) |
| static

Gets the recommended encoder type.

Deprecated:
  This method is deprecated.

Returns
  The encoder type:
  - HARDWARE ENCODER(1): The hardware encoder.
  - SOFTWARE ENCODER(2): The software encoder.

## ◆ switchCamera() [1/2]

abstract int io.agora.rtc2.RtcEngine.switchCamera | ( |  | ) |
| abstract

Switches between front and rear cameras.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ switchCamera() [2/2]

abstract int io.agora.rtc2.RtcEngine.switchCamera | ( | String | cameraId | ) |
| abstract

Switches to appoint cameraId

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ isCameraZoomSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraZoomSupported | ( |  | ) |
| abstract

Checks whether the camera zoom function is supported.

Returns
  - true: The camera zoom function is supported.
  - false: The camera zoom function is not supported.

## ◆ isCameraTorchSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraTorchSupported | ( |  | ) |
| abstract

Checks whether the camera flash function is supported.

Returns
  - true: The camera flash function is supported.
  - false: The camera flash function is not supported.

## ◆ isCameraFocusSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraFocusSupported | ( |  | ) |
| abstract

Checks whether the camera manual focus function is supported.

Returns
  - true: The camera manual focus function is supported.
  - false: The camera manual focus function is not supported.

## ◆ isCameraExposurePositionSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraExposurePositionSupported | ( |  | ) |
| abstract

Checks whether the camera exposure function is supported.

Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`.

Since
  v2.3.2.

Returns
  - true: The device supports the camera exposure function.
  - false: The device does not support the camera exposure function.

## ◆ isCameraAutoFocusFaceModeSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraAutoFocusFaceModeSupported | ( |  | ) |
| abstract

Checks whether the camera auto focus function is supported.

Returns
  - true: The camera auto focus function is supported.
  - false: The camera auto focus function is not supported.

## ◆ isCameraFaceDetectSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraFaceDetectSupported | ( |  | ) |
| abstract

Checks whether the camera face detect function is supported.

Returns
  - true: The camera face detect is supported.
  - false: The camera face detect is not supported.

## ◆ isCameraExposureSupported()

abstract boolean io.agora.rtc2.RtcEngine.isCameraExposureSupported | ( |  | ) |
| abstract

Checks whether camera supports to set exposure value.

Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`.

Since
  v4.2.2

Returns
  - true: The device supports the camera exposure function.
  - false: The device does not support the camera exposure function.

## ◆ setCameraZoomFactor()

abstract int io.agora.rtc2.RtcEngine.setCameraZoomFactor | ( | float | factor | ) |
| abstract

Sets the camera zoom ratio.

Parameters

  factor | The camera zoom factor. It ranges from 1.0 to the maximum zoom supported by the camera.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getCameraMaxZoomFactor()

abstract float io.agora.rtc2.RtcEngine.getCameraMaxZoomFactor | ( |  | ) |
| abstract

Gets the maximum zoom ratio supported by the camera.

Returns
  The maximum zoom ratio supported by the camera.

## ◆ setCameraFocusPositionInPreview()

abstract int io.agora.rtc2.RtcEngine.setCameraFocusPositionInPreview | ( | float | positionX,
|  | float | positionY
| ) |  |
| abstract

Sets the manual focus position.

Parameters

  positionX | The horizontal coordinate of the touch point in the view.
  positionY | The vertical coordinate of the touch point in the view.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setCameraExposurePosition()

abstract int io.agora.rtc2.RtcEngine.setCameraExposurePosition | ( | float | positionXinView,
|  | float | positionYinView
| ) |  |
| abstract

Sets the camera exposure position.

Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`.

A successful setCameraExposurePosition method call triggers the onCameraExposureAreaChanged callback on the local client.

Since
  v2.3.2.

Parameters

  positionXinView | The horizontal coordinate of the touch point in the view.
  positionYinView | The vertical coordinate of the touch point in the view.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableFaceDetection()

abstract int io.agora.rtc2.RtcEngine.enableFaceDetection | ( | boolean | enabled | ) |
| abstract

Enables the camera face detect.

Parameters

  enabled | Determines whether to enable the camera face detect. true: Enable the face detect. false: Do not enable the face detect.

## ◆ setCameraTorchOn()

abstract int io.agora.rtc2.RtcEngine.setCameraTorchOn | ( | boolean | isOn | ) |
| abstract

Enables the camera flash.

Parameters

  isOn | Determines whether to enable the camera flash. true: Enable the flash. false: Do not enable the flash.

## ◆ setCameraAutoFocusFaceModeEnabled()

abstract int io.agora.rtc2.RtcEngine.setCameraAutoFocusFaceModeEnabled | ( | boolean | enabled | ) |
| abstract

Enables the camera auto focus face function.

Parameters

  enabled | Determines whether to enable the camera auto focus face mode. true: Enable the auto focus face function. false: Do not enable the auto focus face function.

## ◆ setCameraExposureFactor()

abstract int io.agora.rtc2.RtcEngine.setCameraExposureFactor | ( | int | factor | ) |
| abstract

Sets the camera exposure ratio.

Since
  v4.2.2

Note
  In a general way，range must follow below requirements [-20, 20]. but for low machines, the range of support is smaller, or not supported.

Parameters

  factor | exposureFactor the recommended camera exposure factor ranging from -20 to 20 Absolute EV bias will set to camera.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getCallId()

abstract String io.agora.rtc2.RtcEngine.getCallId | ( |  | ) |
| 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.

Returns
  - The call ID if the method call is successful.
  - < 0: Failure.

## ◆ rate()

abstract int io.agora.rtc2.RtcEngine.rate | ( | String | callId,
|  | int | rating,
|  | String | description
| ) |  |
| abstract

Allows a user to rate the call.

It is usually called after the call ends.

Parameters

  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ complain()

abstract int io.agora.rtc2.RtcEngine.complain | ( | String | callId,
|  | String | description
| ) |  |
| abstract

Allows a user to complain about the call quality.

This method is usually called after the call ends.

Parameters

  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getSdkVersion()

static String io.agora.rtc2.RtcEngine.getSdkVersion | ( |  | ) |
| static

Gets the SDK version.

Returns
  The version of the current SDK in the string format.

## ◆ getMediaEngineVersion()

static String io.agora.rtc2.RtcEngine.getMediaEngineVersion | ( |  | ) |
| static

Returns the media engine version.

Returns
  The string of the version number in char format.

## ◆ setLogFile()

abstract int io.agora.rtc2.RtcEngine.setLogFile | ( | String | filePath | ) |
| 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.

Note
  Ensure that you call this method immediately after create, or the output log may not be complete.

Parameters

  filePath | File path of the log file. The string of the log file is in UTF-8.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLogFilter()

abstract int io.agora.rtc2.RtcEngine.setLogFilter | ( | int | filter | ) |
| 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`.

Parameters

  filter | Sets the log filter level: `LOG_FILTER_DEBUG(0x80f)`: Output all API logs. Set your log filter as DEBUG if you want to get the most complete log file. `LOG_FILTER_INFO(0x0f)`: Output logs of the CRITICAL, ERROR, WARNING, and INFO level. We recommend setting your log filter as this level. `LOG_FILTER_WARNING(0x0e)`: Output logs of the CRITICAL, ERROR, and WARNING level. `LOG_FILTER_ERROR(0x0c)`: Output logs of the CRITICAL and ERROR level. `LOG_FILTER_CRITICAL(0x08)`: Output logs of the CRITICAL level. `LOG_FILTER_OFF(0)`: Do not output any log.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLogLevel()

abstract int io.agora.rtc2.RtcEngine.setLogLevel | ( | int | level | ) |
| abstract

Sets the output log level of the SDK.

You can use one of the level defined in LogLevel.

Parameters

  level | Sets the log level: LogLevel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLogFileSize()

abstract int io.agora.rtc2.RtcEngine.setLogFileSize | ( | long | fileSizeInKBytes | ) |
| abstract

Sets the log file size (KB).

The SDK has two log files, each with a default size of 512 KB. If you set `fileSizeInBytes` 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.

Parameters

  fileSizeInKBytes | The SDK log file size (KB).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ uploadLogFile()

abstract String io.agora.rtc2.RtcEngine.uploadLogFile | ( |  | ) |
| abstract

Upload current log file immediately to server. only use this when an error occurs block before log file upload success or timeout.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ writeLog()

abstract int io.agora.rtc2.RtcEngine.writeLog | ( | int | level,
|  | String | format,
|  | Object... | args
| ) |  |
| abstract

Write the log to SDK . @technical preview

You can use one of the level defined in LogLevel.

Parameters

  level | Sets the log level: LogLevel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getNativeHandle()

abstract long io.agora.rtc2.RtcEngine.getNativeHandle | ( |  | ) |
| abstract

Returns the native handler of the SDK Engine.

This interface is used to get native the C++ handler of the SDK engine that can be used in special scenarios, such as register the audio and video frame observer.

Returns

## ◆ addHandler()

void io.agora.rtc2.RtcEngine.addHandler | ( | IRtcEngineEventHandler | handler | ) |

Adds the IRtcEngineEventHandler.

Parameters

  handler | The IRtcEngineEventHandler instance.

## ◆ removeHandler()

void io.agora.rtc2.RtcEngine.removeHandler | ( | IRtcEngineEventHandler | handler | ) |

Removes the specified IRtcEngineEventHandler object.

For callback events that you only want to listen for once, call this method to remove subsequent IRtcEngineEventHandler objects after you have received them. This interface is used to remove the specific IRtcEngineEventHandler interface class instance.

Parameters

  handler | The IRtcEngineEventHandler object.

## ◆ enableHighPerfWifiMode()

abstract boolean io.agora.rtc2.RtcEngine.enableHighPerfWifiMode | ( | boolean | enable | ) |
| abstract

Enables the Wi-Fi mode.

Deprecated:
  This method is deprecated.

Parameters

  enable | Whether to enable/disable the Wi-Fi mode: `true`: Enable the Wi-Fi mode. `false`: Disable the Wi-Fi mode.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getNativeMediaPlayer()

abstract long io.agora.rtc2.RtcEngine.getNativeMediaPlayer | ( | int | sourceId | ) |
| abstract

Returns the native handler of the mediaplayer.

## ◆ getErrorDescription()

static String io.agora.rtc2.RtcEngine.getErrorDescription | ( | int | error | ) |
| static

Gets the warning or error description.

Parameters

  error | The warning or error code.

Returns
  The detailed warning or error description.

## ◆ queryScreenCaptureCapability()

abstract int io.agora.rtc2.RtcEngine.queryScreenCaptureCapability | ( |  | ) |
| abstract

Queries the ability of screen sharing to support the minimum frame rate.

Since
  v4.2.0

Returns
  - 0: support 15 fps, this device does not support hardcoding.
  - 1: support 30 fps, Usually low - to mid-range devices.
  - 2: support 60 fps, Advanced devices.
  - < 0: Failure.

## ◆ monitorHeadsetEvent()

abstract void io.agora.rtc2.RtcEngine.monitorHeadsetEvent | ( | boolean | monitor | ) |
| abstract

Monitors external headset device events.

Parameters

  monitor | Whether to enable monitoring external headset device events. True/False.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ monitorBluetoothHeadsetEvent()

abstract void io.agora.rtc2.RtcEngine.monitorBluetoothHeadsetEvent | ( | boolean | monitor | ) |
| abstract

Monitors Bluetooth headset device events.

Parameters

  monitor | Whether to enable monitoring Bluetooth headset device events. True/False.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ setPreferHeadset()

abstract void io.agora.rtc2.RtcEngine.setPreferHeadset | ( | boolean | enabled | ) |
| abstract

Sets the default audio route to the headset.

Deprecated:
  This method is deprecated.

Parameters

  enabled | Sets whether or not the default audio route is to the headset: true: Set the default audio route to the headset. false: Do not set the default audio route to the headset.

## ◆ setParameters()

abstract int io.agora.rtc2.RtcEngine.setParameters | ( | String | parameters | ) |
| 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

  parameters | Parameter to be set as a JSON string in the specified format.

Returns
  - 0: Success.
  - <0: Failure.

## ◆ getParameters()

abstract String io.agora.rtc2.RtcEngine.getParameters | ( | String | parameters | ) |
| abstract

Queries internal states

Parameters

  parameters | JSON string

Returns
  A JSON string

## ◆ getParameter()

abstract String io.agora.rtc2.RtcEngine.getParameter | ( | String | parameter,
|  | String | args
| ) |  |
| abstract

Gets the Agora SDK’s parameters for customization purposes. This method is not disclosed yet. Contact support@agora.io for more information.

## ◆ registerMediaMetadataObserver()

abstract int io.agora.rtc2.RtcEngine.registerMediaMetadataObserver | ( | IMetadataObserver | observer,
|  | int | type
| ) |  |
| 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. Call this method before the `joinChannel` method.This method applies to the Live Broadcast profile. observer The IMetadataObserver class. type The metadata type. Currently, the SDK supports { io.agora.rtc2.IMetadataObserver#VIDEO_METADATA VIDEO_METADATA(0)} only. io.agora.rtc2.IMetadataObserver#UNKNOWN_METADATA UNKNOWN_METADATA(-1)}: the metadata type is unknown. io.agora.rtc2.IMetadataObserver#VIDEO_METADATA VIDEO_METADATA(0)}: the metadata type is video. 0: Success.< 0: Failure.

## ◆ unregisterMediaMetadataObserver()

abstract int io.agora.rtc2.RtcEngine.unregisterMediaMetadataObserver | ( | IMetadataObserver | observer,
|  | int | type
| ) |  |
| abstract

Unregisters the metadata observer.

Parameters

  observer | The IMetadataObserver class.
  type | The metadata type. Currently, the SDK supports {VIDEO_METADATA(0)} only. 0: Success.< 0: Failure.

## ◆ startOrUpdateChannelMediaRelay()

abstract int io.agora.rtc2.RtcEngine.startOrUpdateChannelMediaRelay | ( | ChannelMediaRelayConfiguration | channelMediaRelayConfiguration | ) |
| abstract

Starts or update to relay media streams across channels.

After a successful method call, the SDK triggers the {onChannelMediaRelayStateChanged} callback, and this callback return the state of the media stream relay.If the `onChannelMediaRelayStateChanged` callback returns `RELAY_STATE_RUNNING(2)` and `RELAY_OK(0)`, the SDK starts relaying media streams between the original and the destination channel.If the `onChannelMediaRelayStateChanged` callback returns `RELAY_STATE_FAILURE(3)`, an exception occurs during the media stream relay. Contact sales.nosp@m.-us@.nosp@m.agora.nosp@m..io before implementing this function.We do not support string user accounts in this API.Call this method after the `joinChannel` method.This method takes effect only when you are a broadcaster in a Live-broadcast channel. v4.2.0 channelMediaRelayConfiguration The configuration of the media stream relay. See { io.agora.rtc2.video.ChannelMediaRelayConfiguration ChannelMediaRelayConfiguration}. 0: Success.< 0: Failure.-1(ERR_FAILED): A general error occurs (no specified reason).-2(ERR_INVALID_ARGUMENT): The argument is invalid.-5(ERR_REFUSED): The request is rejected.-8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the role is the broadcaster.

## ◆ stopChannelMediaRelay()

abstract int io.agora.rtc2.RtcEngine.stopChannelMediaRelay | ( |  | ) |
| 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() leaveChannel} method, and the media stream relay automatically stops. 0: Success.< 0: Failure.-1(ERR_FAILED): A general error occurs (no specified reason).-2(ERR_INVALID_ARGUMENT): The argument is invalid.-5(ERR_REFUSED): The request is rejected.-7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed.

## ◆ pauseAllChannelMediaRelay()

abstract int io.agora.rtc2.RtcEngine.pauseAllChannelMediaRelay | ( |  | ) |
| abstract

pause the channels for media stream relay.

Returns
  - 0: Success.
  - < 0: Failure.
    - -1(ERR_FAILED): A general error occurs (no specified reason).
    - -2(ERR_INVALID_ARGUMENT): The argument is invalid.
    - -5(ERR_REFUSED): The request is rejected.
    - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed.

## ◆ resumeAllChannelMediaRelay()

abstract int io.agora.rtc2.RtcEngine.resumeAllChannelMediaRelay | ( |  | ) |
| abstract

resume the channels for media stream relay.

Returns
  - 0: Success.
  - < 0: Failure.
    - -1(ERR_FAILED): A general error occurs (no specified reason).
    - -2(ERR_INVALID_ARGUMENT): The argument is invalid.
    - -5(ERR_REFUSED): The request is rejected.
    - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed.

## ◆ updateChannelMediaOptions()

abstract int io.agora.rtc2.RtcEngine.updateChannelMediaOptions | ( | ChannelMediaOptions | options | ) |
| abstract

Updates the channel media options after joining the channel.

Parameters

  options | The channel media options: ChannelMediaOptions.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ muteRecordingSignal()

abstract int io.agora.rtc2.RtcEngine.muteRecordingSignal | ( | boolean | muted | ) |
| abstract

Mute or resume recording signal volume.

Parameters

  muted | Determines whether to mute or resume the recording signal volume. true: Mute the recording signal volume. false: (Default) Resume the recording signal volume.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setPlaybackAudioFrameBeforeMixingParameters()

abstract int io.agora.rtc2.RtcEngine.setPlaybackAudioFrameBeforeMixingParameters | ( | int | sampleRate,
|  | int | channel
| ) |  |
| abstract

Sets the audio playback format before mixing for the onPlaybackAudioFrameBeforeMixing callback.

Parameters

  sampleRate | Sets the sample rate (`samplesPerSec`) returned in the `onPlaybackAudioFrameBeforeMixing` callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.
  channel | Number of channels of the audio data returned in `onPlaybackAudioFrameBeforeMixing`, which can be set as 1 or 2: 1: Mono 2: Stereo

Returns
  - 0: Success.
  - < 0: Failure.

Note
  The SDK calculates the sample interval according to the value of the `sampleRate` and `channel` parameters you set in this method. Ensure that the value of sample interval >= 0.01. The SDK triggers the `onPlaybackAudioFrameBeforeMixing` callback according to the sample interval.

## ◆ enableAudioSpectrumMonitor()

abstract int io.agora.rtc2.RtcEngine.enableAudioSpectrumMonitor | ( | int | intervalInMS | ) |
| abstract

Enable the audio spectrum monitor.

Parameters

  intervalInMS | Sets the time interval(ms) between two consecutive audio spectrum callback. The default value is 100. This param should be larger than 10.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ disableAudioSpectrumMonitor()

abstract int io.agora.rtc2.RtcEngine.disableAudioSpectrumMonitor | ( |  | ) |
| abstract

Disalbe the audio spectrum monitor.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ registerAudioSpectrumObserver()

abstract int io.agora.rtc2.RtcEngine.registerAudioSpectrumObserver | ( | IAudioSpectrumObserver | observer | ) |
| abstract

Registers an audio spectrum observer.

You need to implement the `IAudioSpectrumObserver` class in this method, and register the following callbacks according to your scenario:

- onAudioSpectrumComputed: Occurs when the SDK receives the audio data and at set intervals.

Parameters

  observer | A pointer to the audio spectrum observer: IAudioSpectrumObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ unRegisterAudioSpectrumObserver()

abstract int io.agora.rtc2.RtcEngine.unRegisterAudioSpectrumObserver | ( | IAudioSpectrumObserver | observer | ) |
| abstract

Releases the audio spectrum observer.

Parameters

  observer | The pointer to the audio spectrum observer: IAudioSpectrumObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getEffectsVolume()

abstract double io.agora.rtc2.RtcEngine.getEffectsVolume | ( |  | ) |
| abstract

Gets the volume of the audio effects.

Returns
  - Returns the volume of audio effects, if the method call is successful. The value ranges between 0.0 and 100.0 (original volume).
  - < 0: Failure.

## ◆ setEffectsVolume()

abstract int io.agora.rtc2.RtcEngine.setEffectsVolume | ( | double | volume | ) |
| abstract

Sets the volume of audio effects.

Parameters

  volume | The volume of audio effects. The value ranges between 0.0 and 100.0 (default).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ preloadEffect() [1/2]

abstract int io.agora.rtc2.RtcEngine.preloadEffect | ( | int | soundId,
|  | String | filePath
| ) |  |
| 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.

Note
  - To ensure smooth communication, limit the size of the audio effect file.
  - Agora recommends calling this method before joining the channel.

Parameters

  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.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ preloadEffect() [2/2]

abstract int io.agora.rtc2.RtcEngine.preloadEffect | ( | int | soundId,
|  | String | filePath,
|  | int | startPos
| ) |  |
| 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.

Note
  - To ensure smooth communication, limit the size of the audio effect file.
  - Agora recommends calling this method before joining the channel.

Parameters

  soundId | The ID of the audio effect.
  filePath | The absolute path of the local audio effect file or the URL
  startPos | The start position of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ playEffect() [1/2]

abstract int io.agora.rtc2.RtcEngine.playEffect | ( | int | soundId,
|  | String | filePath,
|  | int | loopCount,
|  | double | pitch,
|  | double | pan,
|  | double | gain,
|  | boolean | publish
| ) |  |
| 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.

Note
  - Agora recommends playing no more than three audio effects at the same time.
  - The ID and file path of the audio effect in this method must be the same as that in the preloadEffect method.

Parameters

  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: `-1`: Play the audio effect in an indefinite loop until you call {stopEffect} or RtcEngine#stopAllEffects() stopAllEffects}.`0`: Play the audio effect once.`1`: Play the audio effect twice. 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:`-1.0`: The audio effect shows on the left.`0.0`: The audio effect shows ahead.`1.0`: The audio effect shows on the right. 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:True: Publish the audio effect to the remote.False: false: Do not publish the audio effect to the remote. 0: Success.< 0: Failure.

## ◆ playEffect() [2/2]

abstract int io.agora.rtc2.RtcEngine.playEffect | ( | int | soundId,
|  | String | filePath,
|  | int | loopCount,
|  | double | pitch,
|  | double | pan,
|  | double | gain,
|  | boolean | publish,
|  | int | startPos
| ) |  |
| 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.

Note
  - Agora recommends playing no more than three audio effects at the same time.
  - The ID and file path of the audio effect in this method must be the same as that in the preloadEffect method.

Parameters

  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: `-1`: Play the audio effect in an indefinite loop until you call {stopEffect} or RtcEngine#stopAllEffects() stopAllEffects}.`0`: Play the audio effect once.`1`: Play the audio effect twice. 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:`-1.0`: The audio effect shows on the left.`0.0`: The audio effect shows ahead.`1.0`: The audio effect shows on the right. 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:True: Publish the audio effect to the remote.False: false: Do not publish the audio effect to the remote. startPos The start position 0: Success.< 0: Failure.

## ◆ playAllEffects()

abstract int io.agora.rtc2.RtcEngine.playAllEffects | ( | int | loopCount,
|  | double | pitch,
|  | double | pan,
|  | double | gain,
|  | boolean | publish
| ) |  |
| 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.

Parameters

  loopCount | The number of times the audio effect loops: `-1`: Play the audio effect in an indefinite loop until you call {stopEffect} or RtcEngine#stopAllEffects() stopAllEffects}.`0`: Play the audio effect once.`1`: Play the audio effect twice. 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:`-1.0`: The audio effect shows on the left.`0.0`: The audio effect shows ahead.`1.0`: The audio effect shows on the right. 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:True: Publish the audio effect to the remote.False: Do not publish the audio effect to the remote. 0: Success.< 0: Failure.

## ◆ getVolumeOfEffect()

abstract int io.agora.rtc2.RtcEngine.getVolumeOfEffect | ( | int | soundId | ) |
| abstract

Get the volume of a specified sound effect.

Parameters

  soundId | The ID of the audio effect.

Returns
  - Returns the volume of the specified audio effect, if the method call is successful. The value ranges between 0.0 and 100.0 (original volume).
  - < 0: Failure.

## ◆ setVolumeOfEffect()

abstract int io.agora.rtc2.RtcEngine.setVolumeOfEffect | ( | int | soundId,
|  | double | volume
| ) |  |
| abstract

Sets the volume of the specified audio effect.

Parameters

  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).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pauseEffect()

abstract int io.agora.rtc2.RtcEngine.pauseEffect | ( | int | soundId | ) |
| abstract

Pauses playing the specified audio effect.

Parameters

  soundId | The ID of the audio effect.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ pauseAllEffects()

abstract int io.agora.rtc2.RtcEngine.pauseAllEffects | ( |  | ) |
| abstract

Pauses playing all audio effects.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ resumeEffect()

abstract int io.agora.rtc2.RtcEngine.resumeEffect | ( | int | soundId | ) |
| abstract

Resumes playing the specified audio effect.

Parameters

  soundId | The ID of the audio effect.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ resumeAllEffects()

abstract int io.agora.rtc2.RtcEngine.resumeAllEffects | ( |  | ) |
| abstract

Resumes playing all audio effects.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopEffect()

abstract int io.agora.rtc2.RtcEngine.stopEffect | ( | int | soundId | ) |
| abstract

Stops playing the specified audio effect.

Parameters

  soundId | The ID of the audio effect.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopAllEffects()

abstract int io.agora.rtc2.RtcEngine.stopAllEffects | ( |  | ) |
| abstract

Stops playing all audio effects.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ unloadEffect()

abstract int io.agora.rtc2.RtcEngine.unloadEffect | ( | int | soundId | ) |
| abstract

Releases the specific preloaded audio effect from the memory.

Parameters

  soundId | The ID of the audio effect.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ unloadAllEffects()

abstract int io.agora.rtc2.RtcEngine.unloadAllEffects | ( |  | ) |
| abstract

Releases all preloaded audio effects from the memory.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getEffectDuration()

abstract int io.agora.rtc2.RtcEngine.getEffectDuration | ( | String | filePath | ) |
| abstract

Gets the duration of the audio effect file.

Note
  - Call this method after joining a channel.
  - For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.

Parameters

  filePath | The file path of a local file, including the filename extensions. Agora supports using a URI address, an absolute path, or a path that starts with /assets/. Note: You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example: "content://com.android.providers.media.documents/document/audio%3A14441".

Returns
  - ≥ 0: A successful method call. Returns the total duration (ms) of the specified audio effect file.
  - < 0: Failure.

## ◆ setEffectPosition()

abstract int io.agora.rtc2.RtcEngine.setEffectPosition | ( | int | soundId,
|  | int | pos
| ) |  |
| abstract

Sets the playback position of an audio effect file.

After a successful setting, the local audio effect file starts playing at the specified position.

Note
  Call this method after `playEffect`.

Parameters

  soundId | Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`.
  pos | The playback position (ms) of the audio effect file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getEffectCurrentPosition()

abstract int io.agora.rtc2.RtcEngine.getEffectCurrentPosition | ( | int | soundId | ) |
| abstract

Gets the playback position of the audio effect file.

Note
  Call this method after `playEffect`.

Parameters

  soundId | Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`.

Returns
  - ≥ 0: A successful method call. Returns the playback position (ms) of the specified audio effect file.
  - < 0: Failure.

## ◆ registerVideoEncodedFrameObserver()

abstract int io.agora.rtc2.RtcEngine.registerVideoEncodedFrameObserver | ( | IVideoEncodedFrameObserver | receiver | ) |
| abstract

Registers a receiver object for the encoded video image.

Note
  - Ensure that you call this method before joining the channel.
  - If you register a receiver for encoded video data, you cannot register an IVideoFrameObserver object.

Parameters

  receiver | The IVideoEncodedFrameObserver object: {IVideoEncodedFrameObserver}. 0: Success.< 0: Failure.

## ◆ registerFaceInfoObserver()

abstract int io.agora.rtc2.RtcEngine.registerFaceInfoObserver | ( | IFaceInfoObserver | receiver | ) |
| abstract

Registers an face info observer object.

Note
  Ensure that you call this method before joinChannel.

Parameters

  observer | A pointer to the face info observer object: IFaceInfoObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ takeSnapshot() [1/2]

abstract int io.agora.rtc2.RtcEngine.takeSnapshot | ( | int | uid,
|  | String | filePath
| ) |  |
| abstract

Takes a snapshot of a video stream.

This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.

The method is asynchronous, and the SDK has not taken the snapshot when the method call returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.

Note
  - Call this method after joining a channel.
  - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`.
  - If the user's video has been preprocessed, for example, watermarked or beautified, the resulting snapshot includes the pre-processing effect.

Parameters

  uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
  filePath | The local path (including filename extensions) of the snapshot. For example: Windows: `C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.jpg` iOS: `/App Sandbox/Library/Caches/example.jpg` macOS: `～/Library/Logs/example.jpg` Android: `/storage/emulated/0/Android/data/<package name>/files/example.jpg`

Ensure that the path you specify exists and is writable.

Returns
  - 0 : Success.
  - < 0 : Failure.

## ◆ takeSnapshot() [2/2]

abstract int io.agora.rtc2.RtcEngine.takeSnapshot | ( | int | uid,
|  | SnapshotConfig | config
| ) |  |
| abstract

Takes a snapshot of a video stream.

This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.

The method is asynchronous, and the SDK has not taken the snapshot when the method call returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback to report whether the snapshot is successfully taken, as well as the details for that snapshot.

Note
  - Call this method after joining a channel.
  - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`.

Parameters

  uid | The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
  config | The configuration for the take snapshot. See SnapshotConfig.

Ensure that the path you specify exists and is writable.

Returns
  - 0 : Success.
  - < 0: Failure.
    - -4: Incorrect observation position. Modify the input observation position according to the reqiurements specified in SnapshotConfig.

## ◆ registerExtension()

abstract int io.agora.rtc2.RtcEngine.registerExtension | ( | String | provider,
|  | String | extension,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Registers an extension. Normally, you should call this function immediately after initializing the engine. Once an extension is registered, the SDK will automatically create and add it to the pipeline.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. 0: Success.< 0: Failure.

## ◆ enableExtension() [1/3]

abstract int io.agora.rtc2.RtcEngine.enableExtension | ( | String | provider,
|  | String | extension,
|  | boolean | enable
| ) |  |
| abstract

Enable/Disable an extension. By calling this function, you can dynamically enable/disable the extension without changing the pipeline. For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A.

NOTE: For compatibility reasons, if you haven't call registerExtension, enableExtension will automatically register the specified extension. We suggest you call registerExtension explicitly.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  enable | Whether to enable the extension: true: (Default) Enable the extension. false: Disable the extension.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableExtension() [2/3]

abstract int io.agora.rtc2.RtcEngine.enableExtension | ( | String | provider,
|  | String | extension,
|  | boolean | enable,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Enable/Disable an extension. By calling this function, you can dynamically enable/disable the extension without changing the pipeline. For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A.

NOTE: For compatibility reasons, if you haven't call registerExtension, enableExtension will automatically register the specified extension. We suggest you call registerExtension explicitly.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  enable | Whether to enable the extension: true: (Default) Enable the extension. false: Disable the extension.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. 0: Success.< 0: Failure.

## ◆ setExtensionProperty() [1/3]

abstract int io.agora.rtc2.RtcEngine.setExtensionProperty | ( | String | provider,
|  | String | extension,
|  | String | key,
|  | String | value
| ) |  |
| abstract

Sets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  key | The key of the extension.
  value | The JSON formatted value of the extension key.

Returns
  true, if get property success, otherwise false

## ◆ setExtensionProperty() [2/3]

abstract int io.agora.rtc2.RtcEngine.setExtensionProperty | ( | String | provider,
|  | String | extension,
|  | String | key,
|  | String | value,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Sets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  key | The key of the extension.
  value | The JSON formatted value of the extension key.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. true, if get property success, otherwise false

## ◆ getExtensionProperty() [1/3]

abstract String io.agora.rtc2.RtcEngine.getExtensionProperty | ( | String | provider,
|  | String | extension,
|  | String | key
| ) |  |
| abstract

Gets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  key | The key of the extension.

Returns
  JSON formatted string of property's value; return null if failed

## ◆ getExtensionProperty() [2/3]

abstract String io.agora.rtc2.RtcEngine.getExtensionProperty | ( | String | provider,
|  | String | extension,
|  | String | key,
|  | Constants.MediaSourceType | sourceType
| ) |  |
| abstract

Gets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  key | The key of the extension.
  sourceType | The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. See {}. JSON formatted string of property's value; return null if failed

## ◆ setExtensionProviderProperty()

abstract int io.agora.rtc2.RtcEngine.setExtensionProviderProperty | ( | String | provider,
|  | String | key,
|  | String | value
| ) |  |
| abstract

Sets the provider property of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  key | The key of the extension.
  value | The JSON formatted value of the extension key.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableExtension() [3/3]

abstract int io.agora.rtc2.RtcEngine.enableExtension | ( | String | provider,
|  | String | extension,
|  | ExtensionInfo | extensionInfo,
|  | boolean | enable
| ) |  |
| abstract

Enable/Disable an extension. By calling this function, you can dynamically enable/disable the extension without changing the pipeline. For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A.

NOTE: For compatibility reasons, if you haven't call registerExtension, enableExtension will automatically register the specified extension. We suggest you call registerExtension explicitly.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  extensionInfo | The information for extension. See ExtensionInfo.
  enable | Whether to enable the extension: true: (Default) Enable the extension. false: Disable the extension.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setExtensionProperty() [3/3]

abstract int io.agora.rtc2.RtcEngine.setExtensionProperty | ( | String | provider,
|  | String | extension,
|  | ExtensionInfo | extensionInfo,
|  | String | key,
|  | String | value
| ) |  |
| abstract

Sets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  extensionInfo | The information for extension. See ExtensionInfo.
  key | The key of the extension.
  value | The JSON formatted value of the extension key.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getExtensionProperty() [3/3]

abstract String io.agora.rtc2.RtcEngine.getExtensionProperty | ( | String | provider,
|  | String | extension,
|  | ExtensionInfo | extensionInfo,
|  | String | key
| ) |  |
| abstract

Gets the properties of an extension.

Parameters

  provider | The name of the extension provider, e.g. agora.io.
  extension | The name of the extension, e.g. agora.beauty.
  extensionInfo | The information for extension. See ExtensionInfo.
  key | The key of the extension.

Returns
  JSON formatted string of property's value; return null if failed

## ◆ startScreenCapture()

abstract int io.agora.rtc2.RtcEngine.startScreenCapture | ( | ScreenCaptureParameters | screenCaptureParameters | ) |
| abstract

Starts screen sharing.

Since
  v3.7.0

During screen sharing, make sure the user has granted screen capture permission to the application and the Android API level is not earlier than 21; otherwise, the SDK reports error codes ERR_SCREEN_CAPTURE_PERMISSION_DENIED(16) and ERR_SCREEN_CAPTURE_SYSTEM_NOT_SUPPORTED(2). To capture system audio during screen sharing, ensure that the Android API level is not earlier than 29 as well; otherwise, the SDK reports the error code ERR_SCREEN_CAPTURE_SYSTEM_AUDIO_NOT_SUPPORTED(3).

Note
  - Call this method after joining a channel.
  - On Android 9 and later, to avoid the application being killed by the system after going to the background, Agora recommends you add the foreground service permission (`android.permission.FOREGROUND_SERVICE`) to the `/app/Manifests/AndroidManifest.xml` file.
  - The billing of the screen sharing stream is based on the values of width and height in `ScreenCaptureParameters`. When you do not pass in these value, Agora bills you at 1280 × 720; when you pass in these values, Agora bills you at those value. For details, see Pricing for Real-time Communication.
  - Due to performance limitations, screen sharing is not supported on Android TV.
  - Due to system limitations, if you are using Huawei phones, do not adjust the video encoding resolution of the screen sharing stream during the screen sharing, or you could experience crashes.

Parameters

  screenCaptureParameters | The configuration of the screen sharing. See {ScreenCaptureParameters}. 0: Success.< 0: Failure.

## ◆ setExternalMediaProjection()

abstract int io.agora.rtc2.RtcEngine.setExternalMediaProjection | ( | MediaProjection | mediaProjection | ) |
| abstract

Sets screen sharing using the Android native class MediaProjection.

When screen scapture stopped, the SDK will automatically release the MediaProjection internally.

Parameters

  mediaProjection | MediaProjection is an Android class that provides access to screen capture and recording capabiliies.

Note
  Additional MediaProjection is primarily used for specific scenarios, such as IOT custom devices or subprocess screen sharing.

Returns
  - 0: Success.
  - < 0: Failure. @technical preview

## ◆ setScreenCaptureScenario()

abstract int io.agora.rtc2.RtcEngine.setScreenCaptureScenario | ( | Constants.ScreenScenarioType | screenScenario | ) |
| abstract

Sets the screen sharing scenario.

Since
  v4.2.0

When you start screen sharing, you can call this method to set the screen sharing scenario. The SDK adjusts the video quality and experience of the sharing according to the scenario.

Parameters

  screenScenario | The screen sharing scenario. See #ScreenScenarioType.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopScreenCapture()

abstract int io.agora.rtc2.RtcEngine.stopScreenCapture | ( |  | ) |
| abstract

Stops screen sharing.

Since
  v3.7.0

After calling this method to stop screen sharing

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setVideoScenario()

abstract int io.agora.rtc2.RtcEngine.setVideoScenario | ( | Constants.VideoScenario | scenarioType | ) |
| abstract

You can call this method to set the expected video scenario. The SDK will optimize the video experience for each scenario you set.

Parameters

  scenarioType | The video application scenario.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setVideoQoEPreference()

abstract int io.agora.rtc2.RtcEngine.setVideoQoEPreference | ( | Constants.QoEPreference | qoePreference | ) |
| abstract

Sets the video qoe preference.

Since
  v4.2.1 You can call this method to set the expected QoE Preference. The SDK will optimize the video experience for each preference you set.

Parameters

  qoePreference | he qoe preference type.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ updateScreenCaptureParameters()

abstract int io.agora.rtc2.RtcEngine.updateScreenCaptureParameters | ( | ScreenCaptureParameters | screenCaptureParameters | ) |
| abstract

Updates the screen sharing configuration.

Since
  v3.7.0

Note
  Call this method after startScreenCapture.

Parameters

  screenCaptureParameters | The configuration of the screen sharing. See {ScreenCaptureParameters}. Note: This parameter is only available for scenarios where `captureVideo` is `true`. 0: Success.< 0: Failure.

## ◆ registerVideoFrameObserver()

abstract int io.agora.rtc2.RtcEngine.registerVideoFrameObserver | ( | IVideoFrameObserver | observer | ) |
| 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.

Note
  When handling the video data returned in the callbacks, pay attention to the changes in the `width` and `height` parameters, which may be adapted under the following circumstances:
  - When the network condition deteriorates, the video resolution decreases incrementally.
  - If the user adjusts the video profile, the resolution of the video returned in the callbacks also changes.

Parameters

  observer | Video frame observer object instance. See {IVideoFrameObserver}. 0: Success.< 0: Failure.

## ◆ createMediaPlayer()

abstract IMediaPlayer io.agora.rtc2.RtcEngine.createMediaPlayer | ( |  | ) |
| abstract

Create a media player

You can use this function to create a ffmpeg or simple media player

Returns
  IMediaPlayer

## ◆ createMediaRecorder()

abstract AgoraMediaRecorder io.agora.rtc2.RtcEngine.createMediaRecorder | ( | RecorderStreamInfo | info | ) |
| abstract

Create a media recorder

You can use this function to create a media recorder

Parameters

  info | The RecorderStreamInfo object. It contains user ID and channel name of user.

Returns
  AgoraMediaRecorder

## ◆ destroyMediaRecorder()

abstract void io.agora.rtc2.RtcEngine.destroyMediaRecorder | ( | AgoraMediaRecorder | mediaRecorder | ) |
| abstract

Destroy a media player source instance. This method releases the `RtcEngine` object and all other resources used by the `AgoraMediaRecorder` object. After calling this method, if you want to enable the recording again, you must call getMediaRecorder to get the `AgoraMediaRecorder` object.

Parameters

  mediaRecorder | The Object of AgoraMediaRecorder.

Returns
  - >0: The id of media player source instance.
  - < 0: Failure.

## ◆ getMediaPlayerCacheManager()

abstract IMediaPlayerCacheManager io.agora.rtc2.RtcEngine.getMediaPlayerCacheManager | ( |  | ) |
| abstract

get an MediaPlayerCacheManager instance, which is used to set and manage the player cache, implemented in the form of a singleton, independent of the player.

Returns
  IMediaPlayer

## ◆ getH265Transcoder()

abstract IH265Transcoder io.agora.rtc2.RtcEngine.getH265Transcoder | ( |  | ) |
| abstract

get an H265Transcoder instance, which is used to

Returns
  IH265Transcoder

## ◆ enableExternalAudioSourceLocalPlayback()

abstract int io.agora.rtc2.RtcEngine.enableExternalAudioSourceLocalPlayback | ( | boolean | enabled | ) |
| abstract

Enable or disable the external audio source local playback.

- Parameters

    enabled | Determines whether to enable the external audio source local playback:

- true: Enable the external audio source local playback.
- false: (default) Disable the external audio source local playback.
  Returns
- 0: Success.
- <0: Failure.

## ◆ adjustCustomAudioPublishVolume()

abstract int io.agora.rtc2.RtcEngine.adjustCustomAudioPublishVolume | ( | int | trackId,
|  | int | volume
| ) |  |
| abstract

Adjust the custom audio publish volume by source id.

Parameters

  trackId | The custom audio track id.
  volume | The volume, range is [0,100]: 0: mute, 100: The original volume

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ adjustCustomAudioPlayoutVolume()

abstract int io.agora.rtc2.RtcEngine.adjustCustomAudioPlayoutVolume | ( | int | trackId,
|  | int | volume
| ) |  |
| abstract

Adjust the custom audio playout volume by source id.

Parameters

  trackId | The custom audio track id.
  volume | The volume, range is [0,100]: 0: mute, 100: The original volume

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startRhythmPlayer()

abstract int io.agora.rtc2.RtcEngine.startRhythmPlayer | ( | String | sound1,
|  | String | sound2,
|  | AgoraRhythmPlayerConfig | config
| ) |  |
| abstract

Enables the rhythm player.

Parameters

  sound1 | The absolute path or URL address (including the filename extensions) of the file for the downbeat.
  sound2 | The absolute path or URL address (including the filename extensions) of the file for the upbeats.
  { |

## ◆ stopRhythmPlayer()

abstract int io.agora.rtc2.RtcEngine.stopRhythmPlayer | ( |  | ) |
| abstract

Disables the rhythm player.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ configRhythmPlayer()

abstract int io.agora.rtc2.RtcEngine.configRhythmPlayer | ( | AgoraRhythmPlayerConfig | config | ) |
| abstract

Configures the rhythm player.

Parameters

  { |

## ◆ setDirectCdnStreamingAudioConfiguration()

abstract int io.agora.rtc2.RtcEngine.setDirectCdnStreamingAudioConfiguration | ( | int | profile | ) |
| abstract

Set audio parameters for direct streaming to CDN

Must call this api before "startDirectCdnStreaming"

Parameters

  profile | Sets the sample rate, bitrate, encoding mode, and the number of channels: #AUDIO_PROFILE_TYPE.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setDirectCdnStreamingVideoConfiguration()

abstract int io.agora.rtc2.RtcEngine.setDirectCdnStreamingVideoConfiguration | ( | VideoEncoderConfiguration | config | ) |
| abstract

Set video parameters for direct streaming to CDN

Each configuration profile corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.

Note
  Must call this api before "startDirectCdnStreaming"

Parameters

  config | The local video encoder configuration: VideoEncoderConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startDirectCdnStreaming()

abstract int io.agora.rtc2.RtcEngine.startDirectCdnStreaming | ( | IDirectCdnStreamingEventHandler | eventHandler,
|  | String | publishUrl,
|  | DirectCdnStreamingMediaOptions | options
| ) |  |
| abstract

Start direct cdn streaming

Parameters

  eventHandler | A pointer to the direct cdn streaming event handler. "IDirectCdnStreamingEventHandler".
  publishUrl | The url of the cdn used to publish the stream.
  options | The direct cdn streaming media options: DirectCdnStreamingMediaOptions. This API must pass an audio-related option, and temporarily cannot pass more than one. For video-related options, you can either choose to not pass any, or only one.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopDirectCdnStreaming()

abstract int io.agora.rtc2.RtcEngine.stopDirectCdnStreaming | ( |  | ) |
| abstract

Stop direct cdn streaming

Note
  This method is synchronous.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ updateDirectCdnStreamingMediaOptions()

abstract int io.agora.rtc2.RtcEngine.updateDirectCdnStreamingMediaOptions | ( | DirectCdnStreamingMediaOptions | options | ) |
| abstract

Change the media source during the pushing

Note
  This method is temporarily not supported

Parameters

  options | The direct cdn streaming media options: DirectCdnStreamingMediaOptions.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ createCustomVideoTrack()

abstract int io.agora.rtc2.RtcEngine.createCustomVideoTrack | ( |  | ) |
| abstract

Get an custom video track id created by internal,which could used to publish or preview

Returns
  - > 0: the useable video track id.
  - < 0: Failure.

## ◆ createCustomEncodedVideoTrack()

abstract int io.agora.rtc2.RtcEngine.createCustomEncodedVideoTrack | ( | EncodedVideoTrackOptions | encodedOpt | ) |
| abstract

Get an custom encoded video track id created by internal,which could used to publish or preview

Returns
  - > 0: the useable video track id.
  - < 0: Failure.

## ◆ destroyCustomVideoTrack()

abstract int io.agora.rtc2.RtcEngine.destroyCustomVideoTrack | ( | int | video_track_id | ) |
| abstract

destroy a created custom video track id

Parameters

  video_track_id | The video track id which was created by createCustomVideoTrack

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ destroyCustomEncodedVideoTrack()

abstract int io.agora.rtc2.RtcEngine.destroyCustomEncodedVideoTrack | ( | int | video_track_id | ) |
| abstract

destroy a created custom encoded video track id

Parameters

  video_track_id | The video track id which was created by createCustomEncodedVideoTrack

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setCloudProxy()

abstract int io.agora.rtc2.RtcEngine.setCloudProxy | ( | int | proxyType | ) |
| abstract

Sets the Agora cloud proxy service.

When the user's firewall restricts the IP address and port, refer to Use Cloud Proxy to add the specific IP addresses and ports to the firewall whitelist; then, call this method to enable the cloud proxy and set the `proxyType` parameter as `TRANSPORT_TYPE_UDP_PROXY(1)`, which is the cloud proxy for the UDP protocol.

After a successfully cloud proxy connection, the SDK triggers the {onConnectionStateChanged}`(CONNECTION_STATE_CONNECTING, CONNECTION_CHANGED_SETTING_PROXY_SERVER)` callback. To disable the cloud proxy that has been set, call `setCloudProxy(NONE_PROXY)`. To change the cloud proxy type that has been set, call `setCloudProxy(NONE_PROXY)` first, and then call `setCloudProxy`, and pass the value that you expect in `proxyType`. Agora recommends that you call this method before joining the channel or after leaving the channel.For the SDK v3.3.x, the services for pushing streams to CDN and co-hosting across channels are not available when you use the cloud proxy for the UDP protocol. For the SDK v3.4.0 and later, the services for pushing streams to CDN and co-hosting across channels are not available when the user is in a network environment with a firewall and uses the cloud proxy for the UDP protocol. proxyType The cloud proxy type. This parameter is required, and the SDK reports an error if you do not pass in a value. The cloud proxy types include: Constants#TRANSPORT_TYPE_NONE_PROXY TRANSPORT_TYPE_NONE_PROXY(0)} Constants#TRANSPORT_TYPE_UDP_PROXY TRANSPORT_TYPE_UDP_PROXY(1)} 0: Success.< 0: Failure.`-2(ERR_INVALID_ARGUMENT)`: The parameter is invalid.`-7(ERR_NOT_INITIALIZED)`: The SDK is not initialized.

## ◆ setLocalAccessPoint()

abstract int io.agora.rtc2.RtcEngine.setLocalAccessPoint | ( | LocalAccessPointConfiguration | config | ) |
| abstract

set local access point addresses in local proxy mode, use this method before join channel.

Parameters

  config | Configurations for local access point. For details, see {LocalAccessPointConfiguration}

## ◆ enableCustomAudioLocalPlayback()

abstract int io.agora.rtc2.RtcEngine.enableCustomAudioLocalPlayback | ( | int | trackId,
|  | boolean | enabled
| ) |  |
| abstract

Sets the external audio track.

Note
  Ensure that you call this method before joining the channel.

Parameters

  trackId | custom audio track id.
  enabled | Enable/Disables the local playback of external audio track: true: Enable local playback false: (Default) Do not enable local playback

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAdvancedAudioOptions()

abstract int io.agora.rtc2.RtcEngine.setAdvancedAudioOptions | ( | AdvancedAudioOptions | options | ) |
| abstract

set advanced audio option

Parameters

  options | advanced audio option.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAVSyncSource()

abstract int io.agora.rtc2.RtcEngine.setAVSyncSource | ( | String | channelId,
|  | int | uid
| ) |  |
| abstract

Bind local user and a remote user as an audio&video sync group. The remote user is defined by cid and uid. There’s a usage limit that local user must be a video stream sender. On the receiver side, media streams from same sync group will be time-synced

Parameters

  channelId | The channel id
  uid | The user ID of the remote user to be bound with (local user)

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableVideoImageSource()

abstract int io.agora.rtc2.RtcEngine.enableVideoImageSource | ( | boolean | enabled,
|  | ImageTrackOptions | options
| ) |  |
| abstract

Enable or disable video image source to replace the current video source published or resume it

Parameters

  enabled | true for enable, false for disable
  options | options for image track

## ◆ enableWirelessAccelerate()

abstract int io.agora.rtc2.RtcEngine.enableWirelessAccelerate | ( | boolean | enabled | ) |
| abstract

Turn WIFI acceleration on or off.

Note
  - This method is called before and after joining a channel.
  - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller.

Parameters

  enabled | true：Turn WIFI acceleration on. false：Turn WIFI acceleration off.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getNetworkType()

abstract int io.agora.rtc2.RtcEngine.getNetworkType | ( |  | ) |
| abstract

Get network type

Returns
  - 0: DISCONNECTED.
  - 1: LAN.
  - 2: WIFI.
  - 3: MOBILE_2G
  - 4: MOBILE_3G
  - 5: MOBILE_4G
  - 6: MOBILE_5G
  - -1: UNKNOWN

## ◆ getNtpWallTimeInMs()

abstract long io.agora.rtc2.RtcEngine.getNtpWallTimeInMs | ( |  | ) |
| abstract

Return current NTP(unix timestamp) time in milliseconds.

## ◆ startMediaRenderingTracing()

abstract int io.agora.rtc2.RtcEngine.startMediaRenderingTracing | ( |  | ) |
| abstract

Start tracing media rendering events.

Since
  v4.1.1 @discussion
  - SDK will trace media rendering events when this API is called.
  - The tracing result can be obtained through callback `IRtcEngineEventHandler.onVideoRenderingTracingResult`

Note
  - By default, SDK will trace media rendering events when `RtcEngine.joinChannel` is called.
  - The start point of event tracing will be reset after leaving channel.

Returns
  - 0: Success.
  - < 0: Failure.
    - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `RtcEngine` instance before calling this method.

## ◆ enableInstantMediaRendering()

abstract int io.agora.rtc2.RtcEngine.enableInstantMediaRendering | ( |  | ) |
| abstract

Enable instant media rendering.

Since
  v4.1.1 @discussion
  - This method enable SDK to render video or playout audio faster.

Note
  - Once enable this mode, we should destroy rtc engine to disable it.
  - Enable this mode, will sacrifice some part of experience.

Returns
  - 0: Success.
  - < 0: Failure.
    - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `RtcEngine` instance before calling this method.

## ◆ setupAudioAttributes()

abstract int io.agora.rtc2.RtcEngine.setupAudioAttributes | ( | AudioAttributes | attr | ) |
| abstract

配置AudioAttribute

Note
  - 该方法在加入频道前调用

Parameters

  AudioAttributes |

Returns
  - 0: 方法调用成功

- < 0: 方法调用失败

## ◆ isFeatureAvailableOnDevice()

abstract boolean io.agora.rtc2.RtcEngine.isFeatureAvailableOnDevice | ( | int | type | ) |
| abstract

Whether the target feature is available for the device.

Since
  v4.3.0

Parameters

  type | The feature type. FEATURE_VIDEO_VIRTUAL_BACKGROUND(1) FEATURE_VIDEO_BEAUTY_EFFECT(2)

Returns
  - true: available.
  - false: not available.

## ◆ sendAudioMetadata()

abstract int io.agora.rtc2.RtcEngine.sendAudioMetadata | ( | byte[] | metadata | ) |
| abstract

Send audio metadata.

Since
  v4.3.1

Parameters

  metadata | Audio Metadata.

Returns
  - 0: Success.
  - < 0: Failure. @technical preview