Package io.agora.rtc2
Class RtcEngine
java.lang.Object
io.agora.rtc2.RtcEngine
- Direct Known Subclasses:
RtcEngineEx
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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(IRtcEngineEventHandler handler) abstract intaddVideoWatermark(AgoraImage watermark) Deprecated.From v2.9.1.abstract intaddVideoWatermark(WatermarkConfig config) abstract intaddVideoWatermark(String watermarkUrl, WatermarkOptions options) Deprecated.From v4.6.0.abstract intadjustAudioMixingPlayoutVolume(int volume) abstract intadjustAudioMixingPublishVolume(int volume) abstract intadjustAudioMixingVolume(int volume) abstract intadjustCustomAudioPlayoutVolume(int trackId, int volume) abstract intadjustCustomAudioPublishVolume(int trackId, int volume) abstract intadjustPlaybackSignalVolume(int volume) abstract intadjustRecordingSignalVolume(int volume) abstract intadjustUserPlaybackSignalVolume(int uid, int volume) abstract intabstract intabstract intstatic RtcEnginecreate(Context context, String appId, IRtcEngineEventHandler handler) static RtcEnginecreate(RtcEngineConfig config) abstract intcreateCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) abstract intGet an custom encoded video track id created by internal,which could used to publish or previewabstract intabstract intcreateDataStream(boolean reliable, boolean ordered) abstract intcreateDataStream(DataStreamConfig config) abstract IMediaPlayerabstract AgoraMediaRecorderabstract IVideoEffectObjectcreateVideoEffectObject(String bundlePath, Constants.MediaSourceType sourceType) static voiddestroy()static voiddestroy(IRtcEngineReleaseCallback callback) abstract intdestroyCustomAudioTrack(int trackId) abstract intdestroyCustomEncodedVideoTrack(int video_track_id) destroy a created custom encoded video track idabstract intdestroyCustomVideoTrack(int video_track_id) abstract voiddestroyMediaRecorder(AgoraMediaRecorder mediaRecorder) abstract intdestroyVideoEffectObject(IVideoEffectObject videoEffectObject) abstract intabstract intabstract intabstract intabstract intenableAudioSpectrumMonitor(int intervalInMS) abstract intenableAudioVolumeIndication(int interval, int smooth, boolean reportVad) abstract intenableContentInspect(boolean enabled, ContentInspectConfig config) abstract intenableCustomAudioLocalPlayback(int trackId, boolean enabled) abstract intenableDualStreamMode(boolean enabled) Deprecated.v4.2.0.abstract intenableDualStreamMode(boolean enabled, SimulcastStreamConfig streamConfig) Deprecated.v4.2.0.abstract intenableEncryption(boolean enabled, io.agora.rtc2.internal.EncryptionConfig config) abstract intenableExtension(String provider, String extension, boolean enable) Enable/Disable an extension.abstract intenableExtension(String provider, String extension, boolean enable, Constants.MediaSourceType sourceType) abstract intenableExtension(String provider, String extension, ExtensionInfo extensionInfo, boolean enable) Enable/Disable an extension.abstract intenableExternalAudioSourceLocalPlayback(boolean enabled) Enable or disable the external audio source local playback.abstract intenableFaceDetection(boolean enabled) abstract booleanenableHighPerfWifiMode(boolean enable) Deprecated.This method is deprecated.abstract intenableInEarMonitoring(boolean enabled) abstract intenableInEarMonitoring(boolean enabled, int includeAudioFilters) abstract intabstract intenableLocalAudio(boolean enabled) abstract intenableLocalVideo(boolean enabled) abstract intenableSoundPositionIndication(boolean enabled) abstract intenableSpatialAudio(boolean enabled) abstract intabstract intenableVideoImageSource(boolean enabled, ImageTrackOptions options) abstract intenableVirtualBackground(boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty) abstract intenableVirtualBackground(boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, Constants.MediaSourceType sourceType) abstract intenableVoiceAITuner(boolean enabled, Constants.VOICE_AI_TUNER_TYPE type) abstract intenableWebSdkInteroperability(boolean enabled) abstract DeviceInfoabstract IAudioEffectManagerabstract intabstract intabstract intabstract intabstract intabstract Stringabstract floatabstract intabstract longabstract intgetEffectCurrentPosition(int soundId) abstract intgetEffectDuration(String filePath) abstract doublestatic StringgetErrorDescription(int error) abstract StringgetExtensionProperty(String provider, String extension, ExtensionInfo extensionInfo, String key) Gets the properties of an extension.abstract StringgetExtensionProperty(String provider, String extension, String key) abstract StringgetExtensionProperty(String provider, String extension, String key, Constants.MediaSourceType sourceType) abstract FaceShapeAreaOptionsgetFaceShapeAreaOptions(int shapeArea) abstract FaceShapeAreaOptionsgetFaceShapeAreaOptions(int shapeArea, Constants.MediaSourceType sourceType) abstract FaceShapeBeautyOptionsabstract FaceShapeBeautyOptionsgetFaceShapeBeautyOptions(Constants.MediaSourceType sourceType) abstract IH265Transcoderget an H265Transcoder instance, which is used tostatic StringDeprecated.abstract IMediaPlayerCacheManagerabstract longabstract longgetNativeMediaPlayer(int sourceId) Returns the native handler of the mediaplayer.abstract intabstract longabstract StringgetParameter(String parameter, String args) Gets the Agora SDK’s parameters for customization purposes.abstract StringgetParameters(String parameters) Queries internal statesstatic intDeprecated.This method is deprecated.static Stringabstract intgetUserInfoByUid(int uid, UserInfo userInfo) abstract intgetUserInfoByUserAccount(String userAccount, UserInfo userInfo) abstract intgetVolumeOfEffect(int soundId) abstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanisFeatureAvailableOnDevice(int type) abstract booleanabstract booleanabstract intjoinChannel(String token, String channelId, int uid, ChannelMediaOptions options) abstract intjoinChannel(String token, String channelId, String optionalInfo, int uid) abstract intjoinChannelWithUserAccount(String token, String channelName, String userAccount) abstract intjoinChannelWithUserAccount(String token, String channelName, String userAccount, ChannelMediaOptions options) abstract intabstract intleaveChannel(LeaveChannelOptions options) abstract intloadExtensionProvider(String path) abstract voidmonitorBluetoothHeadsetEvent(boolean monitor) Deprecated.abstract voidmonitorHeadsetEvent(boolean monitor) Deprecated.abstract intmuteAllRemoteAudioStreams(boolean muted) abstract intmuteAllRemoteVideoStreams(boolean muted) abstract intmuteLocalAudioStream(boolean muted) abstract intmuteLocalVideoStream(boolean muted) abstract intmuteRecordingSignal(boolean muted) abstract intmuteRemoteAudioStream(int uid, boolean muted) abstract intmuteRemoteVideoStream(int uid, boolean muted) abstract intabstract intabstract intDisables the audio function in the channel.abstract intabstract intpauseEffect(int soundId) abstract intplayAllEffects(int loopCount, double pitch, double pan, double gain, boolean publish) abstract intplayEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) abstract intplayEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) abstract intpreloadChannel(String token, String channelName, int optionalUid) abstract intpreloadChannelWithUserAccount(String token, String channelName, String userAccount) abstract intpreloadEffect(int soundId, String filePath) abstract intpreloadEffect(int soundId, String filePath, int startPos) Preloads a specified audio effect.abstract intpullPlaybackAudioFrame(byte[] data, int lengthInByte) abstract intpullPlaybackAudioFrame(ByteBuffer data, int lengthInByte) abstract intpushExternalAudioFrame(byte[] data, long timestamp) Deprecated.This method is deprecated.abstract intpushExternalAudioFrame(byte[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) abstract intpushExternalAudioFrame(ByteBuffer data, long timestamp, int trackId) Deprecated.This method is deprecated.abstract intpushExternalAudioFrame(ByteBuffer data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) Pushes the external audio data to the app.abstract intpushExternalEncodedVideoFrame(ByteBuffer data, EncodedVideoFrameInfo frameInfo) Deprecated.This method is deprecated.abstract intpushExternalEncodedVideoFrameById(ByteBuffer data, EncodedVideoFrameInfo frameInfo, int videoTrackId) Pushes the encoded external video frame to the app with specified connection.abstract booleanpushExternalVideoFrame(VideoFrame frame) Deprecated.This method is deprecated.abstract intpushExternalVideoFrameById(VideoFrame frame, int videoTrackId) abstract AgoraFocalLengthInfo[]abstract CodecCapInfo[]abstract intabstract intqueryHDRCapability(Constants.VIDEO_MODULE_TYPE moduleType) Queries the HDR capability of the video module.abstract intabstract intabstract intregisterAudioEncodedFrameObserver(io.agora.rtc2.internal.AudioEncodedFrameObserverConfig config, IAudioEncodedFrameObserver observer) abstract intabstract intabstract intregisterExtension(String provider, String extension, Constants.MediaSourceType sourceType) abstract intregisterFaceInfoObserver(IFaceInfoObserver receiver) abstract intregisterLocalUserAccount(String appId, String userAccount) abstract intregisterMediaMetadataObserver(IMetadataObserver observer, int type) abstract intabstract intvoidremoveHandler(IRtcEngineEventHandler handler) abstract intabstract intrenewToken(String token) abstract intabstract intabstract intEnables the audio function in the channel.abstract intabstract intresumeEffect(int soundId) abstract intselectAudioTrack(int audioIndex) abstract intsendAudioMetadata(byte[] metadata) abstract intsendCustomReportMessage(String id, String category, String event, String label, int value) abstract intsendMediaControlMessage(int uid, byte[] message) abstract intsendRdtMessage(int uid, int type, byte[] message) abstract intsendStreamMessage(int streamId, byte[] message) abstract intabstract intsetAINSMode(boolean enabled, int mode) abstract intsetAudioEffectParameters(int preset, int param1, int param2) abstract intsetAudioEffectPreset(int preset) abstract intabstract intsetAudioMixingPitch(int pitch) abstract intsetAudioMixingPlaybackSpeed(int speed) abstract intsetAudioMixingPosition(int pos) abstract intsetAudioProfile(int profile) abstract intsetAudioProfile(int profile, int scenario) abstract intsetAudioScenario(int scenario) abstract intsetAVSyncSource(String channelId, int uid) abstract intsetBeautyEffectOptions(boolean enabled, BeautyOptions options) abstract intsetBeautyEffectOptions(boolean enabled, BeautyOptions options, Constants.MediaSourceType sourceType) abstract intsetCameraAutoFocusFaceModeEnabled(boolean enabled) abstract intabstract intsetCameraExposureFactor(int factor) abstract intsetCameraExposurePosition(float positionXinView, float positionYinView) abstract intsetCameraFocusPositionInPreview(float positionX, float positionY) abstract intsetCameraTorchOn(boolean isOn) abstract intsetCameraZoomFactor(float factor) abstract intsetChannelProfile(int profile) abstract intsetClientRole(int role) abstract intsetClientRole(int role, ClientRoleOptions options) abstract intsetCloudProxy(int proxyType) abstract intsetColorEnhanceOptions(boolean enabled, ColorEnhanceOptions options) abstract intsetColorEnhanceOptions(boolean enabled, ColorEnhanceOptions options, Constants.MediaSourceType sourceType) abstract intsetDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker) abstract intsetDirectCdnStreamingAudioConfiguration(int profile) Deprecated.v4.6.0.abstract intDeprecated.v4.6.0.abstract intabstract intsetDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig) abstract intsetEarMonitoringAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) abstract intsetEffectPosition(int soundId, int pos) abstract intsetEffectsVolume(double volume) abstract intsetEnableSpeakerphone(boolean enabled) abstract intsetExtensionProperty(String provider, String extension, ExtensionInfo extensionInfo, String key, String value) Sets the properties of an extension.abstract intsetExtensionProperty(String provider, String extension, String key, String value) abstract intsetExtensionProperty(String provider, String extension, String key, String value, Constants.MediaSourceType sourceType) Sets the properties of an extension.abstract intsetExtensionProviderProperty(String provider, String key, String value) abstract intsetExternalAudioSink(boolean enabled, int sampleRate, int channels) abstract intsetExternalAudioSource(boolean enabled, int sampleRate, int channels) Deprecated.This method is deprecated.abstract intsetExternalAudioSource(boolean enabled, int sampleRate, int channels, boolean localPlayback, boolean publish) Deprecated.This method is deprecated.abstract intsetExternalMediaProjection(MediaProjection mediaProjection) abstract intsetExternalRemoteEglContext(Object eglContext) abstract intsetExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType) abstract intsetExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType, EncodedVideoTrackOptions encodedOpt) Sets the external video source.abstract intabstract intsetFaceShapeAreaOptions(FaceShapeAreaOptions options, Constants.MediaSourceType sourceType) abstract intsetFaceShapeBeautyOptions(boolean enabled, FaceShapeBeautyOptions options) abstract intsetFaceShapeBeautyOptions(boolean enabled, FaceShapeBeautyOptions options, Constants.MediaSourceType sourceType) abstract intsetFilterEffectOptions(boolean enabled, FilterEffectOptions options) abstract intsetFilterEffectOptions(boolean enabled, FilterEffectOptions options, Constants.MediaSourceType sourceType) abstract intsetHeadphoneEQParameters(int lowGain, int highGain) abstract intsetHeadphoneEQPreset(int preset) abstract intsetHighPriorityUserList(int[] uidList, int option) Sets the high priority user list and related fallback option for the remotely subscribed video stream based on the network conditions in NASA2.abstract intsetHighQualityAudioParameters(boolean fullband, boolean stereo, boolean fullBitrate) Sets high-quality audio preferences.abstract intsetInEarMonitoringVolume(int volume) abstract intabstract intsetLocalRenderMode(int renderMode) Deprecated.abstract intsetLocalRenderMode(int renderMode, int mirrorMode) abstract intsetLocalRenderTargetFps(Constants.VideoSourceType sourceType, int targetFps) abstract intsetLocalVideoMirrorMode(int mode) Deprecated.abstract intsetLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) abstract intsetLocalVoiceFormant(double formantRatio) abstract intsetLocalVoicePitch(double pitch) abstract intsetLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE reverbKey, int value) abstract intsetLogFile(String filePath) abstract intsetLogFileSize(long fileSizeInKBytes) abstract intsetLogFilter(int filter) abstract intsetLogLevel(int level) abstract intsetLowlightEnhanceOptions(boolean enabled, LowLightEnhanceOptions options) abstract intsetLowlightEnhanceOptions(boolean enabled, LowLightEnhanceOptions options, Constants.MediaSourceType sourceType) abstract intsetMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) abstract intsetParameters(String parameters) abstract intsetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) abstract intsetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel, int samplesPerCall) abstract intsetPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) abstract voidsetPreferHeadset(boolean enabled) Deprecated.This method is deprecated.abstract intsetRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) abstract intsetRemoteDefaultVideoStreamType(int streamType) Deprecated.abstract intabstract intsetRemoteRenderMode(int uid, int renderMode) Deprecated.abstract intsetRemoteRenderMode(int uid, int renderMode, int mirrorMode) abstract intsetRemoteRenderTargetFps(int targetFps) abstract intsetRemoteSubscribeFallbackOption(int option) Deprecated.abstract intabstract intsetRemoteUserPriority(int uid, int userPriority) Sets the priority of a remote user's media stream.abstract intsetRemoteUserSpatialAudioParams(int uid, SpatialAudioParams params) abstract intsetRemoteVideoStreamType(int uid, int streamType) Deprecated.abstract intsetRemoteVideoStreamType(int uid, Constants.VideoStreamType streamType) abstract intsetRemoteVideoSubscriptionOptions(int uid, VideoSubscriptionOptions options) abstract intsetRemoteVoicePosition(int uid, double pan, double gain) abstract intsetRouteInCommunicationMode(int route) abstract intsetScreenCaptureScenario(Constants.ScreenScenarioType screenScenario) abstract intsetSimulcastConfig(SimulcastConfig simulcastConfig) abstract intsetSubscribeAudioAllowlist(int[] uidList) abstract intsetSubscribeAudioBlocklist(int[] uidList) abstract intsetSubscribeVideoAllowlist(int[] uidList) abstract intsetSubscribeVideoBlocklist(int[] uidList) abstract intsetupAudioAttributes(AudioAttributes attr) 配置AudioAttributeabstract intsetupLocalVideo(VideoCanvas local) abstract intsetupRemoteVideo(VideoCanvas remote) abstract intsetVideoDenoiserOptions(boolean enabled, VideoDenoiserOptions options) abstract intsetVideoDenoiserOptions(boolean enabled, VideoDenoiserOptions options, Constants.MediaSourceType sourceType) abstract intabstract intsetVideoQoEPreference(Constants.QoEPreference qoePreference) Sets the video qoe preference.abstract intsetVideoQualityParameters(boolean preferFrameRateOverImageQuality) Sets the video quality preferences.abstract intsetVideoScenario(Constants.VideoScenario scenarioType) abstract intsetVoiceBeautifierParameters(int preset, int param1, int param2) abstract intsetVoiceBeautifierPreset(int preset) abstract intsetVoiceConversionParameters(int preset, int param1, int param2) Set parameters for SDK preset voice conversion.abstract intsetVoiceConversionPreset(int preset) abstract intsetVolumeOfEffect(int soundId, double volume) abstract intstartAudioMixing(String filePath, boolean loopback, int cycle) abstract intstartAudioMixing(String filePath, boolean loopback, int cycle, int startPos) abstract intstartAudioRecording(io.agora.rtc2.internal.AudioRecordingConfiguration config) abstract intstartAudioRecording(String filePath, int quality) abstract intstartCameraCapture(Constants.VideoSourceType sourceType, CameraCapturerConfiguration config) abstract intstartDirectCdnStreaming(IDirectCdnStreamingEventHandler eventHandler, String publishUrl, DirectCdnStreamingMediaOptions options) Deprecated.v4.6.0.abstract intstartEchoTest(EchoTestConfiguration config) abstract intstartLastmileProbeTest(io.agora.rtc2.internal.LastmileProbeConfig config) abstract intabstract intabstract intabstract intstartOrUpdateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) abstract intstartPlaybackDeviceTest(String audioFileName) abstract intabstract intstartPreview(Constants.VideoSourceType sourceType) abstract intstartRecordingDeviceTest(int indicationInterval) abstract intstartRhythmPlayer(String sound1, String sound2, AgoraRhythmPlayerConfig config) abstract intabstract intstartRtmpStreamWithTranscoding(String url, LiveTranscoding transcoding) abstract intstartScreenCapture(ScreenCaptureParameters screenCaptureParameters) abstract intabstract intabstract intabstract intstopCameraCapture(Constants.VideoSourceType sourceType) abstract intabstract intDeprecated.v4.6.0.abstract intabstract intstopEffect(int soundId) abstract intabstract intabstract intabstract intabstract intabstract intstopPreview(Constants.VideoSourceType sourceType) abstract intabstract intabstract intstopRtmpStream(String url) abstract intabstract intabstract intswitchCamera(String cameraId) abstract inttakeSnapshot(int uid, SnapshotConfig config) abstract inttakeSnapshot(int uid, String filePath) abstract intReleases all preloaded audio effects from the memory.abstract intunloadEffect(int soundId) abstract intabstract intunregisterMediaMetadataObserver(IMetadataObserver observer, int type) abstract intabstract intDeprecated.v4.6.0.abstract intabstract intabstract intupdatePreloadChannelToken(String token) abstract intupdateRtmpTranscoding(LiveTranscoding transcoding) abstract intupdateScreenCaptureParameters(ScreenCaptureParameters screenCaptureParameters) abstract StringUpload current log file immediately to server.abstract intWrite the log to SDK .
-
Constructor Details
-
RtcEngine
public RtcEngine()
-
-
Method Details
-
create
public static RtcEngine create(Context context, String appId, IRtcEngineEventHandler handler) throws Exception - Parameters:
context- The context of Android Activity.appId- The App ID issued by Agora for your project. Only users in apps with the same App ID can join the same channel and communicate with each other. An App ID can only be used to create one `RtcEngine` instance. To change your App ID, call `destroy()` to destroy the current `RtcEngine` instance, and then create a new one.handler- The event handler for `RtcEngine`. See `IRtcEngineEventHandler`.- Returns:
- - Returns an initialized `RtcEngine` object if the method call succeeds. - The method call fails and an exception is thrown, you need to catch the exception and handle it.
- Throws:
Exception
-
create
- Parameters:
config- Configurations for the `RtcEngine` instance. See `RtcEngineConfig`.- Returns:
- - Returns an initialized `RtcEngine` object if the method call succeeds. - The method call fails and an exception is thrown, you need to catch the exception and handle it.
- Throws:
Exception
-
destroy
public static void destroy() -
destroy
- Parameters:
callback- To configure the synchronous or asynchronous destruction of the engine: - Non-`NULL`:Asynchronous destruction. The method returns immediately, while the engine resources might not be fully released. The `onEngineReleased` callback is triggered after the engine is destroyed. - `NULL`:Synchronous destruction. The method returns only after the engine resources are fully released. See `IRtcEngineReleaseCallback`.- Since:
- v4.6.0
-
setChannelProfile
public abstract int setChannelProfile(int profile) - Parameters:
profile- The channel profile. - CHANNEL_PROFILE_COMMUNICATION (0): Communication. Agora recommends using the live streaming profile for a better audio and video experience. - CHANNEL_PROFILE_LIVE_BROADCASTING (1): (Default) Live streaming. - CHANNEL_PROFILE_GAME (2): Gaming. Deprecated: Use CHANNEL_PROFILE_LIVE_BROADCASTING instead. - CHANNEL_PROFILE_CLOUD_GAMING (3): Interaction. The scenario is optimized for latency. Use this profile if the use case requires frequent interactions between users. Deprecated: Use CHANNEL_PROFILE_LIVE_BROADCASTING instead.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. - -7: The SDK is not initialized.
-
setClientRole
public abstract int setClientRole(int role) - Parameters:
role- The user role: - CLIENT_ROLE_BROADCASTER (1): Host. - CLIENT_ROLE_AUDIENCE (2): Audience. Note: If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -7: The SDK is not initialized.
-
setClientRole
- Parameters:
role- The user role. - CLIENT_ROLE_BROADCASTER (1): Host. A host can both send and receive streams. - CLIENT_ROLE_AUDIENCE (2): (Default) Audience. An audience member can only receive streams. Note: If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster.options- The detailed options of a user, including the user level. See `ClientRoleOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -5: The request is rejected. - -7: The SDK is not initialized.
-
sendCustomReportMessage
-
preloadChannel
- Parameters:
token- The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload. - When preloading one channel, calling this method to pass in the new token. - When preloading more than one channels: - If you use a wildcard token for all preloaded channels, call `updatePreloadChannelToken` to update the token.Note: When generating a wildcard token, ensure the user ID is not set as 0. See `Secure authentication with tokens`. - If you use different tokens to preload different channels, call this method to pass in your user ID, channel name and the new token.channelName- The channel name that you want to preload. 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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","optionalUid- 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 signed integer. The value range is from -2^31 to 2^31-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and `onJoinChannelSuccess` returns it in the 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 `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -102: The channel name is invalid. You need to pass in a valid channel name and join the channel again.
-
preloadChannelWithUserAccount
public abstract int preloadChannelWithUserAccount(String token, String channelName, String userAccount) - Parameters:
token- The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload. - When preloading one channel, calling this method to pass in the new token. - When preloading more than one channels: - If you use a wildcard token for all preloaded channels, call `updatePreloadChannelToken` to update the token.Note: When generating a wildcard token, ensure the user ID is not set as 0. See `Secure authentication with tokens`. - If you use different tokens to preload different channels, call this method to pass in your user ID, channel name and the new token.channelName- The channel name that you want to preload. 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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","userAccount- The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total): - The 26 lowercase English letters: a to z. - The 26 uppercase English letters: A to Z. - All numeric characters: 0 to 9. - Space - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the User Account is empty. You need to pass in a valid parameter and join the channel again. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -102: The channel name is invalid. You need to pass in a valid channel name and join the channel again.
-
updatePreloadChannelToken
- Parameters:
token- The new token.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is invalid. You need to pass in a valid parameter and join the channel again. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method.
-
joinChannel
- Parameters:
token- The token generated on your server for authentication.Note: - (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required. - If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in. - If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See `Secure authentication with tokens`.channelId- 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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","optionalInfo- (Optional) Reserved for future use.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 signed integer. The value range is from -2^31 to 2^31-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and `onJoinChannelSuccess` returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is invalid, the `uid` parameter is not set to an integer, or the value of a member in `ChannelMediaOptions` is invalid. You need to pass in a valid parameter and join the channel again. - -3: Fails to initialize the `RtcEngine` object. You need to reinitialize the `RtcEngine` object. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -8: The internal state of the `RtcEngine` object is wrong. The typical cause is that after calling `startEchoTest` to start a call loop test, you call this method to join the channel without calling `stopEchoTest` to stop the test. You need to call `stopEchoTest` before calling this method. - -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the `onConnectionStateChanged` callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the `CONNECTION_STATE_DISCONNECTED` (1) state. - -102: The channel name is invalid. You need to pass in a valid channel name in `channelId` to rejoin the channel. - -121: The user ID is invalid. You need to pass in a valid user ID in `uid` to rejoin the channel.
-
joinChannel
public abstract int joinChannel(String token, String channelId, int uid, ChannelMediaOptions options) - Parameters:
token- The token generated on your server for authentication.Note: - (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required. - If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in. - If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See `Secure authentication with tokens`.channelId- 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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","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 signed integer. The value range is from -231 to 231-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and `onJoinChannelSuccess` returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so.options- The channel media options. See `ChannelMediaOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is invalid, the `uid` parameter is not set to an integer, or the value of a member in `ChannelMediaOptions` is invalid. You need to pass in a valid parameter and join the channel again. - -3: Fails to initialize the `RtcEngine` object. You need to reinitialize the `RtcEngine` object. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -8: The internal state of the `RtcEngine` object is wrong. The typical cause is that after calling `startEchoTest` to start a call loop test, you call this method to join the channel without calling `stopEchoTest` to stop the test. You need to call `stopEchoTest` before calling this method. - -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the `onConnectionStateChanged` callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the `CONNECTION_STATE_DISCONNECTED` (1) state. - -102: The channel name is invalid. You need to pass in a valid channel name in `channelId` to rejoin the channel. - -121: The user ID is invalid. You need to pass in a valid user ID in `uid` to rejoin the channel.
-
registerLocalUserAccount
- Parameters:
appId- The App ID of your project on Agora Console.userAccount- The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follow(89 in total): - The 26 lowercase English letters: a to z. - The 26 uppercase English letters: A to Z. - All numeric characters: 0 to 9. - Space - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","- Returns:
- - 0: Success. - < 0: Failure.
-
joinChannelWithUserAccount
public abstract int joinChannelWithUserAccount(String token, String channelName, String userAccount) - Parameters:
token- The token generated on your server for authentication.Note: - (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required. - If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in. - If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See `Secure authentication with tokens`.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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","userAccount- The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total): - The 26 lowercase English letters: a to z. - The 26 uppercase English letters: A to Z. - All numeric characters: 0 to 9. - Space - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is invalid, the `uid` parameter is not set to an integer, or the value of a member in `ChannelMediaOptions` is invalid. You need to pass in a valid parameter and join the channel again. - -3: Fails to initialize the `RtcEngine` object. You need to reinitialize the `RtcEngine` object. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -8: The internal state of the `RtcEngine` object is wrong. The typical cause is that after calling `startEchoTest` to start a call loop test, you call this method to join the channel without calling `stopEchoTest` to stop the test. You need to call `stopEchoTest` before calling this method. - -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the `onConnectionStateChanged` callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the `CONNECTION_STATE_DISCONNECTED` (1) state. - -102: The channel name is invalid. You need to pass in a valid channel name in `channelId` to rejoin the channel. - -121: The user ID is invalid. You need to pass in a valid user ID in `uid` to rejoin the channel.
-
joinChannelWithUserAccount
public abstract int joinChannelWithUserAccount(String token, String channelName, String userAccount, ChannelMediaOptions options) - Parameters:
token- The token generated on your server for authentication.Note: - (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required. - If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in. - If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See `Secure authentication with tokens`.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 characters (89 characters in total): - All lowercase English letters: a to z. - All uppercase English letters: A to Z. - All numeric characters: 0 to 9. - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","userAccount- The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total): - The 26 lowercase English letters: a to z. - The 26 uppercase English letters: A to Z. - All numeric characters: 0 to 9. - Space - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","options- The channel media options. See `ChannelMediaOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is invalid, the `uid` parameter is not set to an integer, or the value of a member in `ChannelMediaOptions` is invalid. You need to pass in a valid parameter and join the channel again. - -3: Fails to initialize the `RtcEngine` object. You need to reinitialize the `RtcEngine` object. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -8: The internal state of the `RtcEngine` object is wrong. The typical cause is that after calling `startEchoTest` to start a call loop test, you call this method to join the channel without calling `stopEchoTest` to stop the test. You need to call `stopEchoTest` before calling this method. - -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the `onConnectionStateChanged` callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the `CONNECTION_STATE_DISCONNECTED` (1) state. - -102: The channel name is invalid. You need to pass in a valid channel name in `channelId` to rejoin the channel. - -121: The user ID is invalid. You need to pass in a valid user ID in `uid` to rejoin the channel.
- Since:
- v3.3.0.
-
getUserInfoByUserAccount
- Parameters:
userAccount- The user account.userInfo- The `UserInfo` object that identifies the user information. - Input value: A `UserInfo` object. - Output: A `UserInfo` object that contains the user account and user ID of the user.
-
getUserInfoByUid
- Parameters:
uid- The user ID.userInfo- Input and output parameter. The `UserInfo` object that identifies the user information. - Input value: A `UserInfo` object. - Output: A `UserInfo` object that contains both the user account and UID.- Returns:
- - 0: Success. - < 0: Failure.
-
leaveChannel
public abstract int leaveChannel()- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -7: The SDK is not initialized.
-
leaveChannel
- Parameters:
options- The options for leaving the channel. See `LeaveChannelOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
renewToken
- Parameters:
token- The new token.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. For example, the token is empty. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - 110: Invalid token. Ensure the following: - The user ID specified when generating the token is consistent with the user ID used when joining the channel. - The generated token is the same as the token passed in to join the channel.
-
getAudioDeviceInfo
- Returns:
- The `DeviceInfo` object that identifies the audio device information. - Not null: Success. - Null: Failure.
-
enableWebSdkInteroperability
public abstract int enableWebSdkInteroperability(boolean enabled) - Parameters:
enabled- Whether to enable interoperability: - `true`: Enable interoperability. - `false`: (Default) Disable interoperability.- Returns:
- - 0: Success. - < 0: Failure.
-
getConnectionState
public abstract int getConnectionState()- Returns:
- The current connection state.
-
enableAudio
public abstract int enableAudio()- Returns:
- - 0: Success. - < 0: Failure.
-
disableAudio
public abstract int disableAudio()- Returns:
- - 0: Success. - < 0: Failure.
-
pauseAudio
public abstract int pauseAudio()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
public abstract int resumeAudio()Enables the audio function in the channel.- Returns:
- 0: Success.
- <0: Failure.
-
setAudioProfile
public abstract int setAudioProfile(int profile) - Parameters:
profile- The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. - `DEFAULT`(0): The default value. - For the interactive streaming profile: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - For the communication profile: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `SPEECH_STANDARD`(1): A sampling rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `MUSIC_STANDARD`(2): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - `MUSIC_STANDARD_STEREO`(3): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 Kbps. - `MUSIC_HIGH_QUALITY`(4): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. - `MUSIC_HIGH_QUALITY_STEREO`(5): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps.- Returns:
- - 0: Success. - < 0: Failure.
-
setAudioProfile
public abstract int setAudioProfile(int profile, int scenario) - Parameters:
profile- The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. - `DEFAULT`(0): The default value. - For the interactive streaming profile: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - For the communication profile: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `SPEECH_STANDARD`(1): A sampling rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `MUSIC_STANDARD`(2): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - `MUSIC_STANDARD_STEREO`(3): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 Kbps. - `MUSIC_HIGH_QUALITY`(4): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. - `MUSIC_HIGH_QUALITY_STEREO`(5): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps.scenario- The audio scenarios. Under different audio scenarios, the device uses different volume types. - `AUDIO_SCENARIO_DEFAULT`(0): (Default) Automatic scenario, where the SDK chooses the appropriate audio quality according to the user role and audio route. - `AUDIO_SCENARIO_GAME_STREAMING`(3): High-quality audio scenario, where users mainly play music. - `AUDIO_SCENARIO_CHATROOM`(5): Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. - `AUDIO_SCENARIO_CHORUS`(7): Real-time chorus scenario, where users have good network conditions and require ultra-low latency. Attention: Before using this enumeration, you need to call `getAudioDeviceInfo` to see whether the audio device supports ultra-low-latency capture and playback. To experience ultra-low latency, you need to ensure that your audio device supports ultra-low latency ( `isLowLatencyAudioSupported` = `true`). - `AUDIO_SCENARIO_MEETING`(8): Meeting scenario that mainly involves the human voice. - `AUDIO_SCENARIO_AI_CLIENT`(10): AI conversation scenario, which is only applicable to scenarios where the user interacts with the conversational AI agent created by `Conversational AI Engine`.- Returns:
- - 0: Success. - < 0: Failure.
-
setAudioScenario
public abstract int setAudioScenario(int scenario) - Parameters:
scenario- The audio scenarios. Under different audio scenarios, the device uses different volume types. - `AUDIO_SCENARIO_DEFAULT`(0): (Default) Automatic scenario, where the SDK chooses the appropriate audio quality according to the user role and audio route. - `AUDIO_SCENARIO_GAME_STREAMING`(3): High-quality audio scenario, where users mainly play music. - `AUDIO_SCENARIO_CHATROOM`(5): Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. - `AUDIO_SCENARIO_CHORUS`(7): Real-time chorus scenario, where users have good network conditions and require ultra-low latency. Attention: Before using this enumeration, you need to call `getAudioDeviceInfo` to see whether the audio device supports ultra-low-latency capture and playback. To experience ultra-low latency, you need to ensure that your audio device supports ultra-low latency ( `isLowLatencyAudioSupported` = `true`). - `AUDIO_SCENARIO_MEETING`(8): Meeting scenario that mainly involves the human voice. - `AUDIO_SCENARIO_AI_CLIENT`(10): AI conversation scenario, which is only applicable to scenarios where the user interacts with the conversational AI agent created by `Conversational AI Engine`.- Returns:
- - 0: Success. - < 0: Failure.
-
setHighQualityAudioParameters
public abstract int setHighQualityAudioParameters(boolean fullband, boolean stereo, boolean fullBitrate) 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
public abstract int adjustRecordingSignalVolume(int volume) - Parameters:
volume- The volume of the user. The value range is [0,400]. - 0: Mute. - 100: (Default) The original volume. - 400: Four times the original volume (amplifying the audio signals by four times).- Returns:
- - 0: Success. - < 0: Failure.
-
adjustPlaybackSignalVolume
public abstract int adjustPlaybackSignalVolume(int volume) - Parameters:
volume- The volume of the user. The value range is [0,400]. - 0: Mute. - 100: (Default) The original volume. - 400: Four times the original volume (amplifying the audio signals by four times).- Returns:
- - 0: Success. - < 0: Failure.
-
enableAudioVolumeIndication
public abstract int enableAudioVolumeIndication(int interval, int smooth, boolean reportVad) - 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. Ensure this parameter is set to a value greater than 10, otherwise you will not receive the `onAudioVolumeIndication` callback. Agora recommends that this value is set as greater than 100.smooth- The smoothing factor that sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The recommended value is 3. The greater the value, the more sensitive the indicator.reportVad- - `true`: Enables the voice activity detection of the local user. Once it is enabled, the `vad` parameter of the `onAudioVolumeIndication` callback reports the voice activity status of the local user. - `false`: (Default) Disables the voice activity detection of the local user. Once it is disabled, the `vad` parameter of the `onAudioVolumeIndication` callback does not report the voice activity status of the local user, except for the scenario where the engine automatically detects the voice activity of the local user.- Returns:
- - 0: Success. - < 0: Failure.
-
enableLocalAudio
public abstract int enableLocalAudio(boolean enabled) - Parameters:
enabled- - `true`: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone). - `false`: Disable the local audio function, that is, to stop local audio capturing.- Returns:
- - 0: Success. - < 0: Failure.
-
muteLocalAudioStream
public abstract int muteLocalAudioStream(boolean muted) - Parameters:
muted- Whether to stop publishing the local audio stream: - `true`: Stops publishing the local audio stream. - `false`: (Default) Resumes publishing the local audio stream.- Returns:
- - 0: Success. - < 0: Failure.
-
muteRemoteAudioStream
public abstract int muteRemoteAudioStream(int uid, boolean muted) - Parameters:
uid- The user ID of the specified user.muted- Whether to subscribe to the specified remote user's audio stream. - `true`: Stop subscribing to the audio stream of the specified user. - `false`: (Default) Subscribe to the audio stream of the specified user.- Returns:
- - 0: Success. - < 0: Failure.
-
adjustUserPlaybackSignalVolume
public abstract int adjustUserPlaybackSignalVolume(int uid, int volume) - Parameters:
uid- The user ID of the remote user.volume- The volume of the user. The value range is [0,400]. - 0: Mute. - 100: (Default) The original volume. - 400: Four times the original volume (amplifying the audio signals by four times).- Returns:
- - 0: Success. - < 0: Failure.
-
muteAllRemoteAudioStreams
public abstract int muteAllRemoteAudioStreams(boolean muted) - Parameters:
muted- Whether to stop subscribing to the audio streams of all remote users: - `true`: Stops subscribing to the audio streams of all remote users. - `false`: (Default) Subscribes to the audio streams of all remote users by default.- Returns:
- - 0: Success. - < 0: Failure.
-
enableVideo
public abstract int enableVideo()- Returns:
- - 0: Success. - < 0: Failure.
-
disableVideo
public abstract int disableVideo()- Returns:
- - 0: Success. - < 0: Failure.
-
setVideoEncoderConfiguration
- Parameters:
config- Video profile. See `VideoEncoderConfiguration`.- Returns:
- - 0: Success. - < 0: Failure.
-
queryCodecCapability
- Returns:
- - One `CodecCapInfo` array indicating the video encoding capability of the device, if the method call succeeds. - If the call timeouts, please modify the call logic and do not invoke the method in the main thread.
-
queryDeviceScore
public abstract int queryDeviceScore()- Returns:
- - > 0: The method call succeeeds, the value is the current device's score, the range is [0,100], the larger the value, the stronger the device capability. Most devices are rated between 60 and 100. - < 0: Failure.
-
queryCameraFocalLengthCapability
- Returns:
- Returns an array of `AgoraFocalLengthInfo` objects, which contain the camera's orientation and focal length type.
-
setCameraCapturerConfiguration
- Parameters:
config- The camera capture configuration. See `CameraCapturerConfiguration`.- Returns:
- - 0: Success. - < 0: Failure.
-
setupLocalVideo
- Parameters:
local- The local video view and settings. See `VideoCanvas`.- Returns:
- - 0: Success. - < 0: Failure.
-
setupRemoteVideo
- Parameters:
remote- The remote video view and settings. See `VideoCanvas`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteRenderMode
Deprecated.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.- 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
Deprecated.- Parameters:
renderMode- The local video display mode. - RENDER_MODE_HIDDEN (1): Hidden mode. Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. - RENDER_MODE_FIT (2): Fit mode. 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 are filled with black. - RENDER_MODE_ADAPTIVE (3): Adaptive mode. Deprecated: This enumerator is deprecated and not recommended for use.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteRenderMode
public abstract int setRemoteRenderMode(int uid, int renderMode, int mirrorMode) - Parameters:
uid- The user ID of the remote user.renderMode- The rendering mode of the remote user view. - RENDER_MODE_HIDDEN (1): Hidden mode. Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. - RENDER_MODE_FIT (2): Fit mode. 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 are filled with black. - RENDER_MODE_ADAPTIVE (3): Adaptive mode. Deprecated: This enumerator is deprecated and not recommended for use.mirrorMode- The mirror mode of the remote user view. - VIDEO_MIRROR_MODE_AUTO (0): The SDK determines whether to enable the mirror mode. The SDK disables mirror mode by default. - VIDEO_MIRROR_MODE_ENABLED (1): Enables the mirror mode for remote user's view. - VIDEO_MIRROR_MODE_DISABLED (2): Disables the mirror mode for remote user's view.- Returns:
- - 0: Success. - < 0: Failure.
-
setLocalRenderMode
public abstract int setLocalRenderMode(int renderMode, int mirrorMode) - Parameters:
renderMode- The local video display mode. - RENDER_MODE_HIDDEN (1): Hidden mode. Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. - RENDER_MODE_FIT (2): Fit mode. 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 are filled with black. - RENDER_MODE_ADAPTIVE (3): Adaptive mode. Deprecated: This enumerator is deprecated and not recommended for use.mirrorMode- For the local user: - VIDEO_MIRROR_MODE_AUTO (0): The SDK determines whether to enable the mirror mode. If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default. - VIDEO_MIRROR_MODE_ENABLED (1): Enable the mirroring mode of the local view. - VIDEO_MIRROR_MODE_DISABLED (2): Disable the mirroring mode of the local view. Attention: If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default.- Returns:
- - 0: Success. - < 0: Failure.
-
startPreview
public abstract int startPreview()- Returns:
- - 0: Success. - < 0: Failure.
-
startPreview
- Parameters:
sourceType- The type of the video source. See `VideoSourceType`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopPreview
public abstract int stopPreview()- Returns:
- - 0: Success. - < 0: Failure.
-
stopPreview
- Parameters:
sourceType- The type of the video source. See `VideoSourceType`.- Returns:
- - 0: Success. - < 0: Failure.
-
enableLocalVideo
public abstract int enableLocalVideo(boolean enabled) - Parameters:
enabled- Whether to enable the local video capture. - `true`: (Default) Enable the local video capture. - `false`: Disable the local video capture. Once the local video is disabled, the remote users cannot receive the video stream of the local user, while the local user can still receive the video streams of remote users. When set to `false`, this method does not require a local camera.- Returns:
- - 0: Success. - < 0: Failure.
-
startCameraCapture
public abstract int startCameraCapture(Constants.VideoSourceType sourceType, CameraCapturerConfiguration config) - Parameters:
sourceType- The type of the video source. See `VideoSourceType`. Note: - On Android devices, you can capture video from up to 4 cameras, provided the device has multiple cameras or supports external cameras.config- The configuration of the video capture. See `CameraCapturerConfiguration`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopCameraCapture
- Parameters:
sourceType- The type of the video source. See `VideoSourceType`.- Returns:
- - 0: Success. - < 0: Failure.
-
startLocalVideoTranscoder
- Parameters:
config- Configuration of the local video mixing, see `LocalTranscoderConfiguration`.Attention: - The maximum resolution of each video stream participating in the local video mixing is 4096 × 2160. If this limit is exceeded, video mixing does not take effect. - The maximum resolution of the mixed video stream is 4096 × 2160.- Returns:
- - 0: Success. - < 0: Failure.
-
stopLocalVideoTranscoder
public abstract int stopLocalVideoTranscoder()- Returns:
- - 0: Success. - < 0: Failure.
-
updateLocalTranscoderConfiguration
- Parameters:
config- Configuration of the local video mixing, see `LocalTranscoderConfiguration`.- Returns:
- - 0: Success. - < 0: Failure.
-
startLocalAudioMixer
- Parameters:
config- The configurations for mixing the lcoal audio. See `LocalAudioMixerConfiguration`.- Returns:
- - 0: Success. - < 0: Failure. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method.
-
updateLocalAudioMixerConfiguration
- Parameters:
config- The configurations for mixing the lcoal audio. See `LocalAudioMixerConfiguration`.- Returns:
- - 0: Success. - < 0: Failure. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method.
-
stopLocalAudioMixer
public abstract int stopLocalAudioMixer()- Returns:
- - 0: Success. - < 0: Failure. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method.
-
muteLocalVideoStream
public abstract int muteLocalVideoStream(boolean muted) - Parameters:
muted- Whether to stop publishing the local video stream. - `true`: Stop publishing the local video stream. - `false`: (Default) Publish the local video stream.- Returns:
- - 0: Success. - < 0: Failure.
-
muteRemoteVideoStream
public abstract int muteRemoteVideoStream(int uid, boolean muted) - Parameters:
uid- The user ID of the specified user.muted- Whether to subscribe to the specified remote user's video stream. - `true`: Stop subscribing to the video streams of the specified user. - `false`: (Default) Subscribe to the video stream of the specified user.- Returns:
- - 0: Success. - < 0: Failure.
-
muteAllRemoteVideoStreams
public abstract int muteAllRemoteVideoStreams(boolean muted) - Parameters:
muted- Whether to stop subscribing to the video streams of all remote users. - `true`: Stop subscribing to the video streams of all remote users. - `false`: (Default) Subscribe to the video streams of all remote users by default.- Returns:
- - 0: Success. - < 0: Failure.
-
setBeautyEffectOptions
- Parameters:
enabled- Whether to enable the image enhancement function: - `true`: Enable the image enhancement function. - `false`: (Default) Disable the image enhancement function.options- The image enhancement options. See `BeautyOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 5.0 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
- Since:
- v2.4.0.
-
setBeautyEffectOptions
public abstract int setBeautyEffectOptions(boolean enabled, BeautyOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable the image enhancement function: - `true`: Enable the image enhancement function. - `false`: (Default) Disable the image enhancement function.options- The image enhancement options. See `BeautyOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - The default value is `PRIMARY_CAMERA_SOURCE`. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 5.0 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
- Since:
- v2.4.0.
-
setFaceShapeBeautyOptions
- Parameters:
enabled- Whether to enable the face shape effect: - `true`: Enable the face shape effect. - `false`: (Default) Disable the face shape effect.options- Face shaping style options, see `FaceShapeBeautyOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 4.4 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
-
setFaceShapeBeautyOptions
public abstract int setFaceShapeBeautyOptions(boolean enabled, FaceShapeBeautyOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable the face shape effect: - `true`: Enable the face shape effect. - `false`: (Default) Disable the face shape effect.options- Face shaping style options, see `FaceShapeBeautyOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - Use the default value `PRIMARY_CAMERA_SOURCE` if you use camera to capture local video. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 4.4 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
-
getFaceShapeBeautyOptions
- Returns:
- - A pointer to the `FaceShapeBeautyOptions` instance, if the method call succeeds. - NULL is returned, if the method call fails.
-
getFaceShapeBeautyOptions
public abstract FaceShapeBeautyOptions getFaceShapeBeautyOptions(Constants.MediaSourceType sourceType) - Parameters:
sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - Use the default value `PRIMARY_CAMERA_SOURCE` if you use camera to capture local video. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - A pointer to the `FaceShapeBeautyOptions` instance, if the method call succeeds. - NULL is returned, if the method call fails.
-
setFaceShapeAreaOptions
- Parameters:
options- Facial enhancement areas, see `FaceShapeAreaOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 4.4 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
-
setFaceShapeAreaOptions
public abstract int setFaceShapeAreaOptions(FaceShapeAreaOptions options, Constants.MediaSourceType sourceType) - Parameters:
options- Facial enhancement areas, see `FaceShapeAreaOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - Use the default value `PRIMARY_CAMERA_SOURCE` if you use camera to capture local video. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure. - -4: The current device does not support this feature. Possible reasons include: - The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device. - The current device version is lower than Android 4.4 and does not support this feature. Agora recommends you replace the device or upgrade the operating system.
-
getFaceShapeAreaOptions
- Parameters:
shapeArea- Facial enhancement areas. - FACE_SHAPE_AREA_NONE (-1): (Default) Invalid area, no beauty effect applied. - FACE_SHAPE_AREA_HEADSCALE (100): Head, used to achieve a smaller head effect. The adjustment range is [0,100]; the larger the value, the smaller the head becomes, with a preset value of 100. - FACE_SHAPE_AREA_FOREHEAD (101): Forehead, used to adjust the hairline height. The adjustment strength ranges from [-100,100], with positive values raising and negative values lowering the hairline. The greater the absolute value, the stronger the effect. The default value is 50. - FACE_SHAPE_AREA_FACECONTOUR (102): Face contour, used to achieve a slimmer face effect. The adjustment range is [0,100]; the larger the value, the stronger the slimming effect, with a preset value of 10. - FACE_SHAPE_AREA_FACELENGTH (103): Face length, used to achieve a longer face effect. The adjustment range is [-100,100]; positive values elongate the face, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of 0. - FACE_SHAPE_AREA_FACEWIDTH (104): Face width, used to achieve a narrower face effect. The adjustment range is [0,100]; the larger the value, the stronger the narrowing effect, with a preset value of 10. - FACE_SHAPE_AREA_CHEEKBONE (105): Cheekbone, used to adjust cheekbone width. The adjustment range is [0,100]; the larger the value, the narrower the cheekbones, with a preset set value of 43. - FACE_SHAPE_AREA_CHEEK (106): Cheeks, used to adjust the cheeks width. The adjustment range is [0,100]; the larger the value, the narrower the cheeks, with a preset value of 50. - FACE_SHAPE_AREA_CHIN (108): Chin, used to adjust the chin length. The adjustment range is [-100,100]; positive values elongate the chin, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of -20. - FACE_SHAPE_AREA_EYESCALE (200):Eyes, used to achieve a larger eye effect. The adjustment range is [0,100]; the larger the value, the larger the eye size, with a preset value of 50. - FACE_SHAPE_AREA_EYEDISTANCE (201): Eye distance adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_EYEPOSITION (202): Eye position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_LOWEREYELID (203): Lower eyelid adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEPUPILS (204): Pupil size adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEINNERCORNER (205): Inner eye corner adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEOUTERCORNER (206): Outer eye corner adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSELENGTH (300): Nose length, used to achieve a longer nose effect. The adjustment range is [-100,100]; positive values elongate the nose, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of -10. - FACE_SHAPE_AREA_NOSEWIDTH (301): Nose width, used to achieve a slimmer nose effect. The adjustment range is [-100,100]; positive values make the nose wider, while negative values make it narrower. The larger the value, the stronger the enhancement effect, with a preset value of 72. - FACE_SHAPE_AREA_NOSEWING (302): Nose wing adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEROOT (303): Nose root adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEBRIDGE (304): Nose bridge adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSETIP (305): Nose tip adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEGENERAL (306): Overall nose adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_MOUTHSCALE (400): Mouth, used to achieve a larger mouth effect. The adjustment strength ranges from [0,100], with larger values resulting in a larger mouth. The default value is 50. - FACE_SHAPE_AREA_MOUTHPOSITION (401): Mouth position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_MOUTHSMILE (402): Mouth smile adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_MOUTHLIP (403): Lip shape adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEBROWPOSITION (500): Eyebrow position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_EYEBROWTHICKNESS (501): Eyebrow thickness adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment.- Returns:
- - A pointer to the `FaceShapeAreaOptions` instance, if the method call succeeds. - NULL is returned, if the method call fails.
-
getFaceShapeAreaOptions
public abstract FaceShapeAreaOptions getFaceShapeAreaOptions(int shapeArea, Constants.MediaSourceType sourceType) - Parameters:
shapeArea- Facial enhancement areas. - FACE_SHAPE_AREA_NONE (-1): (Default) Invalid area, no beauty effect applied. - FACE_SHAPE_AREA_HEADSCALE (100): Head, used to achieve a smaller head effect. The adjustment range is [0,100]; the larger the value, the smaller the head becomes, with a preset value of 100. - FACE_SHAPE_AREA_FOREHEAD (101): Forehead, used to adjust the hairline height. The adjustment strength ranges from [-100,100], with positive values raising and negative values lowering the hairline. The greater the absolute value, the stronger the effect. The default value is 50. - FACE_SHAPE_AREA_FACECONTOUR (102): Face contour, used to achieve a slimmer face effect. The adjustment range is [0,100]; the larger the value, the stronger the slimming effect, with a preset value of 10. - FACE_SHAPE_AREA_FACELENGTH (103): Face length, used to achieve a longer face effect. The adjustment range is [-100,100]; positive values elongate the face, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of 0. - FACE_SHAPE_AREA_FACEWIDTH (104): Face width, used to achieve a narrower face effect. The adjustment range is [0,100]; the larger the value, the stronger the narrowing effect, with a preset value of 10. - FACE_SHAPE_AREA_CHEEKBONE (105): Cheekbone, used to adjust cheekbone width. The adjustment range is [0,100]; the larger the value, the narrower the cheekbones, with a preset set value of 43. - FACE_SHAPE_AREA_CHEEK (106): Cheeks, used to adjust the cheeks width. The adjustment range is [0,100]; the larger the value, the narrower the cheeks, with a preset value of 50. - FACE_SHAPE_AREA_CHIN (108): Chin, used to adjust the chin length. The adjustment range is [-100,100]; positive values elongate the chin, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of -20. - FACE_SHAPE_AREA_EYESCALE (200):Eyes, used to achieve a larger eye effect. The adjustment range is [0,100]; the larger the value, the larger the eye size, with a preset value of 50. - FACE_SHAPE_AREA_EYEDISTANCE (201): Eye distance adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_EYEPOSITION (202): Eye position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_LOWEREYELID (203): Lower eyelid adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEPUPILS (204): Pupil size adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEINNERCORNER (205): Inner eye corner adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEOUTERCORNER (206): Outer eye corner adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSELENGTH (300): Nose length, used to achieve a longer nose effect. The adjustment range is [-100,100]; positive values elongate the nose, while negative values shorten it. The larger the value, the stronger the enhancement effect, with a preset value of -10. - FACE_SHAPE_AREA_NOSEWIDTH (301): Nose width, used to achieve a slimmer nose effect. The adjustment range is [-100,100]; positive values make the nose wider, while negative values make it narrower. The larger the value, the stronger the enhancement effect, with a preset value of 72. - FACE_SHAPE_AREA_NOSEWING (302): Nose wing adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEROOT (303): Nose root adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEBRIDGE (304): Nose bridge adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSETIP (305): Nose tip adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_NOSEGENERAL (306): Overall nose adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_MOUTHSCALE (400): Mouth, used to achieve a larger mouth effect. The adjustment strength ranges from [0,100], with larger values resulting in a larger mouth. The default value is 50. - FACE_SHAPE_AREA_MOUTHPOSITION (401): Mouth position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_MOUTHSMILE (402): Mouth smile adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_MOUTHLIP (403): Lip shape adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment. - FACE_SHAPE_AREA_EYEBROWPOSITION (500): Eyebrow position adjustment. The range is [-100, 100], with a default value of 0. The greater the absolute value, the more noticeable the adjustment. Negative values indicate the opposite direction. - FACE_SHAPE_AREA_EYEBROWTHICKNESS (501): Eyebrow thickness adjustment. The range is [0, 100], with a default value of 0. The larger the value, the more noticeable the adjustment.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - Use the default value `PRIMARY_CAMERA_SOURCE` if you use camera to capture local video. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - A pointer to the `FaceShapeAreaOptions` instance, if the method call succeeds. - NULL is returned, if the method call fails.
-
setFilterEffectOptions
- Parameters:
enabled- Whether to enable the filter effect: - `true`: Yes. - `false`: (Default) No.options- The filter effect options. See `FilterEffectOptions`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.4.1
-
setFilterEffectOptions
public abstract int setFilterEffectOptions(boolean enabled, FilterEffectOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable the filter effect: - `true`: Yes. - `false`: (Default) No.options- The filter effect options. See `FilterEffectOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - Use the default value `PRIMARY_CAMERA_SOURCE` if you use camera to capture local video. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.4.1.
-
setLowlightEnhanceOptions
- Parameters:
enabled- Whether to enable low-light enhancement: - `true`: Enable low-light enhancement. - `false`: (Default) Disable low-light enhancement.options- The low-light enhancement options. See `LowLightEnhanceOptions`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
setLowlightEnhanceOptions
public abstract int setLowlightEnhanceOptions(boolean enabled, LowLightEnhanceOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable low-light enhancement: - `true`: Enable low-light enhancement. - `false`: (Default) Disable low-light enhancement.options- The low-light enhancement options. See `LowLightEnhanceOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - The default value is `PRIMARY_CAMERA_SOURCE`. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
setVideoDenoiserOptions
- Parameters:
enabled- Whether to enable video noise reduction: - `true`: Enable video noise reduction. - `false`: (Default) Disable video noise reduction.options- The video noise reduction options. See `VideoDenoiserOptions`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
setVideoDenoiserOptions
public abstract int setVideoDenoiserOptions(boolean enabled, VideoDenoiserOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable video noise reduction: - `true`: Enable video noise reduction. - `false`: (Default) Disable video noise reduction.options- The video noise reduction options. See `VideoDenoiserOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - The default value is `PRIMARY_CAMERA_SOURCE`. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
setColorEnhanceOptions
- Parameters:
enabled- Whether to enable color enhancement: - `true` Enable color enhancement. - `false`: (Default) Disable color enhancement.options- The color enhancement options. See `ColorEnhanceOptions`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
setColorEnhanceOptions
public abstract int setColorEnhanceOptions(boolean enabled, ColorEnhanceOptions options, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable color enhancement: - `true` Enable color enhancement. - `false`: (Default) Disable color enhancement.options- The color enhancement options. See `ColorEnhanceOptions`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - The default value is `PRIMARY_CAMERA_SOURCE`. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.6.2
-
createVideoEffectObject
public abstract IVideoEffectObject createVideoEffectObject(String bundlePath, Constants.MediaSourceType sourceType) - Parameters:
bundlePath- The path to the video effect resource package.sourceType- The media source type, such as PRIMARY_CAMERA_SOURCE. See `MediaSourceType`.- Returns:
- - The `IVideoEffectObject` object, if the method call succeeds. - `null`, if the method call fails.
- Since:
- v4.6.0
-
destroyVideoEffectObject
- Parameters:
videoEffectObject- The video effect object to be destroyed. See `IVideoEffectObject`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.6.0
-
enableVirtualBackground
public abstract int enableVirtualBackground(boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty) - Parameters:
enabled- Whether to enable virtual background: - `true`: Enable virtual background. - `false`: Disable virtual background.backgroundSource- The custom background. See `VirtualBackgroundSource`. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted.segproperty- Processing properties for background images. See `SegmentationProperty`.- Returns:
- - 0: Success. - < 0: Failure. - -4: The device capabilities do not meet the requirements for the virtual background feature. Agora recommends you try it on devices with higher performance.
-
enableVirtualBackground
public abstract int enableVirtualBackground(boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, Constants.MediaSourceType sourceType) - Parameters:
enabled- Whether to enable virtual background: - `true`: Enable virtual background. - `false`: Disable virtual background.backgroundSource- The custom background. See `VirtualBackgroundSource`. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted.segproperty- Processing properties for background images. See `SegmentationProperty`.sourceType- The type of the media source to which the filter effect is applied. See `MediaSourceType`.Attention: In this method, this parameter supports only the following two settings: - The default value is `PRIMARY_CAMERA_SOURCE`. - Set this parameter to `CUSTOM_VIDEO_SOURCE` if you use custom video source.- Returns:
- - 0: Success. - < 0: Failure. - -4: The device capabilities do not meet the requirements for the virtual background feature. Agora recommends you try it on devices with higher performance.
-
setDefaultAudioRoutetoSpeakerphone
public abstract int setDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker) - Parameters:
defaultToSpeaker- Whether to set the speakerphone as the default audio route: - `true`: Set the speakerphone as the default audio route. - `false`: Set the earpiece as the default audio route.- Returns:
- - 0: Success. - < 0: Failure.
-
setEnableSpeakerphone
public abstract int setEnableSpeakerphone(boolean enabled) - Parameters:
enabled- Sets whether to enable the speakerphone or earpiece: - `true`: Enable device state monitoring. The audio route is the speakerphone. - `false`: Disable device state monitoring. The audio route is the earpiece.- Returns:
- - 0: Success. - < 0: Failure.
-
setRouteInCommunicationMode
public abstract int setRouteInCommunicationMode(int route) - Parameters:
route- The audio playback route you want to use: - -1: The default audio route. - 0: Headphones with microphone. - 1: Handset. - 2: Headphones without microphone. - 3: Device's built-in speaker. - 4: (Not supported yet) External speakers. - 5: Bluetooth headphones. - 6: USB device.- Returns:
- Without practical meaning.
-
isSpeakerphoneEnabled
public abstract boolean isSpeakerphoneEnabled()- 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
public abstract int enableInEarMonitoring(boolean enabled) - Parameters:
enabled- Enables or disables in-ear monitoring. - `true`: Enables in-ear monitoring. - `false`: (Default) Disables in-ear monitoring.- Returns:
- - 0: Success. - < 0: Failure. - - 8: Make sure the current audio routing is Bluetooth or headset.
-
enableInEarMonitoring
public abstract int enableInEarMonitoring(boolean enabled, int includeAudioFilters) - Parameters:
enabled- Enables or disables in-ear monitoring. - `true`: Enables in-ear monitoring. - `false`: (Default) Disables in-ear monitoring.includeAudioFilters- The audio filter types of in-ear monitoring: - EAR_MONITORING_FILTER_NONE (1 << 0): No audio filter added to in-ear monitoring. - EAR_MONITORING_FILTER_BUILT_IN_AUDIO_FILTERS (1 << 1): Add vocal effects audio filter to in-ear monitoring. If you implement functions such as voice beautifier and audio effect, users can hear the voice after adding these effects. This enumerator supports combination using the bitwise OR operator (|). - EAR_MONITORING_FILTER_NOISE_SUPPRESSION (1 << 2): Add noise suppression audio filter to in-ear monitoring. This enumerator supports combination using the bitwise OR operator (|). - EAR_MONITORING_FILTER_REUSE_POST_PROCESSING_FILTER (1 <<15): Reuse the audio filter that has been processed on the sending end for in-ear monitoring. This enumerator reduces CPU usage while increasing in-ear monitoring latency, which is suitable for latency-tolerant scenarios requiring low CPU consumption. This enumerator is only supported for standalone use. Once selected, other audio filter configurations will be automatically disabled. Attention: This parameter only takes effect when `enabled` is set as `true`.- Returns:
- - 0: Success. - < 0: Failure. - - 8: Make sure the current audio routing is Bluetooth or headset.
-
setInEarMonitoringVolume
public abstract int setInEarMonitoringVolume(int volume) - Parameters:
volume- The volume of the user. The value range is [0,400]. - 0: Mute. - 100: (Default) The original volume. - 400: Four times the original volume (amplifying the audio signals by four times).- Returns:
- - 0: Success. - < 0: Failure. - -2: Invalid parameter settings, such as in-ear monitoring volume exceeding the valid range (< 0 or > 400).
-
setLocalVoicePitch
public abstract int setLocalVoicePitch(double pitch) - Parameters:
pitch- The local voice pitch. The value range is [0.5,2.0]. The lower the value, the lower the pitch. The default value is 1.0 (no change to the pitch).- Returns:
- - 0: Success. - < 0: Failure.
-
setLocalVoiceFormant
public abstract int setLocalVoiceFormant(double formantRatio) - Parameters:
formantRatio- The formant ratio. The value range is [-1.0, 1.0]. The default value is 0.0, which means do not change the timbre of the voice.Note: Agora recommends setting this value within the range of [-0.4, 0.6]. Otherwise, the voice may be seriously distorted.- Returns:
- - 0: Success. - < 0: Failure.
-
setLocalVoiceEqualization
public abstract int setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) - Parameters:
bandFrequency- The band frequency. The value ranges between 0 and 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 250, 500, 1k, 2k, 4k, 8k, and 16k Hz. See `AUDIO_EQUALIZATION_BAND_FREQUENCY`.bandGain- The gain of each band in dB. The value ranges between -15 and 15. The default value is 0.- Returns:
- - 0: Success. - < 0: Failure.
-
setLocalVoiceReverb
- Parameters:
reverbKey- The reverberation key. Agora provides five reverberation keys, see `AUDIO_REVERB_TYPE`.value- The value of the reverberation key.- Returns:
- - 0: Success. - < 0: Failure.
-
setHeadphoneEQPreset
public abstract int setHeadphoneEQPreset(int preset) - Parameters:
preset- The preset headphone equalization effect: - HEADPHONE_EQUALIZER_OFF: The headphone equalizer is disabled, and the original audio is heard. - HEADPHONE_EQUALIZER_OVEREAR: An equalizer is used for headphones. - HEADPHONE_EQUALIZER_INEAR: An equalizer is used for in-ear headphones.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason).
-
setHeadphoneEQParameters
public abstract int setHeadphoneEQParameters(int lowGain, int highGain) - Parameters:
lowGain- The low-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the deeper the sound.highGain- The high-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the sharper the sound.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason).
-
setAudioEffectPreset
public abstract int setAudioEffectPreset(int preset) - Parameters:
preset- Preset audio effects. - AUDIO_EFFECT_OFF: Turn off audio effects and use the original voice. - ROOM_ACOUSTICS_KTV: The reverberation style typical of a KTV venue. - ROOM_ACOUSTICS_VOCAL_CONCERT: The reverberation style typical of a concert hall. - ROOM_ACOUSTICS_STUDIO: The reverberation style typical of a recording studio. - ROOM_ACOUSTICS_PHONOGRAPH: The reverberation style typical of the vintage phonograph. - ROOM_ACOUSTICS_VIRTUAL_STEREO: A virtual stereo effect that renders monophonic audio as stereo audio. Before using this preset, set the `profile` parameter of `setAudioProfile(int profile)` to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5) ; otherwise, the preset setting is invalid. - ROOM_ACOUSTICS_SPACIAL: A more spatial audio effect. - ROOM_ACOUSTICS_ETHEREAL: A more ethereal audio effect. - ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND: Virtual surround sound, that is, the SDK generates a simulated surround sound field on the basis of stereo channels, thereby creating a surround sound effect. Attention: If the virtual surround sound is enabled, users need to use stereo audio playback devices to hear the anticipated audio effect. - ROOM_ACOUSTICS_CHORUS: A chorus audio effect. Agora recommends using this effect in chorus scenarios to enhance the sense of depth and dimension in the vocals. - ROOM_ACOUSTICS_3D_VOICE: A 3D voice effect that makes the voice appear to be moving around the user. The default cycle period is 10 seconds. After setting this effect, you can call `setAudioEffectParameters` to modify the movement period. - Before using this preset, set the `profile` parameter of `setAudioProfile(int profile)` to MUSIC_STANDARD_STEREO (3) or MUSIC_HIGH_QUALITY_STEREO (5); otherwise, the preset setting is invalid. - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_UNCLE: The reverberation style typical of an uncle's voice. Agora recommends using this preset to process a male-sounding voice; otherwise, you may not hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_OLDMAN: The voice of an old man. Agora recommends using this preset to process a male-sounding voice; otherwise, you may not hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_BOY: The voice of a boy. Agora recommends using this preset to process a male-sounding voice; otherwise, you may not hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_SISTER: The voice of a young woman. Agora recommends using this preset to process a female-sounding voice; otherwise, you may not hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_GIRL: The voice of a girl. Agora recommends using this preset to process a female-sounding voice; otherwise, you may not hear the anticipated voice effect. - VOICE_CHANGER_EFFECT_PIGKING: The voice of Pig King, a character in Journey to the West who has a voice like a growling bear. - VOICE_CHANGER_EFFECT_HULK: The voice of the Hulk. - STYLE_TRANSFORMATION_RNB: The reverberation style typical of R&B music. Before using this preset, set the `profile` parameter of `setAudioProfile(int profile)` to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5) ; otherwise, the preset setting is invalid. - STYLE_TRANSFORMATION_POPULAR: The reverberation style typical of popular music. Before using this preset, set the `profile` parameter of `setAudioProfile(int profile)` to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5) ; otherwise, the preset setting is invalid. - PITCH_CORRECTION: A pitch correction effect that corrects the user's pitch based on the pitch of the natural C major scale. After setting this voice effect, you can call `setAudioEffectParameters` to adjust the basic mode of tuning and the pitch of the main tone.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.2.0
-
setVoiceBeautifierPreset
public abstract int setVoiceBeautifierPreset(int preset) - Parameters:
preset- The preset voice beautifier effect options. - VOICE_BEAUTIFIER_OFF: Turn off voice beautifier effects and use the original voice. - CHAT_BEAUTIFIER_MAGNETIC: A more magnetic voice (Male only). - CHAT_BEAUTIFIER_FRESH: A fresher voice (Female only). - CHAT_BEAUTIFIER_VITALITY: A more vital voice (Female only). - SINGING_BEAUTIFIER: The singing beautifier effect. - If you call `setVoiceBeautifierPreset` ( SINGING_BEAUTIFIER ), you can beautify a male-sounding voice and add a reverberation effect that sounds like singing in a small room. Agora recommends using this enumerator to process a male-sounding voice; otherwise, you might experience vocal distortion. - If you call `setVoiceBeautifierParameters` ( SINGING_BEAUTIFIER, param1, param2), you can beautify a male- or female-sounding voice and add a reverberation effect. - TIMBRE_TRANSFORMATION_VIGOROUS: A more rigorous vice. - TIMBRE_TRANSFORMATION_DEEP: A deep voice. - TIMBRE_TRANSFORMATION_MELLOW: A mellower voice. - TIMBRE_TRANSFORMATION_FALSETTO: Falsetto. - TIMBRE_TRANSFORMATION_FULL: A fuller voice. - TIMBRE_TRANSFORMATION_CLEAR: A clearer voice. - TIMBRE_TRANSFORMATION_RESOUNDING: A resounding voice. - TIMBRE_TRANSFORMATION_RINGING: A more ringing voice. - ULTRA_HIGH_QUALITY_VOICE: Ultra-high quality voice, which makes the audio clearer and restores more details. - To achieve better audio effect quality, Agora recommends that you call `setAudioProfile(int profile)` and set the `profile` to `MUSIC_HIGH_QUALITY` (4) or `MUSIC_HIGH_QUALITY_STEREO` (5) and `scenario ` to `AUDIO_SCENARIO_GAME_STREAMING` (3) before calling this method. - If you have an audio capturing device that can already restore audio details to a high degree, Agora recommends that you do not enable ultra-high quality; otherwise, the SDK may over-restore audio details, and you may not hear the anticipated voice effect.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.2.0
-
setVoiceConversionPreset
public abstract int setVoiceConversionPreset(int preset) - Parameters:
preset- The options for SDK preset voice conversion effects. - VOICE_CONVERSION_OFF: Turn off voice conversion effects and use the original voice. - VOICE_CHANGER_NEUTRAL: A gender-neutral voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. - VOICE_CHANGER_SWEET: A sweet voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. - VOICE_CHANGER_SOLID: A steady voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice. - VOICE_CHANGER_BASS: A deep voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.3.1
-
setAudioEffectParameters
public abstract int setAudioEffectParameters(int preset, int param1, int param2) - Parameters:
preset- The options for SDK preset audio effects: - `ROOM_ACOUSTICS_3D_VOICE`, 3D voice effect: - You need to set the `profile` parameter in `setAudioProfile(int profile)` to `MUSIC_STANDARD_STEREO` (3) or `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`, Pitch correction effect:param1- - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, `param1` sets the cycle period of the 3D voice effect. The value range is [1,60] and the unit is seconds. The default value is 10, indicating that the voice moves around you every 10 seconds. - If you set `preset` to `PITCH_CORRECTION`, `param1` indicates the basic mode of the pitch correction effect: - `1`: (Default) Natural major scale. - `2`: Natural minor scale. - `3`: Japanese pentatonic scale.param2- - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE` , you need to set `param2` to `0`. - If you set `preset` to `PITCH_CORRECTION`, `param2` indicates 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.
- Since:
- v3.2.0
-
setVoiceBeautifierParameters
public abstract int setVoiceBeautifierParameters(int preset, int param1, int param2) - Parameters:
preset- The option for the preset audio effect: - `SINGING_BEAUTIFIER`: The 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 effect options for the singing voice: - `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.
- Since:
- 3.3.0.
-
setVoiceConversionParameters
public abstract int setVoiceConversionParameters(int preset, int param1, int param2) Set parameters for SDK preset voice conversion.- Parameters:
preset- The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET.param1- reserved.param2- reserved.- Returns:
- - 0: Success. - < 0: Failure.
-
enableSoundPositionIndication
public abstract int enableSoundPositionIndication(boolean enabled) - Parameters:
enabled- Whether to enable stereo panning for remote users: - `true`: Enable stereo panning. - `false`: Disable stereo panning.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteVoicePosition
public abstract int setRemoteVoicePosition(int uid, double pan, double gain) - Parameters:
uid- The user ID of the remote user.pan- The voice position of the remote user. The value ranges from -1.0 to 1.0: - 0.0: (Default) The remote voice comes from the front. - -1.0: The remote voice comes from the left. - 1.0: The remote voice comes from the right.gain- The volume of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original volume of the remote user). The smaller the value, the lower the volume.- Returns:
- - 0: Success. - < 0: Failure.
-
enableVoiceAITuner
- Parameters:
enabled- Whether to enable the voice AI tuner: - `true`: Enables the voice AI tuner. - `false`: (Default) Disable the voice AI tuner.type- Voice AI tuner sound types, see `VOICE_AI_TUNER_TYPE`.- Returns:
- - 0: Success. - < 0: Failure.
-
startAudioMixing
- Parameters:
filePath- The file path. The SDK supports URI addresses starting with `content://`, paths starting with `/assets/`, URLs and absolute paths of local files. The absolute path needs to be accurate to the file name and extension. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. See `Supported Audio Formats`. Attention: If you have preloaded an audio effect into memory by calling `preloadEffect`, ensure that the value of this parameter is the same as that of `filePath` in `preloadEffect`.loopback- Whether to only play music files on the local client: - `true`: Only play music files on the local client so that only the local user can hear the music. - `false`: Publish music files to remote clients so that both the local user and remote users can hear the music.cycle- The number of times the music file plays. - > 0: The number of times for playback. For example, 1 represents playing 1 time. - -1: Play the audio file in an infinite loop.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -3: The SDK is not ready. - The audio module is disabled. - The program is not complete. - The initialization of `RtcEngine` fails. Reinitialize the `RtcEngine`.
-
enableSpatialAudio
public abstract int enableSpatialAudio(boolean enabled) - Parameters:
enabled- Whether to enable the spatial audio effect: - `true`: Enable the spatial audio effect. - `false`: Disable the spatial audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteUserSpatialAudioParams
- Parameters:
uid- The user ID. This parameter must be the same as the user ID passed in when the user joined the channel.params- The spatial audio parameters. See `SpatialAudioParams`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteVideoSubscriptionOptions
- Parameters:
uid- The user ID of the remote user.options- The video subscription options. See `VideoSubscriptionOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
setAINSMode
public abstract int setAINSMode(boolean enabled, int mode) - Parameters:
enabled- Whether to enable the AI noise suppression function: - `true`: Enable the AI noise suppression. - `false`: (Default) Disable the AI noise suppression.mode- The AI noise suppression modes: - 0: (Default) Balance mode. This mode allows for a balanced performance on noice suppression and time delay. - 1: Aggressive mode. In scenarios where high performance on noise suppression is required, such as live streaming outdoor events, this mode reduces nosies more dramatically, but sometimes may affect the original character of the audio. - 2: Aggressive mode with low latency. The noise suppression delay of this mode is about only half of that of the balance and aggressive modes. It is suitable for scenarios that have high requirements on noise suppression with low latency, such as sing together online in real time.- Returns:
- - 0: Success. - < 0: Failure.
-
startAudioMixing
- Parameters:
filePath- File path: - Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with `/assets/`. 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`loopback- Whether to only play music files on the local client: - `true`: Only play music files on the local client so that only the local user can hear the music. - `false`: Publish music files to remote clients so that both the local user and remote users can hear the music.cycle- The number of times the music file plays. - > 0: The number of times for playback. For example, 1 represents playing 1 time. - -1: Play the audio file in an infinite loop.startPos- The playback position (ms) of the music file.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -3: The SDK is not ready. - The audio module is disabled. - The program is not complete. - The initialization of `RtcEngine` fails. Reinitialize the `RtcEngine`.
-
stopAudioMixing
public abstract int stopAudioMixing()- Returns:
- - 0: Success. - < 0: Failure.
-
pauseAudioMixing
public abstract int pauseAudioMixing()- Returns:
- - 0: Success. - < 0: Failure.
-
resumeAudioMixing
public abstract int resumeAudioMixing()- Returns:
- - 0: Success. - < 0: Failure.
-
adjustAudioMixingVolume
public abstract int adjustAudioMixingVolume(int volume) - Parameters:
volume- Audio mixing volume. The value ranges between 0 and 100. The default value is 100, which means the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
adjustAudioMixingPlayoutVolume
public abstract int adjustAudioMixingPlayoutVolume(int volume) - Parameters:
volume- The volume of audio mixing for local playback. The value ranges between 0 and 100 (default). 100 represents the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
adjustAudioMixingPublishVolume
public abstract int adjustAudioMixingPublishVolume(int volume) - Parameters:
volume- The volume of audio mixing for local playback. The value ranges between 0 and 100 (default). 100 represents the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
getAudioMixingPlayoutVolume
public abstract int getAudioMixingPlayoutVolume()- Returns:
- - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. - < 0: Failure.
-
getAudioMixingPublishVolume
public abstract int getAudioMixingPublishVolume()- Returns:
- - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. - < 0: Failure.
-
getAudioMixingDuration
public abstract int getAudioMixingDuration()- Returns:
- - ≥ 0: The audio mixing duration, if this method call succeeds. - < 0: Failure.
-
getAudioMixingCurrentPosition
public abstract int getAudioMixingCurrentPosition()- Returns:
- - ≥ 0: The current playback position (ms) of the audio mixing, if this method call succeeds. 0 represents that the current music file does not start playing. - < 0: Failure.
-
setAudioMixingPosition
public abstract int setAudioMixingPosition(int pos) - Parameters:
pos- Integer. The playback position (ms).- Returns:
- - 0: Success. - < 0: Failure.
-
setAudioMixingDualMonoMode
- Parameters:
mode- The channel mode. See `AudioMixingDualMonoMode`.- Returns:
- - 0: Success. - < 0: Failure.
-
setAudioMixingPitch
public abstract int setAudioMixingPitch(int pitch) - Parameters:
pitch- Sets the pitch of the local music file by the chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file.- Returns:
- - 0: Success. - < 0: Failure.
-
setAudioMixingPlaybackSpeed
public abstract int setAudioMixingPlaybackSpeed(int speed) - Parameters:
speed- The playback speed. Agora recommends that you set this to a value 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
public abstract int selectAudioTrack(int audioIndex) - Parameters:
audioIndex- The audio track you want to specify. The value should be greater than 0 and less than that of returned by `getAudioTrackCount`.- Returns:
- - 0: Success. - < 0: Failure.
-
getAudioTrackCount
public abstract int getAudioTrackCount()- Returns:
- - The SDK returns the index of the audio tracks if the method call succeeds. - < 0: Failure.
-
getAudioEffectManager
- Returns:
- `IAudioEffectManager`
-
startAudioRecording
- Parameters:
filePath- The absolute path where the recording file is saved locally, including the file name and extension. For example: `/sdcard/emulated/0/audio.aac`. Note: Make sure that the specified path exists and is writable.quality- Recording quality. - 0: Low quality. Sample rate is 32 kHz. The file size for 10 minutes of recording is approximately 1.2 MB. - 1: Medium quality. Sample rate is 32 kHz. The file size for 10 minutes of recording is approximately 2 MB. - 2: High quality. Sample rate is 32 kHz. The file size for 10 minutes of recording is approximately 3.75 MB.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting.
-
startAudioRecording
public abstract int startAudioRecording(io.agora.rtc2.internal.AudioRecordingConfiguration config) - Parameters:
config- Recording configuration. See `AudioRecordingConfiguration` for details.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Code` for details and troubleshooting tips.
-
stopAudioRecording
public abstract int stopAudioRecording()- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting suggestions.
-
startEchoTest
- Parameters:
config- The configuration of the audio and video call loop test. See `EchoTestConfiguration`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopEchoTest
public abstract int stopEchoTest()- Returns:
- - 0: Success. - < 0: Failure. - -5(ERR_REFUSED): Failed to stop the echo test. The echo test may not be running.
-
startLastmileProbeTest
public abstract int startLastmileProbeTest(io.agora.rtc2.internal.LastmileProbeConfig config) - Parameters:
config- The configurations of the last-mile network probe test. See `LastmileProbeConfig`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopLastmileProbeTest
public abstract int stopLastmileProbeTest()- Returns:
- - 0: Success. - < 0: Failure.
-
setExternalAudioSource
@Deprecated public abstract int setExternalAudioSource(boolean enabled, int sampleRate, int channels) Deprecated.This method is deprecated. Use createCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) instead.- Parameters:
enabled- - `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 be set as 8000, 16000, 32000, 44100, or 48000.channels- The number of audio channels of the external audio source: - 1: Mono. - 2: Stereo.- Returns:
- - 0: Success. - < 0: Failure.
-
setExternalAudioSink
public abstract int setExternalAudioSink(boolean enabled, int sampleRate, int channels) - Parameters:
enabled- Whether to enable or disable the external audio sink: - `true`: Enables the external audio sink. - `false`: (Default) Disables the external audio sink.sampleRate- The sample rate (Hz) of the external audio sink, which can be set 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
- Parameters:
eglContext- The EGL context for rendering remote video streams.- Returns:
- - 0: Success. - < 0: Failure.
-
pullPlaybackAudioFrame
public abstract int pullPlaybackAudioFrame(byte[] data, int lengthInByte) - Parameters:
data- The remote audio data to be pulled. The data type is `byte[]`.lengthInByte- The data length (byte). 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`. `lengthInByte` = `sampleRate`/1000 × 2 × `channels` × audio duration (ms).- Returns:
- - 0: Success. - < 0: Failure.
-
pullPlaybackAudioFrame
- Parameters:
data- The remote audio data to be pulled. The data type is `ByteBuffer`.lengthInByte- The length (in bytes) of the remote 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`. `lengthInByte` = `sampleRate` /1000 × 2 × `channels` × audio duration (ms).- Returns:
- - 0: Success. - < 0: Failure.
-
startRecordingDeviceTest
public abstract int startRecordingDeviceTest(int indicationInterval) - Parameters:
indicationInterval- The interval (ms) for triggering the `onAudioVolumeIndication` callback. This value should be set to greater than 10, otherwise, you will not receive the `onAudioVolumeIndication` callback and the SDK returns the error code `-2`. Agora recommends that you set this value to 100.- Returns:
- - 0: Success. - < 0: Failure. - -2: Invalid parameters. Check your parameter settings.
-
stopRecordingDeviceTest
public abstract int stopRecordingDeviceTest()- Returns:
- - 0: Success. - < 0: Failure.
-
startPlaybackDeviceTest
- Parameters:
audioFileName- The path of the audio file. The data format is string in UTF-8. - Supported file formats: wav, mp3, m4a, and aac. - Supported file sample rates: 8000, 16000, 32000, 44100, and 48000 Hz.- Returns:
- - 0: Success. - < 0: Failure.
-
stopPlaybackDeviceTest
public abstract int stopPlaybackDeviceTest()- Returns:
- - 0: Success. - < 0: Failure.
-
createCustomAudioTrack
public abstract int createCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) - Parameters:
trackType- The type of the custom audio track. See `AudioTrackType`.Attention: If `AUDIO_TRACK_DIRECT` is specified for this parameter, you must set `publishMicrophoneTrack` to `false` in `ChannelMediaOptions` when calling `joinChannel(String token, String channelId, int uid, ChannelMediaOptions options)` to join the channel; otherwise, joining the channel fails and returns the error code -2.config- The configuration of the custom audio track. See `AudioTrackConfig`.- Returns:
- - If the method call is successful, the audio track ID is returned as the unique identifier of the audio track. - If the method call fails, 0xffffffff is returned.
-
destroyCustomAudioTrack
public abstract int destroyCustomAudioTrack(int trackId) - Parameters:
trackId- The custom audio track ID returned in `createCustomAudioTrack`.- Returns:
- - 0: Success. - < 0: Failure.
-
setExternalAudioSource
@Deprecated public abstract int setExternalAudioSource(boolean enabled, int sampleRate, int channels, boolean localPlayback, boolean publish) Deprecated.This method is deprecated. Use createCustomAudioTrack(Constants.AudioTrackType trackType, AudioTrackConfig config) instead.- Parameters:
enabled- 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 be set as `8000`, `16000`, `32000`, `44100`, or `48000`.channels- The number of channels of the external audio source, which can be set as `1` (Mono) or `2` (Stereo).localPlayback- Whether to play the external audio source: - `true`: Play the external audio source. - `false`: (Default) Do not play the external source.publish- Whether to publish audio to the remote users: - `true`: (Default) Publish audio to the remote users. - `false`: Do not publish audio to the remote users.- Returns:
- - 0: Success. - < 0: Failure.
-
pushExternalAudioFrame
Deprecated.This method is deprecated. Use pushExternalAudioFrame(byte[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) instead.Pushes the external audio data to the app.- Parameters:
data- The audio buffer data.timestamp- The timestamp of the audio data.- Returns:
- - 0: Success. - < 0: Failure.
-
pushExternalAudioFrame
@Deprecated public abstract int pushExternalAudioFrame(ByteBuffer data, long timestamp, int trackId) Deprecated.This method is deprecated. Use pushExternalAudioFrame(ByteBuffer[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) instead.Pushes the external audio data to the app.- Parameters:
data- The audio buffer data.timestamp- The timestamp of the audio data.trackId- The audio track ID.- Returns:
- - 0: Success. - < 0: Failure.
-
pushExternalAudioFrame
public abstract int pushExternalAudioFrame(byte[] data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) - Parameters:
data- The external audio data.timestamp- The timestamp (ms) of the external audio frame. This parameter is required. You can use it to restore the order of the captured audio frames, or synchronize audio and video frames in video-related scenarios (including scenarios where external video sources are used).sampleRate- The sample rate (Hz) of the external audio source which can be set as `8000`, `16000`, `32000`, `44100`, or `48000`.channels- The number of channels of the external audio source, which can be set as `1` (Mono) or `2` (Stereo).bytesPerSample- The number of bytes per sample. For PCM, this parameter is generally set to 16 bits (2 bytes).trackId- The audio track ID. Set this parameter to the custom audio track ID returned in `createCustomAudioTrack`.- Returns:
- - 0: Success. - < 0: Failure.
-
pushExternalAudioFrame
public abstract int pushExternalAudioFrame(ByteBuffer data, long timestamp, int sampleRate, int channels, Constants.BytesPerSample bytesPerSample, int trackId) 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 sampletrackId- The audio track ID.- Returns:
- - 0: Success. - < 0: Failure.
-
setExternalVideoSource
public abstract int setExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType) - Parameters:
enable- Whether to use the external video source: - `true`: Use the external video source. The SDK prepares to accept the external video frame. - `false`: (Default) Do not use the external video source.useTexture- Whether to use the external video frame in the Texture format. - `true`: Use the external video frame in the Texture format. - `false`: (Default) Do not use the external video frame in the Texture format.sourceType- Whether the external video frame is encoded. See `ExternalVideoSourceType`.- Returns:
- - 0: Success. - < 0: Failure.
-
setExternalVideoSource
public abstract int setExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType, EncodedVideoTrackOptions encodedOpt) 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
Deprecated.This method is deprecated.- Parameters:
frame- Video frame to be pushed. See `VideoFrame`.- Returns:
- - `true`: Success. - `false`: Failure.
-
pushExternalVideoFrameById
public abstract int pushExternalVideoFrameById(VideoFrame frame, int videoTrackId) - Parameters:
frame- Video frame to be pushed. See `VideoFrame`.videoTrackId- The video track ID returned by calling the `createCustomVideoTrack` method.Note: If you only need to push one custom video source, set `videoTrackId` to 0.- Returns:
- - 0: Pushes the external encoded video frame to the SDK successfully. - < 0: Fails to push external encoded video frames to the SDK.
-
pushExternalEncodedVideoFrame
@Deprecated public abstract int pushExternalEncodedVideoFrame(ByteBuffer data, EncodedVideoFrameInfo frameInfo) Deprecated.This method is deprecated.Pushes the encoded external video frame to Agora SDK.- Parameters:
data- The encoded external video data, which must be the direct buffer.frameInfo- The encoded external video frame info:EncodedVideoFrameInfo.- Returns:
- - 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.
-
pushExternalEncodedVideoFrameById
public abstract int pushExternalEncodedVideoFrameById(ByteBuffer data, EncodedVideoFrameInfo frameInfo, int videoTrackId) Pushes the encoded external video frame to the app with specified connection.- 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.- Returns:
- - 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.
-
isTextureEncodeSupported
public abstract boolean isTextureEncodeSupported()- Returns:
- - `true`: Supports the Texture encoding. - `false`: Does not support the Texture encoding.
-
registerAudioFrameObserver
- Parameters:
observer- The observer instance. See `IAudioFrameObserver`. Set the value as NULL to release the instance. Agora recommends calling this method after receiving `onLeaveChannel` to release the audio observer object.- Returns:
- - 0: Success. - < 0: Failure.
-
registerAudioEncodedFrameObserver
public abstract int registerAudioEncodedFrameObserver(io.agora.rtc2.internal.AudioEncodedFrameObserverConfig config, IAudioEncodedFrameObserver observer) - Parameters:
config- Observer settings for the encoded audio. See `AudioEncodedFrameObserverConfig`.observer- The encoded audio observer. See `IAudioEncodedFrameObserver`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRecordingAudioFrameParameters
public abstract int setRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) - Parameters:
sampleRate- The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.channel- The number of audio channels. You can set the value as 1 or 2. - 1: Mono. - 2: Stereo.mode- The use mode of the audio frame: - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY (0): (Default) Read only mode. For example, when users acquire the data with the Agora SDK, then push the RTMP or RTMPS 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 audio-effect processing module and perform some voice pre-processing, such as a voice change.samplesPerCall- The number of data samples, such as 1024 for the Media Push.- Returns:
- - 0: Success. - < 0: Failure.
-
setPlaybackAudioFrameParameters
public abstract int setPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) - Parameters:
sampleRate- The sample rate returned in the callback, which can be set as 8000, 16000, 24000, 32000, 44100, or 48000 Hz.channel- The number of audio channels. You can set the value as 1 or 2. - 1: Mono. - 2: Stereo.mode- The use mode of the audio frame: - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY (0): (Default) Read only mode. For example, when users acquire the data with the Agora SDK, then push the RTMP or RTMPS 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 audio-effect processing module and perform some voice pre-processing, such as a voice change.samplesPerCall- The number of data samples, such as 1024 for the Media Push.- Returns:
- - 0: Success. - < 0: Failure.
-
setMixedAudioFrameParameters
public abstract int setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) - Parameters:
sampleRate- The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.channel- The number of audio channels. You can set the value as 1 or 2. - 1: Mono. - 2: Stereo.samplesPerCall- The number of data samples, such as 1024 for the Media Push.- Returns:
- - 0: Success. - < 0: Failure.
-
setEarMonitoringAudioFrameParameters
public abstract int setEarMonitoringAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall) - Parameters:
sampleRate- The sample rate of the audio data reported in the `onEarMonitoringAudioFrame` callback, which can be set as 8,000, 16,000, 32,000, 44,100, or 48,000 Hz.channel- The number of audio channels reported in the `onEarMonitoringAudioFrame` callback. - 1: Mono. - 2: Stereo.mode- The use mode of the audio frame: - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY (0): (Default) Read only mode. For example, when users acquire the data with the Agora SDK, then push the RTMP or RTMPS 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 audio-effect processing module and perform some voice pre-processing, such as a voice change.samplesPerCall- The number of data samples reported in the `onEarMonitoringAudioFrame` callback, such as 1,024 for the Media Push.- Returns:
- - 0: Success. - < 0: Failure.
-
addVideoWatermark
Deprecated.From v2.9.1. We recommend using theaddVideoWatermark2 method instead.- Parameters:
watermark- The watermark image to be added to the local live streaming: `AgoraImage`.- Returns:
- - 0: Success. - < 0: Failure.
-
addVideoWatermark
Deprecated.From v4.6.0. We recommend using theaddVideoWatermark2 method instead.- Parameters:
watermarkUrl- The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path.options- The options of the watermark image to be added. See `WatermarkOptions`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v2.9.1
-
addVideoWatermark
- Parameters:
config- Watermark configuration. See `WatermarkConfig`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.6.0
-
removeVideoWatermark
- Parameters:
id- The ID of the watermark image to be removed.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.6.0
-
clearVideoWatermarks
public abstract int clearVideoWatermarks()- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteUserPriority
public abstract int setRemoteUserPriority(int uid, int userPriority) Sets the priority of a remote user's media stream.- 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.
- Since:
- v2.4.0.
Use this method with the
setRemoteSubscribeFallbackOptionmethod. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
-
setRemoteSubscribeFallbackOption
- Parameters:
option- Fallback options for the subscribed stream. See `StreamFallbackOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteSubscribeFallbackOption
Deprecated.- Parameters:
option- Fallback options for the subscribed stream. - STREAM_FALLBACK_OPTION_DISABLED (0): No fallback processing is performed on audio and video streams, and the quality of the audio and video streams cannot be guaranteed. - STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW (1): (Default) Under poor downlink network conditions, the remote video stream, to which you subscribe, falls back to the low-quality (low resolution and low bitrate) video stream. - STREAM_FALLBACK_OPTION_AUDIO_ONLY (2): When the network conditions are poor, try to receive the low-quality video stream first. If the video cannot be displayed due to extremely poor network environment, then fall back to receiving audio-only stream.- Returns:
- - 0: Success. - < 0: Failure.
-
setHighPriorityUserList
public abstract int setHighPriorityUserList(int[] uidList, int option) 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
Deprecated.v4.2.0. This method is deprecated. Use setDualStreamMode instead.- Parameters:
enabled- Whether to enable dual-stream mode: - `true`: Enable dual-stream mode. - `false`: (Default) Disable dual-stream mode.- Returns:
- - 0: Success. - < 0: Failure.
-
enableDualStreamMode
@Deprecated public abstract int enableDualStreamMode(boolean enabled, SimulcastStreamConfig streamConfig) Deprecated.v4.2.0. This method is deprecated. Use setDualStreamMode instead.- Parameters:
enabled- Whether to enable dual-stream mode: - `true`: Enable dual-stream mode. - `false`: (Default) Disable dual-stream mode.streamConfig- The configuration of the low-quality video stream. See `SimulcastStreamConfig`.Note: When setting `mode` to `DISABLE_SIMULCAST_STREAM`, setting `streamConfig` will not take effect.- Returns:
- - 0: Success. - < 0: Failure.
-
setDualStreamMode
- Parameters:
mode- The mode in which the video stream is sent. See `SimulcastStreamMode`.- Returns:
- - 0: Success. - < 0: Failure.
-
setDualStreamMode
public abstract int setDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig) - Parameters:
mode- The mode in which the video stream is sent. See `SimulcastStreamMode`.streamConfig- The configuration of the low-quality video stream. See `SimulcastStreamConfig`.Note: When setting `mode` to `DISABLE_SIMULCAST_STREAM`, setting `streamConfig` will not take effect.- Returns:
- - 0: Success. - < 0: Failure.
-
setSimulcastConfig
- Parameters:
simulcastConfig- Configuration for different video steam layers. See `SimulcastConfig`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.6.0
-
setLocalRenderTargetFps
- Parameters:
sourceType- The type of the video source. See `VideoSourceType`.targetFps- The capture frame rate (fps) of the local video. Sopported values are: 1, 7, 10, 15, 24, 30, 60.CAUTION: Set this parameter to a value lower than the actual video frame rate; otherwise, the settings do not take effect.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteRenderTargetFps
public abstract int setRemoteRenderTargetFps(int targetFps) - Parameters:
targetFps- The capture frame rate (fps) of the local video. Sopported values are: 1, 7, 10, 15, 24, 30, 60.CAUTION: Set this parameter to a value lower than the actual video frame rate; otherwise, the settings do not take effect.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteVideoStreamType
- Parameters:
uid- The user ID.streamType- The video stream type, see `VideoStreamType`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteVideoStreamType
Deprecated.- Parameters:
uid- The user ID.streamType- The video stream type: - 0: High-quality video stream. - 1: Low-quality video stream.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteDefaultVideoStreamType
- Parameters:
streamType- The video stream type, see `VideoStreamType`.- Returns:
- - 0: Success. - < 0: Failure.
-
setRemoteDefaultVideoStreamType
Deprecated.- Parameters:
streamType- The default video-stream type: - VIDEO_STREAM_HIGH (0): High-quality stream, that is, a high-resolution and high-bitrate video stream. - VIDEO_STREAM_LOW (1): Low-quality stream, that is, a low-resolution and low-bitrate video stream.- Returns:
- - 0: Success. - < 0: Failure.
-
setSubscribeAudioBlocklist
public abstract int setSubscribeAudioBlocklist(int[] uidList) - Parameters:
uidList- The user ID list of users that you do not want to subscribe to. If you want to specify the audio streams of a user that you do not want to subscribe to, add the user ID in this list. If you want to remove a user from the blocklist, you need to call the `setSubscribeAudioBlocklist` method to update the user ID list; this means you only add the `uid` of users that you do not want to subscribe to in the new user ID list.- Returns:
- - 0: Success. - < 0: Failure.
-
setSubscribeAudioAllowlist
public abstract int setSubscribeAudioAllowlist(int[] uidList) - Parameters:
uidList- The user ID list of users that you want to subscribe to. If you want to specify the audio streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the `setSubscribeAudioAllowlist` method to update the user ID list; this means you only add the `uid` of users that you want to subscribe to in the new user ID list.- Returns:
- - 0: Success. - < 0: Failure.
-
setSubscribeVideoBlocklist
public abstract int setSubscribeVideoBlocklist(int[] uidList) - Parameters:
uidList- The user ID list of users that you do not want to subscribe to. If you want to specify the video streams of a user that you do not want to subscribe to, add the user ID of that user in this list. If you want to remove a user from the blocklist, you need to call the `setSubscribeVideoBlocklist` method to update the user ID list; this means you only add the `uid` of users that you do not want to subscribe to in the new user ID list.- Returns:
- - 0: Success. - < 0: Failure.
-
setSubscribeVideoAllowlist
public abstract int setSubscribeVideoAllowlist(int[] uidList) - Parameters:
uidList- The user ID list of users that you want to subscribe to. If you want to specify the video streams of a user for subscription, add the user ID of that user in this list. If you want to remove a user from the allowlist, you need to call the `setSubscribeVideoAllowlist` method to update the user ID list; this means you only add the `uid` of users that you want to subscribe to in the new user ID list.- Returns:
- - 0: Success. - < 0: Failure.
-
enableEncryption
public abstract int enableEncryption(boolean enabled, io.agora.rtc2.internal.EncryptionConfig config) - Parameters:
enabled- Whether to enable built-in encryption: - true: Enable the built-in encryption. - false: (Default) Disable the built-in encryption.config- Built-in encryption configurations. See `EncryptionConfig`.- Returns:
- - 0: Success. - < 0: Failure. - -2: An invalid parameter is used. Set the parameter with a valid value. - -4: The built-in encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. - -7: The SDK is not initialized. Initialize the `RtcEngine` instance before calling this method.
-
startRtmpStreamWithoutTranscoding
- Parameters:
url- The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.- Returns:
- - 0: Success. - < 0: Failure. - -2: The URL or configuration of transcoding is invalid; check your URL and transcoding configurations. - -7: The SDK is not initialized before calling this method. - -19: The Media Push URL is already in use; use another URL instead.
-
startRtmpStreamWithTranscoding
- Parameters:
url- The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.transcoding- The transcoding configuration for Media Push. See `LiveTranscoding`.- Returns:
- - 0: Success. - < 0: Failure. - -2: The URL or configuration of transcoding is invalid; check your URL and transcoding configurations. - -7: The SDK is not initialized before calling this method. - -19: The Media Push URL is already in use; use another URL instead.
-
updateRtmpTranscoding
- Parameters:
transcoding- The transcoding configuration for Media Push. See `LiveTranscoding`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopRtmpStream
- Parameters:
url- The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.- Returns:
- - 0: Success. - < 0: Failure.
-
createDataStream
public abstract int createDataStream(boolean reliable, boolean ordered) - Parameters:
reliable- Sets whether the recipients are guaranteed to receive the data stream within five seconds: - `true`: The recipients receive the data from the sender within five seconds. If the recipient does not receive the data within five seconds, the SDK triggers the `onStreamMessageError` callback and returns an error code. - `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. Attention: Please ensure that `reliable` and `ordered` are either both set to`true` or both set to `false`.ordered- Sets whether the recipients receive the data stream in the sent order: - `true`: The recipients receive the data in the sent order. - `false`: The recipients do not receive the data in the sent order.- Returns:
- - ID of the created data stream, if the method call succeeds. - < 0: Failure.
-
createDataStream
- Parameters:
config- The configurations for the data stream. See `DataStreamConfig`.- Returns:
- - ID of the created data stream, if the method call succeeds. - < 0: Failure.
-
sendStreamMessage
public abstract int sendStreamMessage(int streamId, byte[] message) - Parameters:
streamId- The data stream ID. You can get the data stream ID by calling `createDataStream(DataStreamConfig config)` .message- The message to be sent.- Returns:
- - 0: Success. - < 0: Failure.
-
sendRdtMessage
public abstract int sendRdtMessage(int uid, int type, byte[] message) - Parameters:
uid- remote user id.type- Reliable Data Transmission tunnel message type.message- The sent data.- Returns:
- - 0: Success. - < 0: Failure.
-
sendMediaControlMessage
public abstract int sendMediaControlMessage(int uid, byte[] message) - Parameters:
uid- remote user id. In particular, if the uid is set to 0, it means broadcasting the message to the entire channel.message- The sent data, max 1024 Bytes.- Returns:
- - 0: Success. - < 0: Failure.
-
setVideoQualityParameters
public abstract int setVideoQualityParameters(boolean preferFrameRateOverImageQuality) 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
Deprecated.- Parameters:
mode- The local video mirror mode: - VIDEO_MIRROR_MODE_AUTO (0): The SDK determines whether to enable the mirror mode. If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default. - VIDEO_MIRROR_MODE_ENABLED (1): Enable the mirroring mode of the local view. - VIDEO_MIRROR_MODE_DISABLED (2): Disable the mirroring mode of the local view.- Returns:
- - 0: Success. - < 0: Failure.
-
getRecommendedEncoderType
Deprecated.This method is deprecated.Gets the recommended encoder type.- Returns:
- The encoder type:
HARDWARE ENCODER(1): The hardware encoder.SOFTWARE ENCODER(2): The software encoder.
-
switchCamera
public abstract int switchCamera()- Returns:
- - 0: Success. - < 0: Failure.
-
switchCamera
- Parameters:
cameraId- The camera ID. You can get the camera ID through the Android native system API, see `Camera.open()` and `CameraManager.getCameraIdList()` for details.- Returns:
- - 0: Success. - < 0: Failure.
-
isCameraZoomSupported
public abstract boolean isCameraZoomSupported()- Returns:
- - `true`: The device supports camera zoom. - `false`: The device does not support camera zoom.
-
isCameraTorchSupported
public abstract boolean isCameraTorchSupported()- Returns:
- - `true`: The device supports camera flash. - `false`: The device does not support camera flash.
-
isCameraFocusSupported
public abstract boolean isCameraFocusSupported()- Returns:
- - `true`: The device supports the manual focus function. - `false`: The device does not support the manual focus function.
-
isCameraExposurePositionSupported
public abstract boolean isCameraExposurePositionSupported()- Returns:
- - `true`: The device supports manual exposure. - `false`: The device does not support manual exposure.
- Since:
- v2.3.2.
-
isCameraAutoFocusFaceModeSupported
public abstract boolean isCameraAutoFocusFaceModeSupported()- Returns:
- - `true`: The device supports the face auto-focus function. - `false`: The device does not support the face auto-focus function.
-
isCameraFaceDetectSupported
public abstract boolean isCameraFaceDetectSupported()- Returns:
- - `true`: The device camera supports face detection. - `false`: The device camera does not support face detection.
-
isCameraExposureSupported
public abstract boolean isCameraExposureSupported()- Returns:
- - `true`: Success. - `false`: Failure.
- Since:
- v4.2.2
-
setCameraZoomFactor
public abstract int setCameraZoomFactor(float factor) - Parameters:
factor- Camera zoom factor. You can get the maximum zoom factor supported by the device by calling the `getCameraMaxZoomFactor` method.- Returns:
- - The camera zoom `factor` value, if successful. - < 0: if the method if failed.
-
getCameraMaxZoomFactor
public abstract float getCameraMaxZoomFactor()- Returns:
- The maximum zoom ratio supported by the camera.
-
setCameraFocusPositionInPreview
public abstract int setCameraFocusPositionInPreview(float positionX, float positionY) - Parameters:
positionX- The horizontal coordinate of the touchpoint in the view.positionY- The vertical coordinate of the touchpoint in the view.- Returns:
- - 0: Success. - < 0: Failure.
-
setCameraExposurePosition
public abstract int setCameraExposurePosition(float positionXinView, float positionYinView) - Parameters:
positionXinView- The horizontal coordinate of the touchpoint in the view.positionYinView- The vertical coordinate of the touchpoint in the view.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v2.3.2.
-
enableFaceDetection
public abstract int enableFaceDetection(boolean enabled) - Parameters:
enabled- Whether to enable face detection for the local user: - `true`: Enable face detection. - `false`: (Default) Disable face detection.- Returns:
- - 0: Success. - < 0: Failure.
-
setCameraTorchOn
public abstract int setCameraTorchOn(boolean isOn) - Parameters:
isOn- Whether to turn on the camera flash: - `true`: Turn on the flash. - `false`: (Default) Turn off the flash.- Returns:
- - 0: Success. - < 0: Failure.
-
setCameraAutoFocusFaceModeEnabled
public abstract int setCameraAutoFocusFaceModeEnabled(boolean enabled) - Parameters:
enabled- Whether to enable face autofocus: - `true`: Enable the camera auto-face focus function. - `false`: Disable face auto-focus.- Returns:
- - 0: Success. - < 0: Failure.
-
setCameraExposureFactor
public abstract int setCameraExposureFactor(int factor) - Parameters:
factor- The camera exposure value. The default value is 0, which means using the default exposure of the camera. The larger the value, the greater the exposure. When the video image is overexposed, you can reduce the exposure value; when the video image is underexposed and the dark details are lost, you can increase the exposure value. If the exposure value you specified is beyond the range supported by the device, the SDK will automatically adjust it to the actual supported range of the device. The value range is [-20, 20].- Since:
- v4.2.2
-
getCallId
- Parameters:
callId- Output parameter, the current call ID.- Returns:
- The current call ID.
-
rate
- Parameters:
callId- The current call ID. You can get the call ID by calling `getCallId`.rating- The value is between 1 (the lowest score) and 5 (the highest score).description- (Optional) A description of the call. The string length should be less than 800 bytes.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid.
-
complain
- Parameters:
callId- The current call ID. You can get the call ID by calling `getCallId`.description- (Optional) A description of the call. The string length should be less than 800 bytes.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -7: The method is called before `RtcEngine` is initialized.
-
getSdkVersion
- Returns:
- The SDK version number. The format is a string.
-
getMediaEngineVersion
Deprecated.Returns the media engine version.- Returns:
- The string of the version number in char format.
-
setLogFile
- Parameters:
filePath- The complete path of the log files. These log files are encoded in UTF-8.- Returns:
- - 0: Success. - < 0: Failure.
-
setLogFilter
public abstract int setLogFilter(int filter) - Parameters:
filter- The output log level of the SDK. - LOG_FILTER_OFF (0): Do not output any log information. - LOG_FILTER_DEBUG (0x080f): Output all log information. Set your log filter as DEBUG if you want to get the most complete log file. - LOG_FILTER_INFO (0x0f): Output `LOG_FILTER_CRITICAL`, `LOG_FILTER_ERROR`, `LOG_FILTER_WARN`, and `LOG_FILTER_INFO` level log information. Agora recommends that you set the log level to this level. - LOG_FILTER_WARN (0x0e): Output `LOG_FILTER_CRITICAL`, `LOG_FILTER_ERROR` and `LOG_FILTER_WARN` level log information. - LOG_FILTER_ERROR (0x0c): Output `LOG_FILTER_CRITICAL` and `LOG_FILTER_ERROR` level log information. - LOG_FILTER_CRITICAL (0x08): Output `LOG_FILTER_CRITICAL` level log information.- Returns:
- - 0: Success. - < 0: Failure.
-
setLogLevel
public abstract int setLogLevel(int level) - Parameters:
level- The log level. See `LogLevel`.- Returns:
- - 0: Success. - < 0: Failure.
-
setLogFileSize
public abstract int setLogFileSize(long fileSizeInKBytes) - Parameters:
fileSizeInKBytes- The size (KB) of an `agorasdk.log` file. The value range is [128,20480]. The default value is 2,048 KB. If you set `fileSizeInKByte` smaller than 128 KB, the SDK automatically adjusts it to 128 KB; if you set `fileSizeInKByte` greater than 20,480 KB, the SDK automatically adjusts it to 20,480 KB.- Returns:
- - 0: Success. - < 0: Failure.
-
uploadLogFile
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
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
public abstract long getNativeHandle()- Returns:
- The native handle of the SDK.
-
addHandler
- Parameters:
handler- Callback events to be added. See `IRtcEngineEventHandler`.
-
removeHandler
- Parameters:
handler- The callback handler to be deleted. See `IRtcEngineEventHandler`.
-
enableHighPerfWifiMode
Deprecated.This method is deprecated.Enables the Wi-Fi mode.- 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
public abstract long getNativeMediaPlayer(int sourceId) Returns the native handler of the mediaplayer.
-
getErrorDescription
- Parameters:
error- The error code reported by the SDK.- Returns:
- The specific error description.
-
queryHDRCapability
Queries the HDR capability of the video module.- Returns:
- - 0: Unsupported. - 1: Supported. - < 0: Unknown.
- Since:
- v4.6.0
-
queryScreenCaptureCapability
public abstract int queryScreenCaptureCapability()- Returns:
- - The highest frame rate supported by the device, if the method is called successfully. - 0: The device supports the frame rate of up to 15 fps. - 1: The device supports the frame rate of up to 30 fps. - 2: The device supports the frame rate of up to 60 fps. - < 0: Failure.
- Since:
- v4.2.0
-
monitorHeadsetEvent
Deprecated.Monitors external headset device events.- Parameters:
monitor- Whether to enable monitoring external headset device events. True/False.
-
monitorBluetoothHeadsetEvent
Deprecated.Monitors Bluetooth headset device events.- Parameters:
monitor- Whether to enable monitoring Bluetooth headset device events. True/False.
-
setPreferHeadset
Deprecated.This method is deprecated.Sets the default audio route to the headset.- 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
- Parameters:
parameters- Pointer to the set parameters in a JSON string.- Returns:
- - 0: Success. - < 0: Failure.
-
getParameters
Queries internal states- Parameters:
parameters- JSON string- Returns:
- A JSON string
-
getParameter
Gets the Agora SDK’s parameters for customization purposes. This method is not disclosed yet. Contact support@agora.io for more information. -
registerMediaMetadataObserver
- Parameters:
observer- The metadata observer. See `IMetadataObserver`.type- The metadata type. The SDK currently only supports `VIDEO_METADATA`.- Returns:
- - 0: Success. - < 0: Failure.
-
unregisterMediaMetadataObserver
- Parameters:
observer- The metadata observer. See `IMetadataObserver`.type- The metadata type. The SDK currently only supports `VIDEO_METADATA`.- Returns:
- - 0: Success. - < 0: Failure.
-
startOrUpdateChannelMediaRelay
public abstract int startOrUpdateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) - Parameters:
channelMediaRelayConfiguration- The configuration of the media stream relay. See `ChannelMediaRelayConfiguration`.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -2: The parameter is invalid. - -8: Internal state error. Probably because the user is not a broadcaster.
- Since:
- v4.2.0
-
stopChannelMediaRelay
public abstract int stopChannelMediaRelay()- Returns:
- - 0: Success. - < 0: Failure. - -5: The method call was rejected. There is no ongoing channel media relay.
-
pauseAllChannelMediaRelay
public abstract int pauseAllChannelMediaRelay()- Returns:
- - 0: Success. - < 0: Failure. - -5: The method call was rejected. There is no ongoing channel media relay.
-
resumeAllChannelMediaRelay
public abstract int resumeAllChannelMediaRelay()- Returns:
- - 0: Success. - < 0: Failure. - -5: The method call was rejected. There is no paused channel media relay.
-
updateChannelMediaOptions
- Parameters:
options- The channel media options. See `ChannelMediaOptions`.- Returns:
- - 0: Success. - < 0: Failure. - -2: The value of a member in `ChannelMediaOptions` is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method. - -8: The internal state of the `RtcEngine` object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the `onConnectionStateChanged` callback to see whether the user is in the channel. If you receive the `CONNECTION_STATE_DISCONNECTED` (1) or `CONNECTION_STATE_FAILED` (5) state, the user is not in the channel. You need to call `joinChannel(String token, String channelId, int uid, ChannelMediaOptions options)` to join a channel before calling this method.
-
muteRecordingSignal
public abstract int muteRecordingSignal(boolean muted) - Parameters:
muted- - `true`: Mute the recording signal. - `false`: (Default) Do not mute the recording signal.- Returns:
- - 0: Success. - < 0: Failure.
-
setPlaybackAudioFrameBeforeMixingParameters
public abstract int setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) - Parameters:
sampleRate- The sample rate returned in the callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz.channel- The number of audio channels. You can set the value as 1 or 2. - 1: Mono. - 2: Stereo.- Returns:
- - 0: Success. - < 0: Failure.
-
setPlaybackAudioFrameBeforeMixingParameters
public abstract int setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel, int samplesPerCall) - Parameters:
sampleRate- Set the sample rate returned in the `onPlaybackAudioFrameBeforeMixing` callback. It can be set as the following values: - 8000. - 16000 - 32000. - 44100 - 48000 (Hz).channel- Set the number of channels for the audio data returned in the `onPlaybackAudioFrameBeforeMixing` callback. It can be set to: - 1: Mono. - 2: Stereo.samplesPerCall- Set the sample rate of the audio data returned in the `onMixedAudioFrame` callback. In the RTMP streaming scenario, it is recommended to set it to 1024.- Returns:
- - 0: Success. - < 0: Failure.
-
enableAudioSpectrumMonitor
public abstract int enableAudioSpectrumMonitor(int intervalInMS) - Parameters:
intervalInMS- The interval (in milliseconds) at which the SDK triggers the `onLocalAudioSpectrum` and `onRemoteAudioSpectrum` callbacks. The default value is 100. Do not set this parameter to a value less than 10, otherwise calling this method would fail.- Returns:
- - 0: Success. - < 0: Failure. - -2: Invalid parameters.
-
disableAudioSpectrumMonitor
public abstract int disableAudioSpectrumMonitor()- Returns:
- - 0: Success. - < 0: Failure.
-
registerAudioSpectrumObserver
- Parameters:
observer- The audio spectrum observer. See `IAudioSpectrumObserver`.- Returns:
- - 0: Success. - < 0: Failure.
-
unRegisterAudioSpectrumObserver
- Parameters:
observer- The audio spectrum observer. See `IAudioSpectrumObserver`.- Returns:
- - 0: Success. - < 0: Failure.
-
getEffectsVolume
public abstract double getEffectsVolume()- Returns:
- - Volume of the audio effects, if this method call succeeds. - < 0: Failure.
-
setEffectsVolume
public abstract int setEffectsVolume(double volume) - Parameters:
volume- The playback volume. The value range is [0, 100]. The default value is 100, which represents the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
preloadEffect
- Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.filePath- File path: - Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with `/assets/`. 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: Success. - < 0: Failure.
-
preloadEffect
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 {@link RtcEngine#playEffect() playEffect} to play the preloaded audio effect or call {@link RtcEngine#playAllEffects() playAllEffects} to play all the preloaded audio effects.- Parameters:
soundId- The ID of the audio effect.filePath- The absolute path of the local audio effect file or the URLstartPos- 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
public abstract int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.Attention: If you have preloaded an audio effect into memory by calling `preloadEffect`, ensure that the value of this parameter is the same as that of `soundId` in `preloadEffect`.filePath- The file path. The SDK supports URI addresses starting with `content://`, paths starting with `/assets/`, URLs and absolute paths of local files. The absolute path needs to be accurate to the file name and extension. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. See `Supported Audio Formats`. Attention: If you have preloaded an audio effect into memory by calling `preloadEffect`, ensure that the value of this parameter is the same as that of `filePath` in `preloadEffect`.loopCount- The number of times the audio effect loops. - ≥ 0: The number of playback times. For example, 1 means looping one time, which means playing the audio effect two times in total. - -1: Play the audio file in an infinite loop.pitch- The pitch of the audio effect. The value range is 0.5 to 2.0. The default value is 1.0, which means the 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 is heard on the left of the user. - 0.0: The audio effect is heard in front of the user. - 1.0: The audio effect is heard on the right of the user.gain- The volume of the audio effect. The value range is 0.0 to 100.0. The default value is 100.0, which means the original volume. The smaller the value, the lower the volume.publish- Whether to publish the audio effect to the remote users. - `true`: Publish the audio effect to the remote users. Both the local user and remote users can hear the audio effect. - `false`: Do not publish the audio effect to the remote users. Only the local user can hear the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
playEffect
public abstract int playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.Attention: If you have preloaded an audio effect into memory by calling `preloadEffect`, ensure that the value of this parameter is the same as that of `soundId` in `preloadEffect`.filePath- The file path. The SDK supports URI addresses starting with `content://`, paths starting with `/assets/`, URLs and absolute paths of local files. The absolute path needs to be accurate to the file name and extension. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. See `Supported Audio Formats`. Attention: If you have preloaded an audio effect into memory by calling `preloadEffect`, ensure that the value of this parameter is the same as that of `filePath` in `preloadEffect`.loopCount- The number of times the audio effect loops. - ≥ 0: The number of playback times. For example, 1 means looping one time, which means playing the audio effect two times in total. - -1: Play the audio file in an infinite loop.pitch- The pitch of the audio effect. The value range is 0.5 to 2.0. The default value is 1.0, which means the 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 is heard on the left of the user. - 0.0: The audio effect is heard in front of the user. - 1.0: The audio effect is heard on the right of the user.gain- The volume of the audio effect. The value range is 0.0 to 100.0. The default value is 100.0, which means the original volume. The smaller the value, the lower the volume.publish- Whether to publish the audio effect to the remote users: - `true`: Publish the audio effect to the remote users. Both the local user and remote users can hear the audio effect. - `false`: Do not publish the audio effect to the remote users. Only the local user can hear the audio effect.startPos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
playAllEffects
public abstract int playAllEffects(int loopCount, double pitch, double pan, double gain, boolean publish) - Parameters:
loopCount- The number of times the audio effect loops: - `-1`: Play the audio effect in an indefinite loop until you call `stopEffect` or `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 range is [0, 100]. The default value is 100 (original volume). The lower the value, the lower the volume of the audio effect.publish- Whether to publish the specified audio effect to the remote users: - `true`: Publish the audio effect to the remote users. Both the local user and remote users can hear the audio effect. - `false`: (Default) Do not publish the audio effect to the remote users. Only the local user can hear the audio effect.- Returns:
- - 0: Success. - < 0: Failure.
-
getVolumeOfEffect
public abstract int getVolumeOfEffect(int soundId) - Parameters:
soundId- The ID of the audio effect file.- Returns:
- - ≥ 0: Returns the volume of the specified audio effect, if the method call is successful. The value ranges between 0 and 100. 100 represents the original volume. - < 0: Failure.
-
setVolumeOfEffect
public abstract int setVolumeOfEffect(int soundId, double volume) - Parameters:
soundId- The ID of the audio effect. The unique ID of each audio effect file.volume- The playback volume. The value range is [0, 100]. The default value is 100, which represents the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
pauseEffect
public abstract int pauseEffect(int soundId) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.- Returns:
- - 0: Success. - < 0: Failure.
-
pauseAllEffects
public abstract int pauseAllEffects()- Returns:
- - 0: Success. - < 0: Failure.
-
resumeEffect
public abstract int resumeEffect(int soundId) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.- Returns:
- - 0: Success. - < 0: Failure.
-
resumeAllEffects
public abstract int resumeAllEffects()- Returns:
- - 0: Success. - < 0: Failure.
-
stopEffect
public abstract int stopEffect(int soundId) - Parameters:
soundId- The ID of the audio effect. Each audio effect has a unique ID.- Returns:
- - 0: Success. - < 0: Failure.
-
stopAllEffects
public abstract int stopAllEffects()- Returns:
- - 0: Success. - < 0: Failure.
-
unloadEffect
public abstract int unloadEffect(int soundId) - Parameters:
soundId- The ID of the audio effect. Each audio effect has a unique ID.- Returns:
- - 0: Success. - < 0: Failure.
-
unloadAllEffects
public abstract int unloadAllEffects()Releases all preloaded audio effects from the memory.- Returns:
- - 0: Success. - < 0: Failure.
-
getEffectDuration
- Parameters:
filePath- File path: - Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with `/assets/`. 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:
- - The total duration (ms) of the specified audio effect file, if the method call succeeds. - < 0: Failure.
-
setEffectPosition
public abstract int setEffectPosition(int soundId, int pos) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.pos- The playback position (ms) of the audio effect file.- Returns:
- - 0: Success. - < 0: Failure.
-
getEffectCurrentPosition
public abstract int getEffectCurrentPosition(int soundId) - Parameters:
soundId- The audio effect ID. The ID of each audio effect file is unique.- Returns:
- - The playback position (ms) of the specified audio effect file, if the method call succeeds. - < 0: Failure.
-
registerVideoEncodedFrameObserver
- Parameters:
receiver- The video frame observer object. See `IVideoEncodedFrameObserver`.- Returns:
- - 0: Success. - < 0: Failure.
-
registerFaceInfoObserver
- Parameters:
receiver- Facial information observer, see `IFaceInfoObserver`. If you need to unregister a facial information observer, pass in NULL.- Returns:
- - 0: Success. - < 0: Failure.
-
takeSnapshot
- 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: - Android: `/storage/emulated/0/Android/data//files/example.jpg` Attention: Ensure that the path you specify exists and is writable. - Returns:
- - 0: Success. - < 0: Failure.
-
takeSnapshot
- 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 of the snaptshot. See `SnapshotConfig`.- Returns:
- - 0: Success. - < 0: Failure.
-
enableContentInspect
- Parameters:
enabled- Whether to enalbe video screenshot and upload: - `true`: Enables video screenshot and upload. - `false`: Disables video screenshot and upload.config- Screenshot and upload configuration. See `ContentInspectConfig`.- Returns:
- - 0: Success. - < 0: Failure.
-
loadExtensionProvider
-
registerExtension
public abstract int registerExtension(String provider, String extension, Constants.MediaSourceType sourceType) - Parameters:
provider- The name of the extension provider.extension- The name of the extension.sourceType- Source type of the extension. See `MediaSourceType`.- Returns:
- - 0: Success. - < 0: Failure. - -3: The extension library is not loaded. Agora recommends that you check the storage location or the name of the dynamic library.
-
enableExtension
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
public abstract int enableExtension(String provider, String extension, boolean enable, Constants.MediaSourceType sourceType) - Parameters:
provider- The name of the extension provider.extension- The name of the extension.enable- Whether to enable the extension: - `true`: Enable the extension. - `false`: Disable the extension.sourceType- Source type of the extension. See `MediaSourceType`.- Returns:
- - 0: Success. - < 0: Failure. - -3: The extension library is not loaded. Agora recommends that you check the storage location or the name of the dynamic library.
-
setExtensionProperty
public abstract int setExtensionProperty(String provider, String extension, String key, String value) - Parameters:
provider- The name of the extension provider.extension- The name of the extension.key- The key of the extension.value- The value of the extension key.- Returns:
- - 0: Success. - < 0: Failure.
-
setExtensionProperty
public abstract int setExtensionProperty(String provider, String extension, String key, String value, Constants.MediaSourceType sourceType) 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. SeeConstants#MediaSourceType.- Returns:
- true, if get property success, otherwise false
-
getExtensionProperty
- Parameters:
provider- The name of the extension provider.extension- The name of the extension.key- The key of the extension.- Returns:
- - The extension information, if the method call succeeds. - An empty string, if the method call fails.
-
getExtensionProperty
public abstract String getExtensionProperty(String provider, String extension, String key, Constants.MediaSourceType sourceType) - Parameters:
provider- The name of the extension provider.extension- The name of the extension.key- The key of the extension.sourceType- Source type of the extension. See `MediaSourceType`.- Returns:
- - The extension information, if the method call succeeds. - An empty string, if the method call fails.
-
setExtensionProviderProperty
- Parameters:
provider- The name of the extension provider.key- The key of the extension.value- The value of the extension key.- Returns:
- - 0: Success. - < 0: Failure.
-
enableExtension
public abstract int enableExtension(String provider, String extension, ExtensionInfo extensionInfo, boolean enable) 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. SeeExtensionInfo.enable- Whether to enable the extension: - true: (Default) Enable the extension. - false: Disable the extension.- Returns:
- - 0: Success. - < 0: Failure.
-
setExtensionProperty
public abstract int setExtensionProperty(String provider, String extension, ExtensionInfo extensionInfo, String key, String value) 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. SeeExtensionInfo.key- The key of the extension.value- The JSON formatted value of the extension key.- Returns:
- - 0: Success. - < 0: Failure.
-
getExtensionProperty
public abstract String getExtensionProperty(String provider, String extension, ExtensionInfo extensionInfo, String key) 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. SeeExtensionInfo.key- The key of the extension.- Returns:
- JSON formatted string of property's value; return null if failed
-
startScreenCapture
- Parameters:
screenCaptureParameters- The screen sharing encoding parameters. See `ScreenCaptureParameters`.- Returns:
- - 0: Success. - < 0: Failure. - -2 (Android platform): The system version is too low. Ensure that the Android API level is not lower than 21. - -3 (Android platform): Unable to capture system audio. Ensure that the Android API level is not lower than 29.
- Since:
- v3.7.0
-
setExternalMediaProjection
public abstract int setExternalMediaProjection(MediaProjection mediaProjection) - Parameters:
mediaProjection- An `MediaProjection` object used to capture screen video streams.- Returns:
- - 0: Success. - < 0: Failure.
-
setScreenCaptureScenario
- Parameters:
screenScenario- The screen sharing scenario. See `ScreenScenarioType`.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.2.0
-
stopScreenCapture
public abstract int stopScreenCapture()- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v3.7.0
-
setVideoScenario
- Parameters:
scenarioType- The type of video application scenario. See `VideoScenario`.`APPLICATION_SCENARIO_MEETING` (1) is suitable for meeting scenarios. The SDK automatically enables the following strategies: - In meeting scenarios where low-quality video streams are required to have a high bitrate, the SDK automatically enables multiple technologies used to deal with network congestions, to enhance the performance of the low-quality streams and to ensure the smooth reception by subscribers. - The SDK monitors the number of subscribers to the high-quality video stream in real time and dynamically adjusts its configuration based on the number of subscribers. - If nobody subscribers to the high-quality stream, the SDK automatically reduces its bitrate and frame rate to save upstream bandwidth. - If someone subscribes to the high-quality stream, the SDK resets the high-quality stream to the `VideoEncoderConfiguration` configuration used in the most recent calling of `setVideoEncoderConfiguration`. If no configuration has been set by the user previously, the following values are used: - Resolution: 960 × 540 - Frame rate: 15 fps - Bitrate: 1000 Kbps - The SDK monitors the number of subscribers to the low-quality video stream in real time and dynamically enables or disables it based on the number of subscribers.Note: If the user has called `setDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig)` to set that never send low-quality video stream ( `DISABLE_SIMULCAST_STREAM` ), the dynamic adjustment of the low-quality stream in meeting scenarios will not take effect. - If nobody subscribes to the low-quality stream, the SDK automatically disables it to save upstream bandwidth. - If someone subscribes to the low-quality stream, the SDK enables the low-quality stream and resets it to the `SimulcastStreamConfig` configuration used in the most recent calling of `setDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig)`. If no configuration has been set by the user previously, the following values are used: - Resolution: 480 × 272 - Frame rate: 15 fps - Bitrate: 500 Kbps `APPLICATION_SCENARIO_1V1` (2) This is applicable to the `one to one live` scenario. To meet the requirements for low latency and high-quality video in this scenario, the SDK optimizes its strategies, improving performance in terms of video quality, first frame rendering, latency on mid-to-low-end devices, and smoothness under weak network conditions.Attention: This enumeration value is only applicable to the broadcaster vs. broadcaster scenario. `APPLICATION_SCENARIO_LIVESHOW` (3) This is applicable to the `show room` scenario. In this scenario, fast video rendering and high image quality are crucial. The SDK implements several performance optimizations, including automatically enabling accelerated audio and video frame rendering to minimize first-frame latency (no need to call `enableInstantMediaRendering` ), and B-frame encoding to achieve better image quality and bandwidth efficiency. The SDK also provides enhanced video quality and smooth playback, even in poor network conditions or on lower-end devices.- Returns:
- - 0: Success. - < 0: Failure. - -1: A general error occurs (no specified reason). - -4: Video application scenarios are not supported. Possible reasons include that you use the Voice SDK instead of the Video SDK. - -7: The `RtcEngine` object has not been initialized. You need to initialize the `RtcEngine` object before calling this method.
-
setVideoQoEPreference
Sets the video qoe preference.- Parameters:
qoePreference- he qoe preference type.- Returns:
- - 0: Success. - < 0: Failure.
- 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.
-
updateScreenCaptureParameters
- Parameters:
screenCaptureParameters- The screen sharing encoding parameters. See `ScreenCaptureParameters`.Attention: The video properties of the screen sharing stream only need to be set through this parameter, and are unrelated to `setVideoEncoderConfiguration`.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. - -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling `stopScreenCapture` to stop the current sharing and start sharing the screen again.
- Since:
- v3.7.0
-
registerVideoFrameObserver
- Parameters:
observer- The observer instance. See `IVideoFrameObserver`. To release the instance, set the value as NULL.- Returns:
- - 0: Success. - < 0: Failure.
-
createMediaPlayer
- Returns:
- - An `IMediaPlayer` object, if the method call succeeds. - An empty pointer, if the method call fails.
-
createMediaRecorder
- Parameters:
info- Information about the audio and video stream to be recorded. See `RecorderStreamInfo`.- Returns:
- - If the method call succeeds: Returns an `AgoraMediaRecorder` instance. - If the method call fails: Returns a null pointer.
-
destroyMediaRecorder
- Parameters:
mediaRecorder- The `AgoraMediaRecorder` object to be destroyed.
-
getMediaPlayerCacheManager
- Returns:
- The `IMediaPlayerCacheManager` instance.
-
getH265Transcoder
get an H265Transcoder instance, which is used to- Returns:
IH265Transcoder
-
enableExternalAudioSourceLocalPlayback
public abstract int enableExternalAudioSourceLocalPlayback(boolean enabled) Enable or disable the external audio source local playback. * @param 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
public abstract int adjustCustomAudioPublishVolume(int trackId, int volume) - Parameters:
trackId- The audio track ID. Set this parameter to the custom audio track ID returned in `createCustomAudioTrack`.volume- The volume of the audio source. The value can range from 0 to 100. 0 means mute; 100 means the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
adjustCustomAudioPlayoutVolume
public abstract int adjustCustomAudioPlayoutVolume(int trackId, int volume) - Parameters:
trackId- The audio track ID. Set this parameter to the custom audio track ID returned in `createCustomAudioTrack`.volume- The volume of the audio source. The value can range from 0 to 100. 0 means mute; 100 means the original volume.- Returns:
- - 0: Success. - < 0: Failure.
-
startRhythmPlayer
- Parameters:
sound1- The absolute path or URL address (including the filename extensions) of the file for the downbeat. For example, `content://com.android.providers.media.documents/document/audio%203A14441`. For the audio file formats supported by this method, see `What formats of audio files does the Agora RTC SDK support`.sound2- The absolute path or URL address (including the filename extensions) of the file for the upbeats. For example, `content://com.android.providers.media.documents/document/audio%203A14441`. For the audio file formats supported by this method, see `What formats of audio files does the Agora RTC SDK support`.config- The metronome configuration. See `AgoraRhythmPlayerConfig`.- Returns:
- - 0: Success. - < 0: Failure. - -22: Cannot find audio effect files. Please set the correct paths for `sound1` and `sound2`.
-
stopRhythmPlayer
public abstract int stopRhythmPlayer()- Returns:
- - 0: Success. - < 0: Failure.
-
configRhythmPlayer
- Parameters:
config- The metronome configuration. See `AgoraRhythmPlayerConfig`.- Returns:
- - 0: Success. - < 0: Failure.
-
setDirectCdnStreamingAudioConfiguration
Deprecated.v4.6.0.- Parameters:
profile- The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. - `DEFAULT`(0): The default value. - For the interactive streaming profile: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - For the communication profile: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `SPEECH_STANDARD`(1): A sampling rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. - `MUSIC_STANDARD`(2): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. - `MUSIC_STANDARD_STEREO`(3): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 Kbps. - `MUSIC_HIGH_QUALITY`(4): A sampling rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. - `MUSIC_HIGH_QUALITY_STEREO`(5): A sampling rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps.- Returns:
- - 0: Success. - < 0: Failure.
-
setDirectCdnStreamingVideoConfiguration
@Deprecated public abstract int setDirectCdnStreamingVideoConfiguration(VideoEncoderConfiguration config) Deprecated.v4.6.0.- Parameters:
config- Video profile. See `VideoEncoderConfiguration`.Note: During CDN live streaming, Agora only supports setting `ORIENTATION_MODE` as `ORIENTATION_MODE_FIXED_LANDSCAPE` or `ORIENTATION_MODE_FIXED_PORTRAIT`.- Returns:
- - 0: Success. - < 0: Failure.
-
getCurrentMonotonicTimeInMs
public abstract long getCurrentMonotonicTimeInMs()- Returns:
- - ≥ 0: The method call is successful, and returns the current Monotonic Time of the SDK (in milliseconds). - < 0: Failure.
-
startDirectCdnStreaming
@Deprecated public abstract int startDirectCdnStreaming(IDirectCdnStreamingEventHandler eventHandler, String publishUrl, DirectCdnStreamingMediaOptions options) Deprecated.v4.6.0.- Parameters:
eventHandler- See `onDirectCdnStreamingStateChanged` and `onDirectCdnStreamingStats`.publishUrl- The CDN live streaming URL.options- The media setting options for the host. See `DirectCdnStreamingMediaOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
stopDirectCdnStreaming
Deprecated.v4.6.0.- Returns:
- - 0: Success. - < 0: Failure.
-
updateDirectCdnStreamingMediaOptions
@Deprecated public abstract int updateDirectCdnStreamingMediaOptions(DirectCdnStreamingMediaOptions options) Deprecated.v4.6.0.Change the media source during the pushing- Parameters:
options- The direct cdn streaming media options: DirectCdnStreamingMediaOptions.- Returns:
- - 0: Success. - < 0: Failure.
-
createCustomVideoTrack
public abstract int createCustomVideoTrack()- Returns:
- - If the method call is successful, the video track ID is returned as the unique identifier of the video track. - If the method call fails, 0xffffffff is returned.
-
createCustomEncodedVideoTrack
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
public abstract int destroyCustomVideoTrack(int video_track_id) - Parameters:
video_track_id- The video track ID returned by calling the `createCustomVideoTrack` method.- Returns:
- - 0: Success. - < 0: Failure.
-
destroyCustomEncodedVideoTrack
public abstract int destroyCustomEncodedVideoTrack(int video_track_id) 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
public abstract int setCloudProxy(int proxyType) - Parameters:
proxyType- The type of the cloud proxy. - TRANSPORT_TYPE_NONE_PROXY (0): The automatic mode. The SDK has this mode enabled by default. In this mode, the SDK attempts a direct connection to SD-RTN™ and automatically switches to TCP/TLS 443 if the attempt fails. - TRANSPORT_TYPE_UDP_PROXY (1): The cloud proxy for the UDP protocol, that is, the Force UDP cloud proxy mode. In this mode, the SDK always transmits data over UDP. - TRANSPORT_TYPE_TCP_PROXY (2): The cloud proxy for the TCP (encryption) protocol, that is, the Force TCP cloud proxy mode. In this mode, the SDK always transmits data over TCP/TLS 443. This parameter is mandatory. The SDK reports an error if you do not pass in a value.- Returns:
- - 0: Success. - < 0: Failure. - -2: The parameter is invalid. - -7: The SDK is not initialized.
-
setLocalAccessPoint
- Parameters:
config- Local Access Point configuration. See `LocalAccessPointConfiguration` for details.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting suggestions.
-
enableCustomAudioLocalPlayback
public abstract int enableCustomAudioLocalPlayback(int trackId, boolean enabled) - Parameters:
trackId- The audio track ID. Set this parameter to the custom audio track ID returned in `createCustomAudioTrack`.enabled- Whether to play the external audio source: - `true`: Play the external audio source. - `false`: (Default) Do not play the external source.- Returns:
- - 0: Success. - < 0: Failure.
-
setAdvancedAudioOptions
- Parameters:
options- The advanced options for audio. See `AdvancedAudioOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
setAVSyncSource
- Parameters:
channelId- The name of the channel where the audio publishing device is located.uid- The user ID of the audio publishing device.- Returns:
- - 0: The method call succeeds. - < 0: The method call fails. See `Error Codes` for details and troubleshooting advice.
-
enableVideoImageSource
- Parameters:
enabled- Whether to replace the current video feeds with custom images: - `true`: Replace the current video feeds with custom images. - `false`: (Default) Do not replace the current video feeds with custom images.options- Image configurations. See `ImageTrackOptions`.- Returns:
- - 0: Success. - < 0: Failure.
-
getNetworkType
public abstract int getNetworkType()- Returns:
- - ≥ 0: The method call is successful, and the local network connection type is returned. - 0: The SDK disconnects from the network. - 1: The network type is LAN. - 2: The network type is Wi-Fi (including hotspots). - 3: The network type is mobile 2G. - 4: The network type is mobile 3G. - 5: The network type is mobile 4G. - 6: The network type is mobile 5G. - < 0: The method call failed with an error code. - -1: The network type is unknown.
-
getNtpWallTimeInMs
public abstract long getNtpWallTimeInMs()- Returns:
- The Unix timestamp (ms) of the current NTP time.
-
startMediaRenderingTracing
public abstract int startMediaRenderingTracing()- Returns:
- - 0: Success. - < 0: Failure. - -7: The method is called before `RtcEngine` is initialized.
- Since:
- v4.1.1
-
enableInstantMediaRendering
public abstract int enableInstantMediaRendering()- Returns:
- - 0: Success. - < 0: Failure. - -7: The method is called before `RtcEngine` is initialized.
- Since:
- v4.1.1
-
setupAudioAttributes
public abstract int setupAudioAttributes(AudioAttributes attr) 配置AudioAttribute- Parameters:
AudioAttributes-- Returns:
- - 0: 方法调用成功 - < 0: 方法调用失败
-
isFeatureAvailableOnDevice
public abstract boolean isFeatureAvailableOnDevice(int type) - Parameters:
type- The type of the advanced feature. - FEATURE_VIDEO_VIRTUAL_BACKGROUND (1): Virutual background. - FEATURE_VIDEO_BEAUTY_EFFECT (2): Image enhancement.- Returns:
- - `true`: The current device supports the specified feature. - `false`: The current device does not support the specified feature.
- Since:
- v4.3.0
-
sendAudioMetadata
public abstract int sendAudioMetadata(byte[] metadata) - Parameters:
metadata- Audio Metadata.- Returns:
- - 0: Success. - < 0: Failure.
- Since:
- v4.3.1
-