public abstract class RtcEngine
extends java.lang.Object
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 and Description |
---|
RtcEngine() |
Modifier and Type | Method and Description |
---|---|
void |
addHandler(IRtcEngineEventHandler handler)
Adds the IRtcEngineEventHandler.
|
abstract int |
addVideoWatermark(AgoraImage watermark)
Deprecated.
From v2.9.1. We recommend using the
addVideoWatermark 2 method instead.
This method adds a PNG watermark image to the local video stream for the sampling device,
channel audience, or CDN live audience to see and capture. To add the PNG file to a CDN live
publishing stream, see the setLiveTranscoding method. |
abstract int |
addVideoWatermark(java.lang.String watermarkUrl,
WatermarkOptions options)
Adds a watermark image to the local video.
|
abstract int |
adjustAudioMixingPlayoutVolume(int volume)
Adjusts the audio mixing volume for local playback.
|
abstract int |
adjustAudioMixingPublishVolume(int volume)
Adjusts the audio mixing volume for publishing (for remote users).
|
abstract int |
adjustAudioMixingVolume(int volume)
Adjusts the volume of audio mixing.
|
abstract int |
adjustCustomAudioPlayoutVolume(int sourceId,
int volume)
Adjust the custom audio playout volume by source id.
|
abstract int |
adjustCustomAudioPublishVolume(int sourceId,
int volume)
Adjust the custom audio publish volume by source id.
|
abstract int |
adjustPlaybackSignalVolume(int volume)
Adjusts the playback volume.
|
abstract int |
adjustRecordingSignalVolume(int volume)
Adjusts the recording volume.
|
abstract int |
adjustUserPlaybackSignalVolume(int uid,
int volume)
Adjust the playback volume of the user specified by uid.
|
abstract int |
clearVideoWatermarks()
Removes the watermark image from the video stream added by
addVideoWatermark . |
abstract int |
complain(java.lang.String callId,
java.lang.String description)
Allows a user to complain about the call quality.
|
abstract int |
configRhythmPlayer(AgoraRhythmPlayerConfig config)
Configures the rhythm player.
|
static RtcEngine |
create(Context context,
java.lang.String appId,
IRtcEngineEventHandler handler)
Creates an
RtcEngine instance. |
static RtcEngine |
create(RtcEngineConfig config)
Creates an RtcEngine instance.
|
abstract int |
createCustomEncodedVideoTrack(EncodedVideoTrackOptions encodedOpt)
Get an custom encoded video track id created by internal,which could used to publish or preview
|
abstract int |
createCustomVideoTrack()
Get an custom video track id created by internal,which could used to publish or preview
|
abstract int |
createDataStream(boolean reliable,
boolean ordered)
Creates a data stream.
|
abstract int |
createDataStream(DataStreamConfig config)
Creates a data stream.
|
abstract IMediaPlayer |
createMediaPlayer()
Create a media player
You can use this function to create a ffmpeg or simple media player
|
static SurfaceView |
CreateRendererView(Context context)
Deprecated.
This method is deprecated. You can use SurfaceView or TextureView created by
Android system.
It returns the |
static TextureView |
CreateTextureView(Context context)
Deprecated.
This method is deprecated. You can use SurfaceView or TextureView created by
Android system.
It returns the |
static void |
destroy()
Releases all the resources used by the Agora SDK.
|
abstract int |
destroyCustomEncodedVideoTrack(int video_track_id)
destroy a created custom encoded video track id
|
abstract int |
destroyCustomVideoTrack(int video_track_id)
destroy a created custom video track id
|
abstract int |
disableAudio()
Disables the audio.
|
abstract int |
disableAudioSpectrumMonitor()
Disalbe the audio spectrum monitor.
|
abstract int |
disableVideo()
Disables the video.
|
abstract int |
enableAudio()
Enables the audio.
|
abstract int |
enableAudioQualityIndication(boolean enabled)
Deprecated.
From v2.4.1.
The |
abstract int |
enableAudioSpectrumMonitor(int intervalInMS)
Enable the audio spectrum monitor.
|
abstract int |
enableAudioVolumeIndication(int interval,
int smooth,
boolean reportVad)
Enables the `onAudioVolumeIndication` callback to report on which users are speaking
and the speakers' volume.
|
abstract int |
enableContentInspect(boolean enabled,
ContentInspectConfig config) |
abstract int |
enableCustomAudioLocalPlayback(int sourceId,
boolean enabled)
Sets the external audio source.
|
abstract int |
enableDualStreamMode(boolean enabled)
Enables or disables the dual video stream mode.
|
abstract int |
enableDualStreamMode(boolean enabled,
SimulcastStreamConfig streamConfig)
Enables or disables the dual video stream mode.
|
abstract int |
enableEchoCancellationExternal(boolean enabled,
int audioSourceDelay) |
abstract int |
enableEncryption(boolean enabled,
io.agora.rtc2.internal.EncryptionConfig config)
Enables/Disables the built-in encryption.
|
abstract int |
enableExtension(java.lang.String provider,
java.lang.String extension,
boolean enable) |
abstract int |
enableExtension(java.lang.String provider,
java.lang.String extension,
boolean enable,
Constants.MediaSourceType sourceType) |
abstract int |
enableExtension(java.lang.String provider,
java.lang.String extension,
ExtensionInfo extensionInfo,
boolean enable)
Enable/Disable extension.
|
abstract int |
enableExternalAudioSourceLocalPlayback(boolean enabled)
Enable or disable the external audio source local playback.
|
abstract int |
enableFaceDetection(boolean enabled)
Enables the camera face detect.
|
abstract boolean |
enableHighPerfWifiMode(boolean enable)
Deprecated.
This method is deprecated.
|
abstract int |
enableInEarMonitoring(boolean enabled)
Enables in-ear monitoring.
|
abstract int |
enableInEarMonitoring(boolean enabled,
int includeAudioFilters)
Enables in-ear monitoring.
|
abstract int |
enableLocalAudio(boolean enabled)
Enables or disables the local audio capture.
|
abstract int |
enableLocalVideo(boolean enabled)
Disables or re-enables the local video capture.
|
abstract int |
enableRemoteSuperResolution(int uid,
boolean enable)
Enables/Disables the super resolution feature for a remote user's video.
|
abstract int |
enableSoundPositionIndication(boolean enabled)
Enables/Disables stereo panning for remote users.
|
abstract int |
enableSpatialAudio(boolean enabled) |
abstract int |
enableVideo()
Enables the video.
|
abstract int |
enableVideoImageSource(boolean enabled,
ImageTrackOptions options)
Enable or disable video image source to replace the current video source published or resume it
|
abstract int |
enableVirtualBackground(boolean enabled,
VirtualBackgroundSource backgroundSource,
SegmentationProperty segproperty)
Enables/Disables portrait segmentation and repalce the background(not portrait area) with
specified source.
|
abstract int |
enableWebSdkInteroperability(boolean enabled)
Enables interoperability with the Agora Web SDK (Live Broadcast only).
|
abstract int |
enableWirelessAccelerate(boolean enabled)
Turn WIFI acceleration on or off.
|
abstract DeviceInfo |
getAudioDeviceInfo()
Gets the the Audio device Info
|
abstract IAudioEffectManager |
getAudioEffectManager()
Gets the IAudioEffectManager object associated with the current RTC engine.
|
abstract int |
getAudioMixingCurrentPosition()
Gets the playback position (ms) of the music file.
|
abstract int |
getAudioMixingDuration()
Gets the duration (ms) of the music file.
|
abstract int |
getAudioMixingPlayoutVolume()
Retrieves the audio mixing volume for local playback.
|
abstract int |
getAudioMixingPublishVolume()
Retrieves the audio mixing volume for publishing.
|
abstract java.lang.String |
getAudioOptionParams() |
abstract java.lang.String |
getAudioSessionParams() |
abstract int |
getAudioTrackCount()
Get the audio track count of mixing music file.
|
abstract java.lang.String |
getCallId()
Gets the current call ID.
|
abstract float |
getCameraMaxZoomFactor()
Gets the maximum zoom ratio supported by the camera.
|
abstract int |
getConnectionState()
Gets the connection state of the SDK.
|
abstract long |
getCurrentMonotonicTimeInMs() |
abstract int |
getEffectCurrentPosition(int soundId)
Gets the playback position of the audio effect file.
|
abstract int |
getEffectDuration(java.lang.String filePath)
Gets the duration of the audio effect file.
|
abstract double |
getEffectsVolume()
Gets the volume of the audio effects.
|
static java.lang.String |
getErrorDescription(int error)
Gets the warning or error description.
|
abstract java.lang.String |
getExtensionProperty(java.lang.String provider,
java.lang.String extension,
ExtensionInfo extensionInfo,
java.lang.String key)
Get extension specific property.
|
abstract java.lang.String |
getExtensionProperty(java.lang.String provider,
java.lang.String extension,
java.lang.String key)
Get local video filter property
|
abstract java.lang.String |
getExtensionProperty(java.lang.String provider,
java.lang.String extension,
java.lang.String key,
Constants.MediaSourceType sourceType) |
static java.lang.String |
getMediaEngineVersion()
Deprecated.
|
abstract IMediaPlayerCacheManager |
getMediaPlayerCacheManager()
get an MediaPlayerCacheManager instance, which is used to set and manage the player cache,
implemented in the form of a singleton, independent of the player.
|
abstract long |
getNativeHandle()
Returns the native handler of the SDK Engine.
|
abstract long |
getNativeMediaPlayer(int sourceId)
Returns the native handler of the mediaplayer.
|
abstract int |
getNetworkType()
Get network type
|
abstract long |
getNtpTimeInMs()
Return current NTP(Network Time Protocol) time in milliseconds.
|
abstract java.lang.String |
getParameter(java.lang.String parameter,
java.lang.String args)
Gets the Agora SDK’s parameters for customization purposes.
|
abstract java.lang.String |
getParameters(java.lang.String parameters)
Queries internal states
|
static int |
getRecommendedEncoderType()
Deprecated.
This method is deprecated.
|
static java.lang.String |
getSdkVersion()
Gets the SDK version.
|
abstract int |
getUserInfoByUid(int uid,
UserInfo userInfo)
Gets the user information by passing in the user ID.
|
abstract int |
getUserInfoByUserAccount(java.lang.String userAccount,
UserInfo userInfo)
Gets the user information by passing in the user account.
|
abstract int |
getVolumeOfEffect(int soundId)
Get the volume of a specified sound effect.
|
abstract boolean |
isCameraAutoFocusFaceModeSupported()
Checks whether the camera auto focus function is supported.
|
abstract boolean |
isCameraExposurePositionSupported()
Checks whether the camera exposure function is supported.
|
abstract boolean |
isCameraFaceDetectSupported()
Checks whether the camera face detect function is supported.
|
abstract boolean |
isCameraFocusSupported()
Checks whether the camera manual focus function is supported.
|
abstract boolean |
isCameraTorchSupported()
Checks whether the camera flash function is supported.
|
abstract boolean |
isCameraZoomSupported()
Checks whether the camera zoom function is supported.
|
abstract boolean |
isSpeakerphoneEnabled()
Checks whether the speakerphone is enabled.
|
abstract boolean |
isTextureEncodeSupported()
Checks whether texture encoding is supported.
|
abstract int |
joinChannel(java.lang.String token,
java.lang.String channelId,
int uid,
ChannelMediaOptions options)
Joins a channel with media options.
|
abstract int |
joinChannel(java.lang.String token,
java.lang.String channelName,
java.lang.String optionalInfo,
int optionalUid)
Joins a channel.
|
abstract int |
joinChannelWithUserAccount(java.lang.String token,
java.lang.String channelName,
java.lang.String userAccount)
Joins the channel with a user account.
|
abstract int |
joinChannelWithUserAccount(java.lang.String token,
java.lang.String channelName,
java.lang.String userAccount,
ChannelMediaOptions options)
Joins the channel with a user account, and configures whether to automatically subscribe to
audio or video streams after joining the channel.
|
abstract int |
leaveChannel()
Leaves the channel.
|
abstract int |
leaveChannel(LeaveChannelOptions options)
Leaves the channel.
|
abstract int |
loadExtensionProvider(java.lang.String path) |
abstract void |
monitorBluetoothHeadsetEvent(boolean monitor)
Deprecated.
|
abstract void |
monitorHeadsetEvent(boolean monitor)
Deprecated.
|
abstract int |
muteAllRemoteAudioStreams(boolean muted)
Stops or resumes receiving all remote audio streams.
|
abstract int |
muteAllRemoteVideoStreams(boolean muted)
Stops or resumes receiving all remote video streams.
|
abstract int |
muteLocalAudioStream(boolean muted)
Stops or resumes sending the local audio stream.
|
abstract int |
muteLocalVideoStream(boolean muted)
Stops or resumes sending the local video stream.
|
abstract int |
muteRecordingSignal(boolean muted)
Mute or resume recording signal volume.
|
abstract int |
muteRemoteAudioStream(int uid,
boolean muted)
Stops or resumes receiving the audio stream of a specified user.
|
abstract int |
muteRemoteVideoStream(int userId,
boolean muted)
Stops or resumes receiving the video stream of a specified user.
|
abstract int |
pauseAllChannelMediaRelay()
pause the channels for media stream relay.
|
abstract int |
pauseAllEffects()
Pauses playing all audio effects.
|
abstract int |
pauseAudio()
Disables the audio function in the channel.
|
abstract int |
pauseAudioMixing()
Pauses playing and mixing the music file.
|
abstract int |
pauseEffect(int soundId)
Pauses playing the specified audio effect.
|
abstract int |
playAllEffects(int loopCount,
double pitch,
double pan,
double gain,
boolean publish)
Plays all audio effects.
|
abstract int |
playEffect(int soundId,
java.lang.String filePath,
int loopCount,
double pitch,
double pan,
double gain,
boolean publish)
Plays a specified audio effect.
|
abstract int |
playEffect(int soundId,
java.lang.String filePath,
int loopCount,
double pitch,
double pan,
double gain,
boolean publish,
int startPos)
Plays a specified audio effect.
|
abstract int |
preloadEffect(int soundId,
java.lang.String filePath)
Preloads a specified audio effect.
|
abstract int |
preloadEffect(int soundId,
java.lang.String filePath,
int startPos)
Preloads a specified audio effect.
|
abstract int |
pullPlaybackAudioFrame(byte[] data,
int lengthInByte)
Pulls the remote audio frame.
|
abstract int |
pullPlaybackAudioFrame(java.nio.ByteBuffer data,
int lengthInByte)
Pulls the remote audio frame.
|
abstract int |
pushCaptureAudioFrame(byte[] data) |
abstract int |
pushCaptureAudioFrame(java.nio.ByteBuffer data,
int lengthInByte) |
abstract int |
pushDirectAudioFrame(java.nio.ByteBuffer data,
long timestamp,
int sampleRate,
int channels)
Pushes the direct send audio data to the SDK.
|
abstract int |
pushExternalAudioFrame(byte[] data,
long timestamp)
Pushes the external audio data to the app.
|
abstract int |
pushExternalAudioFrame(java.nio.ByteBuffer data,
long timestamp,
int sourceId)
Pushes the external audio data to the app.
|
abstract int |
pushExternalEncodedVideoFrame(java.nio.ByteBuffer data,
EncodedVideoFrameInfo frameInfo)
Pushes the encoded external video frame to Agora SDK.
|
abstract boolean |
pushExternalVideoFrame(AgoraVideoFrame frame)
Deprecated.
|
abstract boolean |
pushExternalVideoFrame(VideoFrame frame)
Pushes the video frame using the `VideoFrame` class and passes the video frame to the Agora
SDK.
|
abstract int |
pushReverseAudioFrame(byte[] data) |
abstract int |
pushReverseAudioFrame(java.nio.ByteBuffer data,
int lengthInByte) |
abstract CodecCapInfo[] |
queryCodecCapability()
QueryCodecCapability.
|
abstract int |
rate(java.lang.String callId,
int rating,
java.lang.String description)
Allows a user to rate the call.
|
abstract int |
registerAudioEncodedFrameObserver(io.agora.rtc2.internal.AudioEncodedFrameObserverConfig config,
IAudioEncodedFrameObserver observer)
Registers an encoded audio frame observer object.
|
abstract int |
registerAudioFrameObserver(IAudioFrameObserver observer)
Registers an audio frame observer object.
|
abstract int |
registerAudioSpectrumObserver(IAudioSpectrumObserver observer)
Registers an audio spectrum observer.
|
abstract int |
registerLocalUserAccount(java.lang.String appId,
java.lang.String userAccount)
Registers a user account.
|
abstract int |
registerMediaMetadataObserver(IMetadataObserver observer,
int type)
Registers the metadata observer.
|
abstract int |
registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver receiver)
Registers a receiver object for the encoded video image.
|
abstract int |
registerVideoFrameObserver(IVideoFrameObserver observer)
Registers a video frame observer object.
|
void |
removeHandler(IRtcEngineEventHandler handler)
Removes the specified IRtcEngineEventHandler object.
|
abstract int |
renewToken(java.lang.String token)
Renews the token.
|
abstract int |
resumeAllChannelMediaRelay()
resume the channels for media stream relay.
|
abstract int |
resumeAllEffects()
Resumes playing all audio effects.
|
abstract int |
resumeAudio()
Enables the audio function in the channel.
|
abstract int |
resumeAudioMixing()
Resumes playing and mixing the music file.
|
abstract int |
resumeEffect(int soundId)
Resumes playing the specified audio effect.
|
abstract int |
selectAudioTrack(int audioIndex)
select the track of the mixing music file.
|
abstract int |
sendCustomReportMessage(java.lang.String id,
java.lang.String category,
java.lang.String event,
java.lang.String label,
int value)
Agora supports reporting and analyzing customized messages.
|
abstract int |
sendStreamMessage(int streamId,
byte[] message)
Sends a data stream.
|
abstract int |
SetAdvancedAudioOptions(AdvancedAudioOptions options)
set advanced audio option
|
abstract int |
setAudioEffectParameters(int preset,
int param1,
int param2)
Sets parameters for SDK preset audio effects.
|
abstract int |
setAudioEffectPreset(int preset)
Sets an SDK preset audio effect.
|
abstract int |
setAudioMixingDualMonoMode(Constants.AudioMixingDualMonoMode mode)
In dual-channel music files, different audio data can be stored on the left and right
channels.
|
abstract int |
setAudioMixingPitch(int pitch)
Sets the pitch of the music file.
|
abstract int |
setAudioMixingPosition(int pos)
Sets the playback position (ms) of the music file to a different starting position (the default
plays from the beginning).
|
abstract int |
setAudioOptionParams(java.lang.String params) |
abstract int |
setAudioProfile(int profile)
Sets the audio profile.
|
abstract int |
setAudioProfile(int profile,
int scenario)
Sets the audio parameters and application scenarios.
|
abstract int |
setAudioScenario(int scenario) |
abstract int |
setAudioSessionParams(java.lang.String params) |
abstract int |
setAVSyncSource(java.lang.String channelId,
int uid)
Bind local user and a remote user as an audio&video sync group.
|
abstract int |
setBeautyEffectOptions(boolean enabled,
BeautyOptions options)
Enables/Disables image enhancement and sets the options.
|
abstract int |
setCameraAutoFocusFaceModeEnabled(boolean enabled)
Enables the camera auto focus face function.
|
abstract int |
setCameraCapturerConfiguration(CameraCapturerConfiguration config)
Sets the camera capturer configuration.
|
abstract int |
setCameraExposurePosition(float positionXinView,
float positionYinView)
Sets the camera exposure position.
|
abstract int |
setCameraFocusPositionInPreview(float positionX,
float positionY)
Sets the manual focus position.
|
abstract int |
setCameraTorchOn(boolean isOn)
Enables the camera flash.
|
abstract int |
setCameraZoomFactor(float factor)
Sets the camera zoom ratio.
|
abstract int |
setChannelProfile(int profile)
Sets the channel profile.
|
abstract int |
setClientRole(int role)
Sets the role of a user.
|
abstract int |
setClientRole(int role,
ClientRoleOptions options)
Sets the role of a user (`LIVE_BROADCASTING` profile only).
|
abstract int |
setCloudProxy(int proxyType)
Sets the Agora cloud proxy service.
|
abstract int |
setColorEnhanceOptions(boolean enabled,
ColorEnhanceOptions options)
Sets color enhancement.
|
abstract int |
setDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker)
Sets the default audio route.
|
abstract int |
setDefaultMuteAllRemoteAudioStreams(boolean muted)
Deprecated.
This method is deprecated. To set whether to receive remote audio streams by
default, call
muteAllRemoteAudioStreams before calling `joinChannel`.
Use `setDefaultMuteAllRemoteAudioStreams` to set whether to receive audio streams of subsequent
peer users. Agora recommends calling it before joining a channel.
A successful call of `setDefaultMuteAllRemoteAudioStreams(true)` results in that the local user
not receiving any audio stream after joining a channel. |
abstract int |
setDefaultMuteAllRemoteVideoStreams(boolean muted)
Deprecated.
This method is deprecated. To set whether to receive remote video streams by
default, call
muteAllRemoteVideoStreams before calling `joinChannel`.
Use `setDefaultMuteAllRemoteVideoStreams` to set whether to receive video streams of subsequent
peer users. Agora recommends calling it before joining a channel.
A successful call of `setDefaultMuteAllRemoteVideoStreams(true)` results in that the local user
not receiving any video stream after joining a channel. |
abstract int |
setDirectCdnStreamingAudioConfiguration(int profile)
Set audio parameters for direct streaming to CDN
Must call this api before "startDirectCdnStreaming"
|
abstract int |
setDirectCdnStreamingVideoConfiguration(VideoEncoderConfiguration config)
Set video parameters for direct streaming to CDN
Each configuration profile corresponds to a set of video parameters, including
the resolution, frame rate, and bitrate.
|
abstract int |
setDirectExternalAudioSource(boolean enabled)
Sets the direct external audio source.
|
abstract int |
setDirectExternalAudioSource(boolean enabled,
boolean localPlayback)
Sets the direct external audio source.
|
abstract int |
setDualStreamMode(Constants.SimulcastStreamMode mode)
Enables, disables or auto enable the dual video stream mode.
|
abstract int |
setDualStreamMode(Constants.SimulcastStreamMode mode,
SimulcastStreamConfig streamConfig)
Enables, disables or auto enable the dual video stream mode.
|
abstract int |
setEarMonitoringAudioFrameParameters(int sampleRate,
int channel,
int mode,
int samplesPerCall)
Sets the audio ear monitoring format for the
onEarMonitoringAudioFrame
callback. |
abstract int |
setEffectPosition(int soundId,
int pos)
Sets the playback position of an audio effect file.
|
abstract int |
setEffectsVolume(double volume)
Sets the volume of audio effects.
|
abstract int |
setEnableSpeakerphone(boolean enabled)
Enables or disables the speakerphone temporarily.
|
abstract int |
setEncryptionMode(java.lang.String encryptionMode)
Deprecated.
This method is deprecated.
The Agora Native SDK supports built-in encryption. Call this API to set the encryption mode. All users in the same channel must use the same encryption mode and password. Refer to information related to the encryption algorithm on the differences between encryption modes.
Call Note: Do not use this function together with CDN. |
abstract int |
setEncryptionSecret(java.lang.String secret)
Deprecated.
This method is deprecated.
All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user has left the channel. If the encryption password is not specified or set to empty, the encryption function will be disabled. Note: Do not use this function together with CDN. |
abstract int |
setExtensionProperty(java.lang.String provider,
java.lang.String extension,
ExtensionInfo extensionInfo,
java.lang.String key,
java.lang.String value)
Set extension specific property.
|
abstract int |
setExtensionProperty(java.lang.String provider,
java.lang.String extension,
java.lang.String key,
java.lang.String value)
Set local video filter property
|
abstract int |
setExtensionProperty(java.lang.String provider,
java.lang.String extension,
java.lang.String key,
java.lang.String value,
Constants.MediaSourceType sourceType) |
abstract int |
setExtensionProviderProperty(java.lang.String provider,
java.lang.String key,
java.lang.String value)
Set extension provider specific property.
|
abstract int |
setExternalAudioSink(boolean enabled,
int sampleRate,
int channels)
Sets the external audio sink.
|
abstract int |
setExternalAudioSource(boolean enabled,
int sampleRate,
int channels)
Sets the external audio source.
|
abstract int |
setExternalAudioSource(boolean enabled,
int sampleRate,
int channels,
int sourceNumber,
boolean localPlayback,
boolean publish)
Sets the external audio source.
|
abstract int |
setExternalVideoSource(boolean enable,
boolean useTexture,
Constants.ExternalVideoSourceType sourceType)
Sets the external video source.
|
abstract int |
setExternalVideoSource(boolean enable,
boolean useTexture,
Constants.ExternalVideoSourceType sourceType,
EncodedVideoTrackOptions encodedOpt)
Sets the external video source.
|
abstract int |
setHeadphoneEQParameters(int lowGain,
int highGain)
Sets the parameters of audio playback effect for remote headphones after remote audio is mixed.
|
abstract int |
setHeadphoneEQPreset(int preset)
Sets preset audio playback effect for remote headphones after remote audio is mixed.
|
abstract int |
setHighQualityAudioParameters(boolean fullband,
boolean stereo,
boolean fullBitrate)
Sets high-quality audio preferences.
|
abstract int |
setInEarMonitoringVolume(int volume)
Sets the volume of the in-ear monitoring.
|
abstract int |
setLocalAccessPoint(LocalAccessPointConfiguration config)
set local access point addresses in local proxy mode, use this method before join channel.
|
abstract int |
setLocalPublishFallbackOption(int option)
Sets the fallback option for the locally published video stream based on the network
conditions.
|
abstract int |
setLocalRenderMode(int renderMode)
Deprecated.
|
abstract int |
setLocalRenderMode(int renderMode,
int mirrorMode)
Updates the display mode of the local video view.
|
abstract int |
setLocalVideoMirrorMode(int mode)
Deprecated.
|
abstract int |
setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency,
int bandGain)
Sets the local voice equalization effect.
|
abstract int |
setLocalVoicePitch(double pitch)
Sets the voice pitch of the local speaker.
|
abstract int |
setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE reverbKey,
int value)
Sets the local voice reverberation.
|
abstract int |
setLogFile(java.lang.String filePath)
Specifies an SDK output log file.
|
abstract int |
setLogFileSize(long fileSizeInKBytes)
Sets the log file size (KB).
|
abstract int |
setLogFilter(int filter)
Sets the output log filter level of the SDK.
|
abstract int |
setLogLevel(int level)
Sets the output log level of the SDK.
|
abstract int |
setLowlightEnhanceOptions(boolean enabled,
LowLightEnhanceOptions options)
Sets low-light enhancement.
|
abstract int |
setMixedAudioFrameParameters(int sampleRate,
int channel,
int samplesPerCall)
Sets the mixed audio format for the
onMixedAudioFrame callback. |
abstract int |
setParameters(java.lang.String parameters)
Provides technical preview functionalities or special customizations by
configuring the SDK with JSON options.
|
abstract int |
setPlaybackAudioFrameBeforeMixingParameters(int sampleRate,
int channel)
Sets the audio playback format before mixing for the
onPlaybackAudioFrameBeforeMixing callback. |
abstract int |
setPlaybackAudioFrameParameters(int sampleRate,
int channel,
int mode,
int samplesPerCall)
Sets the audio recording format for the
onPlaybackAudioFrame callback. |
abstract void |
setPreferHeadset(boolean enabled)
Deprecated.
This method is deprecated.
|
abstract int |
setRecordingAudioFrameParameters(int sampleRate,
int channel,
int mode,
int samplesPerCall)
Sets the audio recording format for the
onRecordAudioFrame callback. |
abstract int |
setRemoteDefaultVideoStreamType(int streamType)
Sets the default stream type of the remote video if the remote user has enabled dual-stream.
|
abstract int |
setRemoteRenderMode(int userId,
int renderMode)
Deprecated.
|
abstract int |
setRemoteRenderMode(int userId,
int renderMode,
int mirrorMode)
Updates the display mode of the video view of a remote user.
|
abstract int |
setRemoteSubscribeFallbackOption(int option)
Sets the fallback option for the remotely subscribed video stream based on the network
conditions.
|
abstract int |
setRemoteUserPriority(int uid,
int userPriority)
Sets the priority of a remote user's media stream.
|
abstract int |
setRemoteUserSpatialAudioParams(int uid,
SpatialAudioParams params) |
abstract int |
setRemoteVideoStreamType(int uid,
int streamType)
Sets the remote video stream type.
|
abstract int |
setRemoteVideoSubscriptionOptions(int uid,
VideoSubscriptionOptions options) |
abstract int |
setRemoteVoicePosition(int uid,
double pan,
double gain)
Sets the sound position and gain of a remote user.
|
abstract int |
setSubscribeAudioBlacklist(int[] uidList)
Sets the blacklist of subscribe remote stream audio.
|
abstract int |
setSubscribeAudioWhitelist(int[] uidList)
Sets the whitelist of subscribe remote stream audio.
|
abstract int |
setSubscribeVideoBlacklist(int[] uidList)
Sets the blacklist of subscribe remote stream video.
|
abstract int |
setSubscribeVideoWhitelist(int[] uidList)
Sets the whitelist of subscribe remote stream video.
|
abstract int |
setupLocalVideo(VideoCanvas local)
Initializes the local video view.
|
abstract int |
setupRemoteVideo(VideoCanvas remote)
Initializes the video view of a remote user.
|
abstract int |
setVideoDenoiserOptions(boolean enabled,
VideoDenoiserOptions options)
Sets video noise reduction.
|
abstract int |
setVideoEncoderConfiguration(VideoEncoderConfiguration config)
Sets the video encoder configuration.
|
abstract int |
setVideoProfile(int profile,
boolean swapWidthAndHeight)
Sets the video encoding profile.
|
abstract int |
setVideoQualityParameters(boolean preferFrameRateOverImageQuality)
Sets the video quality preferences.
|
abstract int |
setVoiceBeautifierParameters(int preset,
int param1,
int param2)
Sets parameters for SDK preset voice beautifier effects.
|
abstract int |
setVoiceBeautifierPreset(int preset)
Sets an SDK preset voice beautifier effect.
|
abstract int |
setVoiceConversionParameters(int preset,
int param1,
int param2)
Set parameters for SDK preset voice conversion.
|
abstract int |
setVoiceConversionPreset(int preset)
Sets an SDK preset voice conversion effect.
|
abstract int |
setVolumeOfEffect(int soundId,
double volume)
Sets the volume of the specified audio effect.
|
abstract int |
startAudioMixing(java.lang.String filePath,
boolean loopback,
int cycle)
Starts playing and mixing the music file.
|
abstract int |
startAudioMixing(java.lang.String filePath,
boolean loopback,
int cycle,
int startPos)
Starts playing and mixing the music file.
|
abstract int |
startAudioRecording(io.agora.rtc2.internal.AudioRecordingConfiguration config)
Starts an audio recording.
|
abstract int |
startAudioRecording(java.lang.String filePath,
int quality)
Starts an audio recording.
|
abstract int |
startChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration)
Starts to relay media streams across channels.
|
abstract int |
startDirectCdnStreaming(IDirectCdnStreamingEventHandler eventHandler,
java.lang.String publishUrl,
DirectCdnStreamingMediaOptions options)
Start direct cdn streaming
|
abstract int |
startEchoTest()
Deprecated.
Now use
#startEchoTest(int)
Starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. In the test, the user first speaks, and the recording is played back in 10 seconds. If the user can hear the recording in 10 seconds, it indicates that the audio devices and network connection work properly.
Note: After calling the |
abstract int |
startEchoTest(EchoTestConfiguration config)
Starts a video call test.
|
abstract int |
startEchoTest(int intervalInSeconds)
Starts an audio call test.
|
abstract int |
startLastmileProbeTest(io.agora.rtc2.internal.LastmileProbeConfig config)
Starts the last-mile network probe test before joining a channel to get the uplink and downlink
last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time
(RTT).
|
abstract int |
startPreview()
Starts the local video preview before joining a channel.
|
abstract int |
startPreview(Constants.VideoSourceType sourceType)
Starts the local video preview before joining a channel.
|
abstract int |
startRecordingDeviceTest(int indicationInterval)
Starts the microphone test.
|
abstract int |
startRhythmPlayer(java.lang.String sound1,
java.lang.String sound2,
AgoraRhythmPlayerConfig config)
Enables the rhythm player.
|
abstract int |
startRtmpStreamWithoutTranscoding(java.lang.String url)
Publishes the local stream without transcoding to a specified CDN live RTMP address.
|
abstract int |
startRtmpStreamWithTranscoding(java.lang.String url,
LiveTranscoding transcoding)
Publishes the local stream with transcoding to a specified CDN live RTMP address.
|
abstract int |
startScreenCapture(ScreenCaptureParameters screenCaptureParameters)
Starts screen sharing.
|
abstract int |
startSecondaryCameraCapture(CameraCapturerConfiguration config)
Start the secondary camera capture.
|
abstract int |
stopAllEffects()
Stops playing all audio effects.
|
abstract int |
stopAudioMixing()
Stops playing or mixing the music file.
|
abstract int |
stopAudioRecording()
Stops the audio recording on the client.
|
abstract int |
stopChannelMediaRelay()
Stops the media stream relay.
|
abstract int |
stopDirectCdnStreaming()
Stop direct cdn streaming
|
abstract int |
stopEchoTest()
Stops an audio call test.
|
abstract int |
stopEffect(int soundId)
Stops playing the specified audio effect.
|
abstract int |
stopLastmileProbeTest()
Stops the last-mile network probe test.
|
abstract int |
stopPreview()
Stops the local video preview and the video.
|
abstract int |
stopPreview(Constants.VideoSourceType sourceType)
Stops the local video preview and the video.
|
abstract int |
stopRecordingDeviceTest()
Stops the microphone test.
|
abstract int |
stopRhythmPlayer()
Disables the rhythm player.
|
abstract int |
stopRtmpStream(java.lang.String url)
Stop an RTMP stream with transcoding or without transcoding from the CDN.
|
abstract int |
stopScreenCapture()
Stops screen sharing.
|
abstract int |
stopSecondaryCameraCapture()
Stop the secondary camera capture.
|
abstract int |
switchCamera()
Switches between front and rear cameras.
|
abstract int |
takeSnapshot(int uid,
java.lang.String filePath) |
abstract int |
unloadAllEffects()
Releases all preloaded audio effects from the memory.
|
abstract int |
unloadEffect(int soundId)
Releases the specific preloaded audio effect from the memory.
|
abstract int |
unRegisterAudioSpectrumObserver(IAudioSpectrumObserver observer)
Releases the audio spectrum observer.
|
abstract int |
unregisterMediaMetadataObserver(IMetadataObserver observer,
int type)
Unregisters the metadata observer.
|
abstract int |
updateChannelMediaOptions(ChannelMediaOptions options)
Updates the channel media options after joining the channel.
|
abstract int |
updateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration)
Updates the channels for media relay.
|
abstract int |
updateDirectCdnStreamingMediaOptions(DirectCdnStreamingMediaOptions options)
Change the media source during the pushing
|
abstract int |
updateRtmpTranscoding(LiveTranscoding transcoding)
Update the video layout and audio settings for CDN live.
|
abstract int |
updateScreenCaptureParameters(ScreenCaptureParameters screenCaptureParameters)
Updates the screen sharing configuration.
|
abstract java.lang.String |
uploadLogFile()
Upload current log file immediately to server.
|
abstract int |
useExternalAudioDevice()
Use the external audio device.
|
public static RtcEngine create(Context context, java.lang.String appId, IRtcEngineEventHandler handler) throws java.lang.Exception
RtcEngine
instance.
Unless otherwise specified, all the methods provided by the RtcEngine
class are
executed asynchronously. Agora recommends calling these methods in the same thread.context
- The context of Android Activity.appId
- The App ID issued to you by Agora.
See [How to get the App ID](https://docs.agora.io/en/Agora%20Platform/token#get-an-app-id).
Only users in apps with the same App ID can join the same channel and communicate with each
other. Use an App ID to create only one RtcEngine
instance. To change your App ID, call
destroy to destroy
the current RtcEngine
instance and then
call `create` to create an RtcEngine
instance with the new App ID.handler
- IRtcEngineEventHandler
is an
abstract class providing default implementation. The SDK uses this class to report to the app
on SDK runtime events.RtcEngine
instance, if the method call succeeds.
- < 0, if the method call fails.java.lang.Exception
- Fails to create an RtcEngine
instance.public static RtcEngine create(RtcEngineConfig config) throws java.lang.Exception
config
- Configurations for the RtcEngine instance. For details, see RtcEngineConfig
.java.lang.Exception
- Fails to create an RtcEngine instance.public static void destroy()
public abstract int setChannelProfile(int profile)
RtcEngine
differentiates channel profiles and applies different optimization
algorithms accordingly. For example, it prioritizes smoothness and low latency for a video
call, and prioritizes video quality for a video broadcast.profile
- The channel profile:
- `CHANNEL_PROFILE_COMMUNICATION`(0): Communication.
Use this profile when there are two users in the channel.
- `CHANNEL_PROFILE_LIVE_BROADCASTING`(1): (Default) Live Broadcast.public abstract int setClientRole(int role)
role
- The role of the client:
- `CLIENT_ROLE_BROADCASTER`(1): The broadcaster.
- `CLIENT_ROLE_AUDIENCE(2)`: The audience.public abstract int setClientRole(int role, ClientRoleOptions options)
onClientRoleChanged
.
- The remote client: onUserJoined
or onUserOffline
(USER_OFFLINE_BECOME_AUDIENCE).role
- Sets the role of a user:
- `CLIENT_ROLE_BROADCASTER`(1): Host. A host can both send and receive streams.
- `CLIENT_ROLE_AUDIENCE`(2): Audience, the default role. An audience can only receive streams.options
- Client role options of a user, see #ClientRoleOptions.public abstract int sendCustomReportMessage(java.lang.String id, java.lang.String category, java.lang.String event, java.lang.String label, int value)
public abstract int joinChannel(java.lang.String token, java.lang.String channelName, java.lang.String optionalInfo, int optionalUid)
leaveChannel
method to exit the
current call before entering another channel.token
- The token for authentication.
- In situations not requiring high security: You can use the temporary token generated at
Console. For details, see [Get a temporary
token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token).
- In situations requiring high security: Set it as the token generated at you server. For
details, see [Generate a
token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token).channelName
- The unique channel name for the AgoraRTC session in the string format. The
string
length must be less than 64 bytes. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-",
":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".optionalInfo
- (Optional) Additional information about the channel that you want
to add. It can be set as a NULL string or channel related information.
Other users in the channel will not receive this message.optionalUid
- (Optional) User ID: A 32-bit unsigned integer ranging from 1 to
(2^32-1). It must be unique. If not assigned (or set to 0), the SDK assigns one
and reports it in the onJoinChannelSuccess
callback.
Your app must record and maintain the returned value as the SDK does not maintain it.public abstract int joinChannel(java.lang.String token, java.lang.String channelId, int uid, ChannelMediaOptions options)
leaveChannel
method to exit the
current call before entering another channel.token
- The token for authentication.
- In situations not requiring high security: You can use the temporary token generated at
Console. For details, see [Get a temporary
token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token).
- In situations requiring high security: Set it as the token generated at you server. For
details, see [Generate a
token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token).channelId
- The unique channel name for the AgoraRTC session in the string format. The
string
length must be less than 64 bytes. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-",
":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".uid
- (Optional) User ID: A 32-bit unsigned integer ranging from 1 to
(2^32-1). It must be unique. If not assigned (or set to 0), the SDK assigns one
and reports it in the onJoinChannelSuccess
callback. Your app must record and maintain the returned value as the SDK does not maintain it.options
- The channel media options: ChannelMediaOptions
.public abstract int leaveChannel()
onLeaveChannel
callback.public abstract int leaveChannel(LeaveChannelOptions options)
options
- The leave channel options.
This method allows a user to leave the channel, for example, by hanging up or exiting a call.
This method is an asynchronous call, which means that the result of this method returns even
before the user has not actually left the channel. Once the user successfully leaves the
channel, the SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel"
callback.public abstract int renewToken(java.lang.String token)
onTokenPrivilegeWillExpire
callback is triggered;
- The onRequestToken
callback is triggered;
- The `ERR_TOKEN_EXPIRED(-109)` error is reported.token
- The new token.public abstract int registerLocalUserAccount(java.lang.String appId, java.lang.String userAccount)
appId
- The App ID of your project.userAccount
- The user account. The maximum length of this parameter is 255 bytes. Ensure
that you set this parameter and do not set it as null. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".public abstract int joinChannelWithUserAccount(java.lang.String token, java.lang.String channelName, java.lang.String userAccount)
token
- The token generated at your server:
- For low-security requirements: You can use the temporary token generated at Console. For
details, see [Get a temporary
toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token).
- For high-security requirements: Set it as the token generated at your server. For details,
see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token).channelName
- The channel name. The maximum length of this parameter is 64 bytes.
Supported
character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".userAccount
- The user account. The maximum length of this parameter is 255 bytes. Ensure
that you set this parameter and do not set it as null. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".options
- The channel media options: \ref
agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions"public abstract int joinChannelWithUserAccount(java.lang.String token, java.lang.String channelName, java.lang.String userAccount, ChannelMediaOptions options)
token
- The token generated at your server. For details, see [Generate a
token](https://docs.agora.io/en/Interactive Broadcast/token_server?platform=Android).channelName
- The channel name. The maximum length of this parameter is 64 bytes.
Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".userAccount
- The user account. The maximum length of this parameter is 255 bytes. Ensure
that you set this parameter and do not set it as null.
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+",
"-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".options
- The channel media options: ChannelMediaOptions
.ERR_INVALID_ARGUMENT(-2)
- ERR_NOT_READY(-3)
- ERR_REFUSED(-5)
onLocalUserRegistered
and onJoinChannelSuccess
.
- The remote client: onUserJoined
and onUserInfoUpdated
, if the user joining the channel is
in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile.public abstract int getUserInfoByUserAccount(java.lang.String userAccount, UserInfo userInfo)
userAccount
- The user account of the user. Ensure that you set this parameter.userInfo
- A userInfo object that identifies the userpublic abstract int getUserInfoByUid(int uid, UserInfo userInfo)
uid
- The user ID of the remote user. Ensure that you set this parameter.userInfo
- A userInfo object that identifies the userpublic abstract DeviceInfo getAudioDeviceInfo()
public abstract int enableWebSdkInteroperability(boolean enabled)
enabled
- Determines whether to enable interoperability with the Agora Web SDK.
- true: Enable interoperability with the Agora Native SDK.
- false: Disable interoperability with the Agora Native SDK.public abstract int getConnectionState()
CONNECTION_STATE_DISCONNECTED(1)
: The SDK
is disconnected from Agora's edge server.
- CONNECTION_STATE_CONNECTING(2)
: The SDK is
connecting to Agora's edge server.
- CONNECTION_STATE_CONNECTED(3)
: The SDK
joined a channel and is connected to Agora's edge server. You can now publish or subscribe to a
media stream in the channel.
- CONNECTION_STATE_RECONNECTING(4)
: The SDK
keeps rejoining the channel after being disconnected from a joined channel because of network
issues.
- CONNECTION_STATE_FAILED(5)
: The SDK fails to
join the channel.public abstract int enableAudio()
public abstract int disableAudio()
public abstract int pauseAudio()
Note: This method controls the underlying states of the Engine. It is still valid after one leaves channel.
public abstract int resumeAudio()
public abstract int setAudioProfile(int profile)
profile
- Sets the sample rate, bitrate, encoding mode, and the number of channels. See
AudioProfile
.public abstract int setAudioProfile(int profile, int scenario)
profile
- Sets the sample rate, bitrate, encoding mode, and the number of channels. See
AudioProfile
.scenario
- Sets the audio application scenarios. See AudioScenario
.public abstract int setAudioScenario(int scenario)
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
.
fullband
- Full-band codec (48 kHz sampling rate), not compatible
with versions before v1.7.4.
stereo
- Stereo codec, not compatible with versions before v1.7.4.
fullBitrate
- High bitrate. Recommended in voice-only mode.
public abstract int adjustRecordingSignalVolume(int volume)
volume
- Recording volume, ranges from 0 to 400:
public abstract int adjustPlaybackSignalVolume(int volume)
volume
- Playback volume, ranges from 0 to 400:
public abstract int enableAudioVolumeIndication(int interval, int smooth, boolean reportVad)
onAudioVolumeIndication
callback is enabled, the SDK returns the volume indication in the at the time interval set
in `enableAudioVolumeIndication`, regardless of whether any user is speaking in the channel.interval
- Sets the time interval between two consecutive volume indications:
- <= 0: Disables the volume indication.
- > 0: Time interval (ms) between two consecutive volume indications,
and should be integral multiple of 200 (less than 200 will be set to 200).smooth
- The smoothing factor that sets the sensitivity of the audio volume
indicator. The value ranges is [0, 10]. The greater the value, the more sensitive the
indicator. The recommended value is 3.@Deprecated public abstract int enableAudioQualityIndication(boolean enabled)
The onAudioQuality
callback triggers periodically after this callback is
enabled.
Enables the audio quality notification callbacks.
enabled
- Whether to enable the audio quality notification callbacks.
True/False.public abstract int enableLocalAudio(boolean enabled)
enabled
- Determines whether to disable or re-enable the local audio function:
- true: (Default) Re-enable the local audio function, that is, to start local
audio capture and processing.
- false: Disable the local audio function, that is, to stop local audio
capture and processing.public abstract int muteLocalAudioStream(boolean muted)
mute
- Determines whether to send or stop sending the local audio stream:
- true: Stop sending the local audio stream.
- false: (Default) Send the local audio stream.public abstract int muteRemoteAudioStream(int uid, boolean muted)
uid
- The ID of the specified user.mute
- Whether to stop receiving the audio stream of the specified user:
- true: Stop receiving the specified audio stream.
- false: (Default) Receive the specified audio stream.public abstract int adjustUserPlaybackSignalVolume(int uid, int volume)
uid
- Remote user ID.volume
- The playback volume, range is [0,100]:
0: mute, 100: The original volumepublic abstract int muteAllRemoteAudioStreams(boolean muted)
muted
- Whether to stop receiving remote audio streams:
- true: Stop receiving any remote audio stream.
- false: (Default) Resume receiving all remote audio streams.public abstract int setDefaultMuteAllRemoteAudioStreams(boolean muted)
muteAllRemoteAudioStreams
before calling `joinChannel`.
Use `setDefaultMuteAllRemoteAudioStreams` to set whether to receive audio streams of subsequent
peer users. Agora recommends calling it before joining a channel.
A successful call of `setDefaultMuteAllRemoteAudioStreams(true)` results in that the local user
not receiving any audio stream after joining a channel.muted
- Whether to receive remote audio streams by default:
- true: Do not receive any remote audio stream by default.
- false: (Default)) Receive remote audio streams by default.public abstract int enableVideo()
public abstract int disableVideo()
enableLocalVideo
(true).public abstract int setVideoProfile(int profile, boolean swapWidthAndHeight)
Sets the video encoding profile.
Each profile includes a set of parameters, such as the resolution, frame
rate, and bitrate. When the camera does not support the specified resolution,
the SDK chooses a suitable camera resolution, while the encoder resolution is
the one specified by
setVideoProfile
.
Note:
enableVideo
method.
joinChannel
or startPreview
method.
profile
- VideoProfile
.swapWidthAndHeight
- The width and height of the output video is
consistent with that of the video profile you set.
This parameter sets whether to swap the width and
height of the stream:
public abstract int setVideoEncoderConfiguration(VideoEncoderConfiguration config)
config
- The local video encoder configuration: VideoEncoderConfiguration.public abstract CodecCapInfo[] queryCodecCapability()
public abstract int setCameraCapturerConfiguration(CameraCapturerConfiguration config)
config
- The camera capturer configuration. For details, see CameraCapturerConfiguration
.public abstract int setupLocalVideo(VideoCanvas local)
local
- The local video view setting: VideoCanvas.public abstract int setupRemoteVideo(VideoCanvas remote)
onUserJoined
callback.
To unbind the remote user from the view, set `view` in VideoCanvas as `null`.remote
- The remote video view settings: VideoCanvas
.@Deprecated public abstract int setLocalRenderMode(int renderMode)
renderMode
- Sets the local display mode:
- `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries
(cropped). One dimension of the video may have clipped contents.
- `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary
(zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be
filled with black.public abstract int setLocalRenderMode(int renderMode, int mirrorMode)
renderMode
- Sets the local display mode:
- `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries
(cropped). One dimension of the video may have clipped contents.
- `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary
(zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be
filled with black.mirrorMode
- Sets the local video mirror mode:
- `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK.
If you use the front camera, the SDK enables the mirror mode;
if you use the rear camera, the SDK disables the mirror mode.
- `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode.
- `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.@Deprecated public abstract int setRemoteRenderMode(int userId, int renderMode)
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.public abstract int setRemoteRenderMode(int userId, int renderMode, int mirrorMode)
uid
- ID of the remote user.renderMode
- Sets the remote display mode:
- `RENDER_MODE_HIDDEN`(1): Uniformly scale the video until it fills the visible boundaries
(cropped). One dimension of the video may have clipped contents.
- `RENDER_MODE_FIT`(2): Uniformly scale the video until one of its dimension fits the boundary
(zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be
filled with black.mirrorMode
- Sets the remote video mirror mode:
- `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode.
- `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.@Deprecated public static SurfaceView CreateRendererView(Context context)
It returns the SurfaceView
type. The
operation and layout of the view are managed by the application, and the
Agora SDK renders the view provided by the application. The view to display
videos must be created using this method instead of directly calling
SurfaceView
.
Creates a video renderer view.
SurfaceView
@Deprecated public static TextureView CreateTextureView(Context context)
It returns the TextureView
type. The
operation and layout of the view are managed by the application, and the
Agora SDK renders the view provided by the application. The view to display
videos must be created using this method instead of directly calling
TextureView
.
Creates a TextureView.
TextureView
public abstract int startPreview()
leaveChannel
, the local video preview remains until
you call stopPreview
to disable it.public abstract int startPreview(Constants.VideoSourceType sourceType)
sourceType
- - The video source type.public abstract int stopPreview()
public abstract int stopPreview(Constants.VideoSourceType sourceType)
sourceType
- - The video source type.public abstract int enableLocalVideo(boolean enabled)
enableVideo
, the local video is enabled
by default. This method disables or re-enables the local video capture.
`enableLocalVideo(false)` applies to scenarios when the user wants to watch the remote video
without sending any video stream to the other user.enabled
- Determines whether to disable or re-enable the local video, including
the capturer, renderer, and sender:
- true: (Default) Re-enable the local video.
- false: Disable the local video. Once the local video is disabled, the remote
users can no longer receive the video stream of this user, while this user
can still receive the video streams of other remote users. When you set
`enabled` as `false`, this method does not require a local camera.public abstract int startSecondaryCameraCapture(CameraCapturerConfiguration config)
config
- - The config for secondary camera capturepublic abstract int stopSecondaryCameraCapture()
public abstract int muteLocalVideoStream(boolean muted)
mute
- Determines whether to send or stop sending the local video stream:
- true: Stop sending the local video stream.
- false: (Default) Send the local video stream.public abstract int muteRemoteVideoStream(int userId, boolean muted)
userId
- The ID of the specified user.mute
- Whether to stop receiving the video stream of the specified user:
- true: Stop receiving the video stream of the specified user.
- false: (Default) Resume receiving the video stream of the specified user.public abstract int muteAllRemoteVideoStreams(boolean muted)
muted
- Whether to stop receiving remote video streams:
- true: Stop receiving any remote video stream.
- false: (Default) RResume receiving all remote video streams.public abstract int setDefaultMuteAllRemoteVideoStreams(boolean muted)
muteAllRemoteVideoStreams
before calling `joinChannel`.
Use `setDefaultMuteAllRemoteVideoStreams` to set whether to receive video streams of subsequent
peer users. Agora recommends calling it before joining a channel.
A successful call of `setDefaultMuteAllRemoteVideoStreams(true)` results in that the local user
not receiving any video stream after joining a channel.muted
- Whether to receive remote video streams by default:
- true: Do not receive any remote video stream by default.
- false: (Default) Receive remote video streams by default.public abstract int setBeautyEffectOptions(boolean enabled, BeautyOptions options)
enabled
- Whether to enable image enhancement:
- `true`: Enables image enhancement.
- `false`: Disables image enhancement.options
- The image enhancement options. See BeautyOptions
.public abstract int setLowlightEnhanceOptions(boolean enabled, LowLightEnhanceOptions options)
enabled
- Sets whether to enable low-light enhancement:
- `true`: Enable.
- `false`: (Default) Disable.options
- The low-light enhancement options. See LowLightEnhanceOptions
.public abstract int setVideoDenoiserOptions(boolean enabled, VideoDenoiserOptions options)
enabled
- Sets whether to enable video noise reduction:
- `true`: Enable.
- `false`: (Default) Disable.options
- The video noise reduction options. See VideoDenoiserOptions
.public abstract int setColorEnhanceOptions(boolean enabled, ColorEnhanceOptions options)
enabled
- Sets whether to enable color enhancement:
- `true`: Enable.
- `false`: (Default) Disable.options
- The color enhancement options. See ColorEnhanceOptions
.public abstract int enableVirtualBackground(boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty)
enabled
- Sets whether or not to enable capture image background subtitution:
- true: enables background subtitution.
- false: disables background subtitution.VirtualBackgroundSource
- Sets the background source data. See VirtualBackgroundSource
.SegmentationProperty
- public abstract int enableRemoteSuperResolution(int uid, boolean enable)
userId
- The user ID of the remote user.enable
- Determines whether to enable super resolution for the remote user's video:
- true: Enable super resolution.
- false: Disable super resolution.public abstract int setDefaultAudioRoutetoSpeakerphone(boolean defaultToSpeaker)
onAudioRouteChanged
callback.defaultToSpeaker
- Whether to set the speakerphone as the default audio route:
- true: Set the speakerphone as the default audio route.
- false: Do not set the speakerphone as the default audio route.public abstract int setEnableSpeakerphone(boolean enabled)
onAudioRouteChanged
callback.
You can call this method before, during, or after a call. However, Agora recommends calling
this method only when you are in a channel to change the audio route temporarily.enabled
- Whether to set the speakerphone as the temporary audio route:
- true: Set the speakerphone as the audio route temporarily.
- false: Do not set the speakerphone as the audio route.public abstract boolean isSpeakerphoneEnabled()
public abstract int enableInEarMonitoring(boolean enabled)
enabled
- Determines whether to enable in-ear monitoring.
- true: Enable in-ear monitoring.
- false: Disable in-ear monitoring.public abstract int enableInEarMonitoring(boolean enabled, int includeAudioFilters)
enabled
- Determines whether to enable in-ear monitoring.
- true: Enable in ear monitoring.
- false: Disable in ear monitoring.includeAudioFilters
- The type of the ear monitoringpublic abstract int setInEarMonitoringVolume(int volume)
volume
- The volume of the in-ear monitor, ranging from 0 to 100. The
default value is 100.public abstract int useExternalAudioDevice()
public abstract int setLocalVoicePitch(double pitch)
pitch
- Voice frequency, in the range of 0.5 to 2.0. The default value
is 1.0.public abstract int setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain)
bandFrequency
- The band frequency ranging from 0 to 9; representing the
respective 10-band center frequencies of voice effects,
including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz.
Constants#AUDIO_EQUALIZATION_BAND_FREQUENCY
bandGain
- Gain of each band in dB; ranging from -15 to 15.public abstract int setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE reverbKey, int value)
reverbKey
- The reverberation key. This method contains five
reverberation keys. For details, see the description of each
value.value
- Local voice reverberation value:
AUDIO_REVERB_DRY_LEVEL(0)
AUDIO_REVERB_WET_LEVEL(1)
AUDIO_REVERB_ROOM_SIZE(2)
AUDIO_REVERB_WET_DELAY(3)
AUDIO_REVERB_STRENGTH(4)
public abstract int setHeadphoneEQPreset(int preset)
preset
- The preset key: #HEADPHONE_EQUALIZER_PRESET.
- HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones.
- HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only.
- HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only.public abstract int setHeadphoneEQParameters(int lowGain, int highGain)
lowGain
- The higher the parameter value, the deeper the sound. The value range is
[-10,10].highGain
- The higher the parameter value, the sharper the sound. The value range is
[-10,10].public abstract int setAudioEffectPreset(int preset)
preset
- The options for SDK preset audio effects
- AUDIO_EFFECT_OFF
- ROOM_ACOUSTICS_KTV
- ROOM_ACOUSTICS_VOCAL_CONCERT
- ROOM_ACOUSTICS_STUDIO
- ROOM_ACOUSTICS_PHONOGRAPH
- ROOM_ACOUSTICS_VIRTUAL_STEREO
- ROOM_ACOUSTICS_SPACIAL
- ROOM_ACOUSTICS_ETHEREAL
- ROOM_ACOUSTICS_3D_VOICE
- VOICE_CHANGER_EFFECT_UNCLE
- VOICE_CHANGER_EFFECT_OLDMAN
- VOICE_CHANGER_EFFECT_BOY
- VOICE_CHANGER_EFFECT_SISTER
- VOICE_CHANGER_EFFECT_GIRL
- VOICE_CHANGER_EFFECT_PIGKING
- VOICE_CHANGER_EFFECT_HULK
- STYLE_TRANSFORMATION_RNB
- STYLE_TRANSFORMATION_POPULAR
- PITCH_CORRECTION
setAudioProfile
and setting the `scenario` parameter to
`AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method.public abstract int setVoiceBeautifierPreset(int preset)
preset
- The options for SDK preset voice beautifier effects:
- VOICE_BEAUTIFIER_OFF
- CHAT_BEAUTIFIER_MAGNETIC
- CHAT_BEAUTIFIER_FRESH
- CHAT_BEAUTIFIER_VITALITY
- TIMBRE_TRANSFORMATION_VIGOROUS
- TIMBRE_TRANSFORMATION_DEEP
- TIMBRE_TRANSFORMATION_MELLOW
- TIMBRE_TRANSFORMATION_FALSETTO
- TIMBRE_TRANSFORMATION_FULL
- TIMBRE_TRANSFORMATION_CLEAR
- TIMBRE_TRANSFORMATION_RESOUNDING
- Constants#TIMBRE_TRANSFORMATION_RINGING TIMBRE_TRANSFORMATION_RINGING
- {@link Constants#ULTRA_HIGH_QUALITY_VOICE ULTRA_HIGH_QUALITY_VOICE}setAudioProfile
and setting the `scenario` parameter to
`AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to
`AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before
calling this method.public abstract int setVoiceConversionPreset(int preset)
preset
- The options for SDK preset voice conversion effects:
- VOICE_CONVERSION_OFF
- VOICE_CHANGER_NEUTRAL
- VOICE_CHANGER_SWEET
- VOICE_CHANGER_SOLID
- VOICE_CHANGER_BASS
setAudioProfile
and setting the `scenario` parameter to
`AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to
`AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before
calling this method.public abstract int setAudioEffectParameters(int preset, int param1, int param2)
preset
- The options for SDK preset audio effects:
- 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE`
- Call `setAudioProfile` and set the `profile` parameter to
`AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before
setting this enumerator; otherwise, the enumerator setting does not take effect.
- If the 3D voice effect is enabled, users need to use stereo audio playback devices to
hear the anticipated voice effect.
- Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora
recommends calling `setAudioProfile` and setting the `profile` parameter to
`AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before
setting this enumerator.param1
- - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the
3D voice effect. The value range is [1, 60] and the unit is a second. The default value is 10
seconds, indicating that the voice moves around you every 10 seconds.
- If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch
correction effect:
- `1`: (Default) Natural major scale.
- `2`: Natural minor scale.
- `3`: Japanese pentatonic scale.param2
- - You need to set `param2` to `0`.
- If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch
correction effect:
- `1`: A
- `2`: A#
- `3`: B
- `4`: (Default) C
- `5`: C#
- `6`: D
- `7`: D#
- `8`: E
- `9`: F
- `10`: F#
- `11`: G
- `12`: G#public abstract int setVoiceBeautifierParameters(int preset, int param1, int param2)
preset
- The options for SDK preset voice beautifier effects:
- `SINGING_BEAUTIFIER`: Singing beautifier effect.param1
- The gender characteristics options for the singing voice:
- `1`: A male-sounding voice.
- `2`: A female-sounding voice.param2
- The reverberation effects options:
- `1`: The reverberation effect sounds like singing in a small room.
- `2`: The reverberation effect sounds like singing in a large room.
- `3`: The reverberation effect sounds like singing in a hall.setAudioProfile
, and setting the scenario parameter to
`AUDIO_SCENARIO_GAME_STREAMING(3)` and the profile parameter to
`AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`.public abstract int setVoiceConversionParameters(int preset, int param1, int param2)
preset
- The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET.param1
- reserved.param2
- reserved.public abstract int enableSoundPositionIndication(boolean enabled)
enabled
- Sets whether or not to enable stereo panning for remote users:
- true: enables stereo panning.
- false: disables stereo panning.public abstract int setRemoteVoicePosition(int uid, double pan, double gain)
uid
- The ID of the remote user.pan
- The sound position of the remote user. The value ranges from -1.0 to 1.0:
- 0.0: the remote sound comes from the front.
- -1.0: the remote sound comes from the left.
- 1.0: the remote sound comes from the right.gain
- Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is
100.0 (the original gain of the remote user). The smaller the value, the less the gain.public abstract int startAudioMixing(java.lang.String filePath, boolean loopback, int cycle)
onAudioMixingStateChanged
(AUDIO_MIXING_STATE_PLAYING) callback on the local client. When the
audio mixing file playback finishes, the SDK triggers the onAudioMixingStateChanged
(AUDIO_MIXING_STATE_STOPPED) callback on the local client.filePath
- Specifies the absolute path (including the suffixes of the filename) of the
local or online audio file to be mixed.
For example, `/sdcard/emulated/0/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp,
mkv, and wav.
- If the path begins with /assets/, the audio file is in the /assets/ directory.
- Otherwise, the audio file is in the absolute path.loopback
- Sets which user can hear the audio mixing:
- true: Only the local user can hear the audio mixing.
- false: Both users can hear the audio mixing.cycle
- Sets the number of playback loops:
- Positive integer: Number of playback loops.
- -1: Infinite playback loops.WARN_AUDIO_MIXING_OPEN_ERROR (701)
: If the
local audio file does not exist, or the online audio packet is not received within five seconds
after it is opened, the SDK assumes that the media file cannot be used and returns this
warning.public abstract int enableSpatialAudio(boolean enabled)
public abstract int setRemoteUserSpatialAudioParams(int uid, SpatialAudioParams params)
public abstract int setRemoteVideoSubscriptionOptions(int uid, VideoSubscriptionOptions options)
public abstract int startAudioMixing(java.lang.String filePath, boolean loopback, int cycle, int startPos)
onAudioMixingStateChanged
(AUDIO_MIXING_STATE_PLAYING) callback on the local client. When the
audio mixing file playback finishes, the SDK triggers the onAudioMixingStateChanged
(AUDIO_MIXING_STATE_STOPPED) callback on the local client.filePath
- Specifies the absolute path (including the suffixes of the filename) of the
local or online audio file to be mixed.
For example, `/sdcard/emulated/0/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp,
mkv, and wav.
- If the path begins with /assets/, the audio file is in the /assets/ directory.
- Otherwise, the audio file is in the absolute path.loopback
- Sets which user can hear the audio mixing:
- true: Only the local user can hear the audio mixing.
- false: Both users can hear the audio mixing.cycle
- Sets the number of playback loops:
- Positive integer: Number of playback loops.
- -1: Infinite playback loops.startPos
- The playback position (ms) of the music file.WARN_AUDIO_MIXING_OPEN_ERROR (701)
: If the
local audio file does not exist, or the online audio packet is not received within five seconds
after it is opened, the SDK assumes that the media file cannot be used and returns this
warning.public abstract int stopAudioMixing()
public abstract int pauseAudioMixing()
public abstract int resumeAudioMixing()
public abstract int adjustAudioMixingVolume(int volume)
volume
- Audio mixing volume. The value ranges between 0 and 100 (default).public abstract int adjustAudioMixingPlayoutVolume(int volume)
volume
- Audio mixing volume for local playback. The value ranges between 0 and 100
(default).public abstract int adjustAudioMixingPublishVolume(int volume)
volume
- Audio mixing volume for publishing. The value ranges between 0 and 100 (default).public abstract int getAudioMixingPlayoutVolume()
public abstract int getAudioMixingPublishVolume()
public abstract int getAudioMixingDuration()
public abstract int getAudioMixingCurrentPosition()
public abstract int setAudioMixingPosition(int pos)
pos
- The playback starting position (ms) of the audio mixing file.public abstract int setAudioMixingDualMonoMode(Constants.AudioMixingDualMonoMode mode)
mode
- The mode of channel modepublic abstract int setAudioMixingPitch(int pitch)
pitch
- The pitch of the music file.public abstract int selectAudioTrack(int audioIndex)
audioIndex
- Audio track index. The value begin from 0.public abstract int getAudioTrackCount()
public abstract IAudioEffectManager getAudioEffectManager()
public abstract int startAudioRecording(java.lang.String filePath, int quality)
Starts an audio recording.
The SDK allows recording during a call, which supports either one of the following formats:
Ensure that the directory to save the recording file exists and is writable.
This method is usually called after the
joinChannel
method. The recording
automatically stops when the
leaveChannel
method is called.
filePath
- Full file path of the recording file. The string of the file
name is in UTF-8 code.quality
- Audio recording quality:
public abstract int startAudioRecording(io.agora.rtc2.internal.AudioRecordingConfiguration config)
Starts an audio recording.
The SDK allows recording during a call, which supports either one of the following formats:
Ensure that the directory to save the recording file exists and is writable.
This method is usually called after the
joinChannel
method. The recording
automatically stops when the
leaveChannel
method is called.
config
- audio file recording configpublic abstract int stopAudioRecording()
Stops the audio recording on the client.
Note: Call this method before calling leaveChannel
, otherwise the recording automatically stops when the
leaveChannel
method is called.
@Deprecated public abstract int startEchoTest()
#startEchoTest(int)
Starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
In the test, the user first speaks, and the recording is played back in 10 seconds. If the user can hear the recording in 10 seconds, it indicates that the audio devices and network connection work properly.
Note: After calling the startEchoTest
method, call stopEchoTest
to end the test;
otherwise the application cannot run the next echo test, nor can it call the
joinChannel
method to start a new call.
public abstract int startEchoTest(int intervalInSeconds)
intervalInSeconds
- The time interval (s) between when you speak and when the recording
plays back.In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
public abstract int startEchoTest(EchoTestConfiguration config)
config
- The configuration of the echo test.public abstract int stopEchoTest()
ERR_REFUSED(-5)
. Failed to stop the
echo test. The echo test may not be running.
public abstract int startLastmileProbeTest(io.agora.rtc2.internal.LastmileProbeConfig config)
onLastmileProbeResult
callback within 30 seconds,
and reports the real-time statistics of the network conditions.
Call this method to check the uplink network quality before users join a channel or before an
audience switches to a host.config
- The configurations of the last-mile network probe test. For details, see
LastmileProbeConfig
.public abstract int stopLastmileProbeTest()
public abstract int enableEchoCancellationExternal(boolean enabled, int audioSourceDelay)
public abstract int setExternalAudioSink(boolean enabled, int sampleRate, int channels)
enabled
- Sets whether or not to the external audio sink.
- true: Enables the external audio sink.
- false: Disables the external audio sink.sampleRate
- The sample rate (Hz) of the external audio sink. You can set this parameter
as 16000, 32000, 44100, or 48000.channels
- The number of audio channels of the external audio sink:
- 1: Mono.
- 2: Stereo.public abstract int pushCaptureAudioFrame(byte[] data)
public abstract int pushCaptureAudioFrame(java.nio.ByteBuffer data, int lengthInByte)
public abstract int pushReverseAudioFrame(byte[] data)
public abstract int pushReverseAudioFrame(java.nio.ByteBuffer data, int lengthInByte)
public abstract int pullPlaybackAudioFrame(byte[] data, int lengthInByte)
RtcEngine#setExternalAudioSink(bool, int,
int)
method to enable and set the external audio sink.
Ensure that you call this method after joining a channel.
After a successful method call, the app pulls the decoded and mixed audio data for playback.data
- The audio data that you want to pull. The data format is in byte[].lengthInByte
- The data length (byte) of the external audio data. The value of this
parameter is related to the audio duration, and the values of the `sampleRate` and
`channels` parameters that you set in setExternalAudioSink
. Agora recommends setting the audio duration no shorter than 10 ms.
The formula for `lengthInByte` is: public abstract int pullPlaybackAudioFrame(java.nio.ByteBuffer data, int lengthInByte)
setExternalAudioSink
(enabled: true) method to enable and set the external audio sink.
Ensure that you call this method after joining a channel.
After a successful method call, the app pulls the decoded and mixed audio data for playback.data
- The audio data that you want to pull. The data format is in ByteBuffer.lengthInByte
- The data length (byte) of the external audio data. The value of this
parameter is related to the audio duration, and the values of the `sampleRate` and
`channels` parameters that you set in setExternalAudioSink
. Agora recommends setting the audio duration no shorter than 10 ms.
The formula for `lengthInByte` is: public abstract int startRecordingDeviceTest(int indicationInterval)
indicationInterval
- The time interval (ms) between which the SDK triggers
the \ref IRtcEngineEventHandler::onAudioVolumeIndication
"onAudioVolumeIndication()" callback.public abstract int stopRecordingDeviceTest()
public abstract int setExternalAudioSource(boolean enabled, int sampleRate, int channels)
enabled
- Determines whether to enable the external audio source:
- true: Enable the external audio source.
- false: (default) Disable the external audio source.sampleRate
- The Sample rate (Hz) of the external audio source, which can set be as
8000, 16000, 32000, 44100, or 48000.channels
- The number of channels of the external audio source, which can be set as 1 or
2:
- 1: Mono.
- 2: Stereo.public abstract int setExternalAudioSource(boolean enabled, int sampleRate, int channels, int sourceNumber, boolean localPlayback, boolean publish)
enabled
- Determines whether to enable the external audio source:
- true: Enable the external audio source.
- false: (default) Disable the external audio source.sampleRate
- The Sample rate (Hz) of the external audio source, which can set be as
8000, 16000, 32000, 44100, or 48000.channels
- The number of channels of the external audio source, which can be set as 1 or
2:
- 1: Mono.
- 2: Stereo.sourceNumber
- The number of audio source per channel.
- 1: Mono.
- 2: Stereo.public abstract int setDirectExternalAudioSource(boolean enabled)
enabled
- Determines whether to enable the direct external audio source:
- true: Enable the direct external audio source.
- false: (default) Disable the direct external audio source.public abstract int setDirectExternalAudioSource(boolean enabled, boolean localPlayback)
enabled
- Determines whether to enable the direct external audio source:
- true: Enable the direct external audio source.
- false: (default) Disable the direct external audio source.localPlayback
- Determines whether to enable the local playback of the direct external
audio sourcepublic abstract int pushDirectAudioFrame(java.nio.ByteBuffer data, long timestamp, int sampleRate, int channels)
data
- The audio buffer data.timestamp
- The timestamp of the audio data.sampleRate
- The sample rate of the audio data, which can be set as 8000, 16000, 32000,
44100, or 48000 Hz.channels
- The number of the audio data, which can be set as 1 or 2:
- 1: Mono.
- 2: Stereo.public abstract int pushExternalAudioFrame(byte[] data, long timestamp)
data
- The audio buffer data.timestamp
- The timestamp of the audio data.public abstract int pushExternalAudioFrame(java.nio.ByteBuffer data, long timestamp, int sourceId)
data
- The audio buffer data.timestamp
- The timestamp of the audio data.sourceId
- The audio track ID.public abstract int setExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType)
enable
- Determines whether to enable the external video source.
- true: Enable the external video source. Once set, the SDK creates the external source and
prepares video data from `pushExternalVideoFrame` or `pushExternalEncodedVideoImage`.
- false: Disable the external video source.useTexture
- Determines whether to use textured video data.
- true: Use texture, which is not supported now.
- False: Do not use texture.sourceType
- Determines whether the external video source is encoded.
- VIDEO_FRAME(0)
: The external video source is not
encoded.
- ENCODED_VIDEO_FRAME(1)
: The external video source
is encoded.public abstract int setExternalVideoSource(boolean enable, boolean useTexture, Constants.ExternalVideoSourceType sourceType, EncodedVideoTrackOptions encodedOpt)
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.@Deprecated public abstract boolean pushExternalVideoFrame(AgoraVideoFrame frame)
AgoraVideoFrame
class and passes the video frame to the Agora SDK.
Call the setExternalVideoSource
method and
set `pushMode` as `true` before calling this method. Otherwise, a failure returns after calling
this method.frame
- Video frame to be pushed. See AgoraVideoFrame
.public abstract boolean pushExternalVideoFrame(VideoFrame frame)
setExternalVideoSource
method and
set `pushMode` as `true` before calling this method. Otherwise, a failure returns after calling
this method.frame
- Video frame to be pushed. See VideoFrame
:
- `buffer`: *Buffer* The buffer of the video frame.
- `rotation`: *int* Rotation of the video frame in degrees.
- `timestampNs`: *long* Timestamp of the video frame in nanoseconds.public abstract int pushExternalEncodedVideoFrame(java.nio.ByteBuffer data, EncodedVideoFrameInfo frameInfo)
data
- The encoded external video data, which must be the direct buffer.frameInfo
- The encoded external video frame info: EncodedVideoFrameInfo
.public abstract boolean isTextureEncodeSupported()
public abstract int registerAudioFrameObserver(IAudioFrameObserver observer)
observer
- The IAudioFrameObserver interface, null means unregistering observer instead.public abstract int registerAudioEncodedFrameObserver(io.agora.rtc2.internal.AudioEncodedFrameObserverConfig config, IAudioEncodedFrameObserver observer)
observer
- The IAudioEncodedFrameObserver interface, null means unregistering observer
instead.public abstract int setRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall)
onRecordAudioFrame
callback.sampleRate
- Sets the sample rate (`samplesPerSec`) returned in the
`onRecordAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or
48000 Hz.channel
- Sets the number of audio channels (channels) returned in the
`onRecordAudioFrame` callback:
- 1: Mono.
- 2: Stereo.mode
- Sets the use mode of the onRecordAudioFrame callback:
- `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the
audio data without modifying anything. For example, when users acquire the data
with the Agora SDK then push the RTMP streams.
- `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the
data from AudioFrame, modify it, and then play it. For example, when users have
their own sound-effect processing module and perform some voice pre-processing,
such as a voice change.samplesPerCall
- Sets the number of samples the `onRecordAudioFrame` callback returns.
In RTMP streaming scenarios, set it as 1024.public abstract int setPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall)
onPlaybackAudioFrame
callback.sampleRate
- Sets the sample rate (`samplesPerSec`) returned in the
`onPlaybackAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or
48000 Hz.channel
- Sets the number of audio channels (channels) returned in the
`onPlaybackAudioFrame` callback:
- 1: Mono.
- 2: Stereo.mode
- Sets the use mode of the onPlaybackAudioFrame callback:
- `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the
audio data without modifying anything. For example, when users acquire the data
with the Agora SDK then push the RTMP streams.
- `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the
data from AudioFrame, modify it, and then play it. For example, when users have
their own sound-effect processing module and perform some voice pre-processing,
such as a voice change.samplesPerCall
- Sets the number of samples the `onPlaybackAudioFrame` callback returns.
In RTMP streaming scenarios, set it as 1024.public abstract int setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall)
onMixedAudioFrame
callback.sampleRate
- Sets the sample rate (`samplesPerSec`) returned in the
`onMixedAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or
48000 Hz.channel
- Sets the number of audio channels (channels) returned in the
`onPlaybackAudioFrame` callback:
- 1: Mono.
- 2: Stereo.samplesPerCall
- Sets the number of samples the `onMixedAudioFrame` callback returns.
In RTMP streaming scenarios, set it as 1024.public abstract int setEarMonitoringAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall)
onEarMonitoringAudioFrame
callback.sampleRate
- Sets the sample rate (`samplesPerSec`) returned in the
`onEarMonitoringAudioFrame` callback, which can be set as 8000, 16000, 32000, 44100, or
48000 Hz.channel
- Sets the number of audio channels (channels) returned in the
`onEarMonitoringAudioFrame` callback:
- 1: Mono.
- 2: Stereo.mode
- Sets the use mode of the onEarMonitoringAudioFrame callback:
- `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: Read-only mode: Users only read the
audio data without modifying anything. For example, when users acquire the data
with the Agora SDK then push the RTMP streams.
- `RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY(1)`: Write-only mode: Users replace the
audio data with their own data and pass the data to the SDK for encoding.
For example, when users acquire the data.
- `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode: Users read the
data from AudioFrame, modify it, and then play it. For example, when users have
their own sound-effect processing module and perform some voice pre-processing,
such as a voice change.samplesPerCall
- Sets the number of samples the `onEarMonitoringAudioFrame` callback
returns.
In RTMP streaming scenarios, set it as 1024.@Deprecated public abstract int addVideoWatermark(AgoraImage watermark)
addVideoWatermark
2 method instead.
This method adds a PNG watermark image to the local video stream for the sampling device,
channel audience, or CDN live audience to see and capture. To add the PNG file to a CDN live
publishing stream, see the setLiveTranscoding
method.watermark
- Watermark image to be added to the local video stream. See Agora Image
.public abstract int addVideoWatermark(java.lang.String watermarkUrl, WatermarkOptions options)
watermarkUrl
- The local file path of the watermark image to be added. This method
supports adding a watermark image from either the local file path or the assets file path.
If you use the assets file path, you need to start with `/assets/` when filling in this
parameter.options
- The options of the watermark image to be added. See Watermark Options
.addVideoWatermark
1.
This method adds a PNG watermark image to the local video stream in a live streaming. Once the
watermark image is added, all the audience in the channel (CDN audience included), and the
sampling device can see and capture it.
Agora supports adding only one watermark image onto the local video, and the newly watermark
image replaces the previous one.
The watermark position depends on the settings in the setVideoEncoderConfiguration
method:
- If the orientation mode of the encoding video is ORIENTATION_MODE_FIXED_LANDSCAPE, or the
landscape mode in ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation.
- If the orientation mode of the encoding video is ORIENTATION_MODE_FIXED_PORTRAIT, or the
portrait mode in ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation.
- When setting the watermark position, the region must be less than the dimensions set in the
setVideoEncoderConfiguration method. Otherwise, the watermark image will be cropped.public abstract int clearVideoWatermarks()
addVideoWatermark
.public abstract int setRemoteUserPriority(int uid, int userPriority)
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.
Use this method with the
setRemoteSubscribeFallbackOption
method. If the fallback function is
enabled for a subscribed stream, the SDK ensures the high-priority
user gets the best possible stream quality.
public abstract int setLocalPublishFallbackOption(int option)
STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)
, the SDK will: onLocalPublishFallbackToAudioOnly
.
Ensure that you call this method before joining a channel.option
- The fallback option for the locally published video stream:
- STREAM_FALLBACK_OPTION_DISABLED(0)
: (Default) No fallback behavior for the locally published
video stream when the uplink network condition is poor. The stream quality is not guaranteed.
- STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)
: The locally published video stream falls back to audio
only when the uplink network condition is poor.public abstract int setRemoteSubscribeFallbackOption(int option)
STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)
, the SDK automatically switches the video from a
high-stream to a low-stream, or disables the video when the downlink network condition cannot
support both audio and video to guarantee the quality of the audio. The SDK monitors the
network quality and restores the video stream when the network conditions improve. When the
remotely subscribed video stream falls back to audio only, or the audio-only stream switches
back to the video, the SDK triggers the onRemoteSubscribeFallbackToAudioOnly
callback.
Ensure that you call this method before joining a channel.option
- The fallback option for the remotely subscribed video stream:
- STREAM_FALLBACK_OPTION_DISABLED(0)
: No fallback behavior for the remotely subscribed video
stream when the downlink network condition is poor. The quality of the video stream is not
guaranteed.
- STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW(1)
: (Default) The remotely subscribed video stream
falls back to the low-stream video when the downlink network condition worsens. This option
works only for this method and not for the setLocalPublishFallbackOption
method.
- STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)
: Under poor downlink network conditions, the remotely
subscribed video stream first falls back to the low-stream video; and then to an audio-only
stream if the network condition worsens.public abstract int enableDualStreamMode(boolean enabled)
setRemoteVideoStreamType
.enabled
- - true: Enable the dual-stream mode.
- false: (default) Disable the dual-stream mode.public abstract int enableDualStreamMode(boolean enabled, SimulcastStreamConfig streamConfig)
setRemoteVideoStreamType
.enabled
- - true: Enable the dual-stream mode.
- false: (default) Disable the dual-stream mode.streamConfig
- - The minor stream configpublic abstract int setDualStreamMode(Constants.SimulcastStreamMode mode)
setRemoteVideoStreamType
.mode
- - The dual-stream modepublic abstract int setDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig)
setRemoteVideoStreamType
.mode
- - The dual-stream modestreamConfig
- - The minor stream configpublic abstract int setRemoteVideoStreamType(int uid, int streamType)
uid
- ID of the remote user sending the video stream.streamType
- Sets the video stream type:
- 0: High-stream video.
- 1: Low-stream video.public abstract int setRemoteDefaultVideoStreamType(int streamType)
streamType
- Sets the default video stream type:
- 0: High-stream video.
- 1: Low-stream video.public abstract int setSubscribeAudioBlacklist(int[] uidList)
uidList
- The id list of users who do not subscribe to audio.public abstract int setSubscribeAudioWhitelist(int[] uidList)
uidList
- The id list of users who do subscribe to audio.public abstract int setSubscribeVideoBlacklist(int[] uidList)
uidList
- The id list of users who do not subscribe to video.public abstract int setSubscribeVideoWhitelist(int[] uidList)
uidList
- The id list of users who do subscribe to video.@Deprecated public abstract int setEncryptionSecret(java.lang.String secret)
All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user has left the channel. If the encryption password is not specified or set to empty, the encryption function will be disabled.
Note: Do not use this function together with CDN.
Specifies an encryption password to enable built-in encryption before joining a channel.
secret
- Encryption Password@Deprecated public abstract int setEncryptionMode(java.lang.String encryptionMode)
The Agora Native SDK supports built-in encryption. Call this API to set the encryption mode.
All users in the same channel must use the same encryption mode and password. Refer to information related to the encryption algorithm on the differences between encryption modes.
Call setEncryptionSecret
to enable the built-in encryption function before calling this API.
Note: Do not use this function together with CDN.
Sets the built-in encryption mode.
encryptionMode
- Encryption mode:
public abstract int enableEncryption(boolean enabled, io.agora.rtc2.internal.EncryptionConfig config)
enabled
- Whether to enable the built-in encryption.
- `true`: Enable the built-in encryption.
- `false`: Disable the built-in encryption.config
- Configurations of built-in encryption schemas. See EncryptionConfig
.public abstract int startRtmpStreamWithoutTranscoding(java.lang.String url)
url
- The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024
bytes.public abstract int startRtmpStreamWithTranscoding(java.lang.String url, LiveTranscoding transcoding)
url
- The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024
bytes.transcodingEnabled
- Sets whether transcoding is enabled/disabled:
- true: Enable transcoding. To
[transcode](https://docs.agora.io/en/Agora%20Platform/terms?platform=All%20Platforms#transcoding)
the audio or video streams when publishing them to CDN live, often used for combining the audio
and video streams of multiple hosts in CDN live.
- false: Disable transcoding.public abstract int updateRtmpTranscoding(LiveTranscoding transcoding)
transcoding
- Sets the CDN live audio/video transcoding settings. See LiveTranscoding.public abstract int stopRtmpStream(java.lang.String url)
url
- The RTMP URL address to be removed. The maximum length of this parameter is 1024
bytes.public abstract int createDataStream(boolean reliable, boolean ordered)
reliable
- Sets whether the recipients are guaranteed to receive
the data stream from the sender within five seconds:
- true: The recipients receive the data stream from the sender within
five seconds. If the recipient does not receive the data stream within
five seconds, an error is reported to the application.
- false: There is no guarantee that the recipients receive the data stream
within five seconds and no error message is reported for any delay or
missing data stream.ordered
- Sets whether the recipients receive the data stream
in the sent order:
- true: The recipients receive the data stream in the sent order.
- false: The recipients do not receive the data stream in the sent order.public abstract int createDataStream(DataStreamConfig config)
config
- The config of data stream.Error Codes
. For example, if it returns -2, then it
indicates ERR_INVALID_ARGUMENT(-2)
in Error Codes
.public abstract int sendStreamMessage(int streamId, byte[] message)
RtcEngine#createDataStream() createDataStream
, you can call
this method to send a data stream to all users in the channel.
The SDK has the following restrictions on this method:
- Up to 60 packets can be sent per second in a channel with each packet having a maximum size
of 1 KB.
- Each client can send up to 30 KB of data per second.
- Each user can have up to five data streams simultaneously.
After the remote user receives the data stream within 5 seconds, the SDK triggers the onStreamMessage
callback on the remote client. After
the remote user does not receive the data stream within 5 seconds, the SDK triggers the onStreamMessageError
callback.streamId
- ID of the sent data stream returned by the createDataStream
method.message
- Sent data.public abstract int setVideoQualityParameters(boolean preferFrameRateOverImageQuality)
preferFrameRateOverImageQuality
- The video preference to be set:
@Deprecated public abstract int setLocalVideoMirrorMode(int mode)
startPreview
method, or the mirror mode
does not take effect until you call the `startPreview` method again.mirrorMode
- Sets the local video mirror mode:
- `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK.
If you use the front camera, the SDK enables the mirror mode;
if you use the rear camera, the SDK disables the mirror mode.
- `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode.
- `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.@Deprecated public static int getRecommendedEncoderType()
HARDWARE ENCODER(1)
: The hardware encoder.SOFTWARE ENCODER(2)
: The software encoder.public abstract int switchCamera()
public abstract boolean isCameraZoomSupported()
public abstract boolean isCameraTorchSupported()
public abstract boolean isCameraFocusSupported()
public abstract boolean isCameraExposurePositionSupported()
public abstract boolean isCameraAutoFocusFaceModeSupported()
public abstract boolean isCameraFaceDetectSupported()
public abstract int setCameraZoomFactor(float factor)
factor
- The camera zoom factor. It ranges from 1.0 to the maximum zoom
supported by the camera.public abstract float getCameraMaxZoomFactor()
public abstract int setCameraFocusPositionInPreview(float positionX, float positionY)
positionX
- The horizontal coordinate of the touch point in the view.positionY
- The vertical coordinate of the touch point in the view.public abstract int setCameraExposurePosition(float positionXinView, float positionYinView)
onCameraExposureAreaChanged
callback
on the local client.positionXinView
- The horizontal coordinate of the touch point in the view.positionYinView
- The vertical coordinate of the touch point in the view.public abstract int enableFaceDetection(boolean enabled)
enabled
- Determines whether to enable the camera face detect.
- true: Enable the face detect.
- false: Do not enable the face detect.public abstract int setCameraTorchOn(boolean isOn)
isOn
- Determines whether to enable the camera flash.
- true: Enable the flash.
- false: Do not enable the flash.public abstract int setCameraAutoFocusFaceModeEnabled(boolean enabled)
enabled
- Determines whether to enable the camera auto focus face mode.
- true: Enable the auto focus face function.
- false: Do not enable the auto focus face function.public abstract java.lang.String getCallId()
public abstract int rate(java.lang.String callId, int rating, java.lang.String description)
callId
- The call ID retrieved from the getCallId
method.rating
- The rating of the call between 1 (the lowest score) to 5 (the highest score).description
- (Optional) The description of the rating. The string length must be less
than 800 bytes.public abstract int complain(java.lang.String callId, java.lang.String description)
callId
- The call ID retrieved from the `getCallId` method.description
- (Optional) The description of the complaint. The string length must be less
than
800 bytes.public static java.lang.String getSdkVersion()
@Deprecated public static java.lang.String getMediaEngineVersion()
public abstract int setLogFile(java.lang.String filePath)
filePath
- File path of the log file. The string of the log file is in UTF-8.public abstract int setLogFilter(int filter)
filter
- Sets the log filter level:
- `LOG_FILTER_DEBUG(0x80f)`: Output all API logs. Set your log filter as DEBUG
if you want to get the most complete log file.
- `LOG_FILTER_INFO(0x0f)`: Output logs of the CRITICAL, ERROR, WARNING, and INFO
level. We recommend setting your log filter as this level.
- `LOG_FILTER_WARNING(0x0e)`: Output logs of the CRITICAL, ERROR, and WARNING level.
- `LOG_FILTER_ERROR(0x0c)`: Output logs of the CRITICAL and ERROR level.
- `LOG_FILTER_CRITICAL(0x08)`: Output logs of the CRITICAL level.
- `LOG_FILTER_OFF(0)`: Do not output any log.public abstract int setLogLevel(int level)
level
- Sets the log level:
LogLevel
.public abstract int setLogFileSize(long fileSizeInKBytes)
fileSizeInKBytes
- The SDK log file size (KB).public abstract java.lang.String uploadLogFile()
public abstract long getNativeHandle()
Returns the native handler of the SDK Engine.
This interface is used to get native the C++ handler of the SDK engine that can be used in special scenarios, such as register the audio and video frame observer.
public abstract long getNativeMediaPlayer(int sourceId)
Returns the native handler of the mediaplayer.
public void addHandler(IRtcEngineEventHandler handler)
handler
- The IRtcEngineEventHandler instance.public void removeHandler(IRtcEngineEventHandler handler)
handler
- The IRtcEngineEventHandler object.@Deprecated public abstract boolean enableHighPerfWifiMode(boolean enable)
enable
- Whether to enable/disable the Wi-Fi mode:
- `true`: Enable the Wi-Fi mode.
- `false`: Disable the Wi-Fi mode.public static java.lang.String getErrorDescription(int error)
error
- The warning or error code.@Deprecated public abstract void monitorHeadsetEvent(boolean monitor)
monitor
- Whether to enable monitoring external headset device events.
True/False.@Deprecated public abstract void monitorBluetoothHeadsetEvent(boolean monitor)
monitor
- Whether to enable monitoring Bluetooth headset device events.
True/False.@Deprecated public abstract void setPreferHeadset(boolean enabled)
enabled
- Sets whether or not the default audio route is to the headset:
public abstract int setParameters(java.lang.String parameters)
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
parameters
- Parameter to be set as a JSON string in the specified
format.public abstract java.lang.String getParameters(java.lang.String parameters)
parameters
- JSON stringpublic abstract java.lang.String getParameter(java.lang.String parameter, java.lang.String args)
public abstract int registerMediaMetadataObserver(IMetadataObserver observer, int type)
getMaxMetadataSize
callback.observer
- The IMetadataObserver class.type
- The metadata type. Currently, the SDK supports VIDEO_METADATA(0)
only.
- UNKNOWN_METADATA(-1)
: the
metadata type is unknown.
- VIDEO_METADATA(0)
: the metadata
type is video.public abstract int unregisterMediaMetadataObserver(IMetadataObserver observer, int type)
observer
- The IMetadataObserver class.type
- The metadata type. Currently, the SDK supports VIDEO_METADATA(0)
only.public abstract int startChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration)
onChannelMediaRelayStateChanged
and
onChannelMediaRelayEvent
callbacks, and
these callbacks return the state and events of the media stream relay.
- If the `onChannelMediaRelayStateChanged` callback returns `RELAY_STATE_RUNNING(2)` and
`RELAY_OK(0)`, and the `onChannelMediaRelayEvent` callback returns
`RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4)`, the SDK starts relaying media streams between the
original and the destination channel.
- If the `onChannelMediaRelayStateChanged` callback returns `RELAY_STATE_FAILURE(3)`, an
exception occurs during the media stream relay.channelMediaRelayConfiguration
- The configuration of the media stream relay. See ChannelMediaRelayConfiguration
.public abstract int stopChannelMediaRelay()
onChannelMediaRelayStateChanged
callback. If the callback returns `RELAY_STATE_IDLE(0)` and `RELAY_OK(0)`, the broadcaster
successfully stops the relay.public abstract int updateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration)
onChannelMediaRelayEvent
callback with the
RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7) state code.channelMediaRelayConfiguration
- The media stream relay configuration: ChannelMediaRelayConfiguration
.public abstract int pauseAllChannelMediaRelay()
public abstract int resumeAllChannelMediaRelay()
public abstract int updateChannelMediaOptions(ChannelMediaOptions options)
options
- The channel media options: ChannelMediaOptions.public abstract int muteRecordingSignal(boolean muted)
muted
- Determines whether to mute or resume the recording signal volume.
- true: Mute the recording signal volume.
- false: (Default) Resume the recording signal volume.public abstract int setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel)
onPlaybackAudioFrameBeforeMixing
callback.sampleRate
- Sets the sample rate (`samplesPerSec`) returned in the
`onPlaybackAudioFrameBeforeMixing` callback, which can be set as 8000, 16000, 32000, 44100, or
48000 Hz.channel
- Number of channels of the audio data returned in
`onPlaybackAudioFrameBeforeMixing`,
which can be set as 1 or 2:
- 1: Mono
- 2: Stereopublic abstract int enableAudioSpectrumMonitor(int intervalInMS)
intervalInMS
- Sets the time interval(ms) between two consecutive audio spectrum callback.
The default value is 100. This param should be larger than 10.public abstract int disableAudioSpectrumMonitor()
public abstract int registerAudioSpectrumObserver(IAudioSpectrumObserver observer)
observer
- A pointer to the audio spectrum observer: \ref
agora::media::IAudioSpectrumObserver
"IAudioSpectrumObserver".public abstract int unRegisterAudioSpectrumObserver(IAudioSpectrumObserver observer)
observer
- The pointer to the audio spectrum observer: \ref
agora::media::IAudioSpectrumObserver
"IAudioSpectrumObserver".public abstract double getEffectsVolume()
public abstract int setEffectsVolume(double volume)
volume
- The volume of audio effects. The value ranges between 0.0
and 100.0 (default).public abstract int preloadEffect(int soundId, java.lang.String filePath)
RtcEngine#playEffect() playEffect
to play the preloaded
audio effect or call
RtcEngine#playAllEffects() playAllEffects
to play all the preloaded audio effects.soundId
- The ID of the audio effect.filePath
- The absolute path of the local audio effect file or the URL
of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac,
3gp, mkv and wav.public abstract int preloadEffect(int soundId, java.lang.String filePath, int startPos)
RtcEngine#playEffect() playEffect
to play the preloaded
audio effect or call
RtcEngine#playAllEffects() playAllEffects
to play all the preloaded audio effects.soundId
- The ID of the audio effect.filePath
- The absolute path of the local audio effect file or the URLstartPos
- The start position
of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac,
3gp, mkv and wav.public abstract int playEffect(int soundId, java.lang.String filePath, int loopCount, double pitch, double pan, double gain, boolean publish)
preloadEffect
, you can call
this method to play the specified audio effect for all users in
the channel.
This method plays only one specified audio effect each time it is called.
To play multiple audio effects, call this method multiple times.soundId
- The ID of the audio effect.filePath
- The absolute path of the local audio effect file or the URL
of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac,
3gp, mkv and wav.loopCount
- The number of times the audio effect loops:
- `-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 ranges between 0.0 and 100.0.
The default value is 100 (original volume). The lower the value, the lower
the volume of the audio effect.publish
- Sets whether to publish the specified audio effect to the remote
stream:
- True: Publish the audio effect to the remote.
- False: false: Do not publish the audio effect to the remote.public abstract int playEffect(int soundId, java.lang.String filePath, int loopCount, double pitch, double pan, double gain, boolean publish, int startPos)
preloadEffect
, you can call
this method to play the specified audio effect for all users in
the channel.
This method plays only one specified audio effect each time it is called.
To play multiple audio effects, call this method multiple times.soundId
- The ID of the audio effect.filePath
- The absolute path of the local audio effect file or the URL
of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac,
3gp, mkv and wav.loopCount
- The number of times the audio effect loops:
- `-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 ranges between 0.0 and 100.0.
The default value is 100 (original volume). The lower the value, the lower
the volume of the audio effect.publish
- Sets whether to publish the specified audio effect to the remote
stream:
- True: Publish the audio effect to the remote.
- False: false: Do not publish the audio effect to the remote.startPos
- The start positionpublic abstract int playAllEffects(int loopCount, double pitch, double pan, double gain, boolean publish)
preloadEffect
multiple times
to preload multiple audio effects into the memory, you can call this
method to play all the specified audio effects for all users in
the channel.loopCount
- The number of times the audio effect loops:
- `-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 ranges between 0.0 and 100.0.
The default value is `100` (original volume). The lower the value, the lower
the volume of the audio effect.publish
- Sets whether to publish the specified audio effect to the remote
stream:
- True: Publish the audio effect to the remote.
- False: Do not publish the audio effect to the remote.public abstract int getVolumeOfEffect(int soundId)
soundId
- The ID of the audio effect.public abstract int setVolumeOfEffect(int soundId, double volume)
soundId
- The ID of the audio effect.volume
- The volume of the specified audio effect. The value ranges between 0.0 and 100.0
(default).public abstract int pauseEffect(int soundId)
soundId
- The ID of the audio effect.public abstract int pauseAllEffects()
public abstract int resumeEffect(int soundId)
soundId
- The ID of the audio effect.public abstract int resumeAllEffects()
public abstract int stopEffect(int soundId)
soundId
- The ID of the audio effect.public abstract int stopAllEffects()
public abstract int unloadEffect(int soundId)
soundId
- The ID of the audio effect.public abstract int unloadAllEffects()
public abstract int getEffectDuration(java.lang.String filePath)
filePath
- The file path of a local file, including the filename extensions.
Agora supports using a URI address, an absolute path, or a path that starts with /assets/.
**Note**: You might encounter permission issues if you use an absolute path to access a local
file, so Agora recommends using a URI address instead. For example:
"content://com.android.providers.media.documents/document/audio%3A14441".public abstract int setEffectPosition(int soundId, int pos)
soundId
- Audio effect ID. Ensure that this parameter is set to the same value as in
`playEffect`.pos
- The playback position (ms) of the audio effect file.public abstract int getEffectCurrentPosition(int soundId)
soundId
- Audio effect ID. Ensure that this parameter is set to the same value as in
`playEffect`.public abstract int registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver receiver)
receiver
- The IVideoEncodedFrameObserver object: IVideoEncodedFrameObserver
.public abstract int takeSnapshot(int uid, java.lang.String filePath)
public abstract int enableContentInspect(boolean enabled, ContentInspectConfig config)
public abstract int setAudioOptionParams(java.lang.String params)
public abstract java.lang.String getAudioOptionParams()
public abstract int setAudioSessionParams(java.lang.String params)
public abstract java.lang.String getAudioSessionParams()
public abstract int loadExtensionProvider(java.lang.String path)
public abstract int enableExtension(java.lang.String provider, java.lang.String extension, boolean enable)
public abstract int enableExtension(java.lang.String provider, java.lang.String extension, boolean enable, Constants.MediaSourceType sourceType)
public abstract int enableExtension(java.lang.String provider, java.lang.String extension, ExtensionInfo extensionInfo, boolean enable)
provider
- name for provider, e.g. agora.io.extension
- name for extension, e.g. agora.beauty.extensionInfo
- the information for extension.enable
- enable or disable.
- true: enable.
- false: disable.public abstract int setExtensionProperty(java.lang.String provider, java.lang.String extension, java.lang.String key, java.lang.String value)
provider
- filter's vendorextension
- filter's extensionkey
- property's keyvalue
- property's valuepublic abstract int setExtensionProperty(java.lang.String provider, java.lang.String extension, java.lang.String key, java.lang.String value, Constants.MediaSourceType sourceType)
public abstract int setExtensionProperty(java.lang.String provider, java.lang.String extension, ExtensionInfo extensionInfo, java.lang.String key, java.lang.String value)
provider
- name for provider, e.g. agora.io.extension
- name for extension, e.g. agora.beauty.extensionInfo
- the information for extension.key
- key for the property.value
- property value of json format.public abstract java.lang.String getExtensionProperty(java.lang.String provider, java.lang.String extension, java.lang.String key)
provider
- filter's vendorextension
- filter's extensionkey
- property's keypublic abstract java.lang.String getExtensionProperty(java.lang.String provider, java.lang.String extension, java.lang.String key, Constants.MediaSourceType sourceType)
public abstract java.lang.String getExtensionProperty(java.lang.String provider, java.lang.String extension, ExtensionInfo extensionInfo, java.lang.String key)
provider
- name for provider, e.g. agora.io.extension
- name for extension, e.g. agora.beauty.extensionInfo
- the information for extension.key
- key for the property.public abstract int setExtensionProviderProperty(java.lang.String provider, java.lang.String key, java.lang.String value)
provider
- filter's vendorkey
- property's keyvalue
- property's valuepublic abstract int startScreenCapture(ScreenCaptureParameters screenCaptureParameters)
screenCaptureParameters
- The configuration of the screen sharing. See ScreenCaptureParameters
.ERR_SCREEN_CAPTURE_PERMISSION_DENIED(16)
and
ERR_SCREEN_CAPTURE_SYSTEM_NOT_SUPPORTED(2)
. To capture system audio during screen sharing,
ensure that the Android API level is not earlier than 29 as well; otherwise, the SDK reports
the error code ERR_SCREEN_CAPTURE_SYSTEM_AUDIO_NOT_SUPPORTED(3)
.public abstract int stopScreenCapture()
public abstract int updateScreenCaptureParameters(ScreenCaptureParameters screenCaptureParameters)
screenCaptureParameters
- The configuration of the screen sharing. See ScreenCaptureParameters
.
Note: This parameter is only available for scenarios where `captureVideo` is `true`.public abstract int registerVideoFrameObserver(IVideoFrameObserver observer)
IVideoFrameObserver
class in this method, and register callbacks according to your scenarios.
After you successfully register the video frame observer, the SDK triggers the registered
callbacks each time a video frame is received.observer
- Video frame observer object instance. See IVideoFrameObserver
.public abstract IMediaPlayer createMediaPlayer()
IMediaPlayer
public abstract IMediaPlayerCacheManager getMediaPlayerCacheManager()
IMediaPlayer
public abstract int enableExternalAudioSourceLocalPlayback(boolean enabled)
public abstract int adjustCustomAudioPublishVolume(int sourceId, int volume)
sourceId
- custom audio source id.volume
- The volume, range is [0,100]:
0: mute, 100: The original volumepublic abstract int adjustCustomAudioPlayoutVolume(int sourceId, int volume)
sourceId
- custom audio source id.volume
- The volume, range is [0,100]:
0: mute, 100: The original volumepublic abstract int startRhythmPlayer(java.lang.String sound1, java.lang.String sound2, AgoraRhythmPlayerConfig config)
sound1
- The absolute path or URL address (including the filename extensions) of the file
for the downbeat.sound2
- The absolute path or URL address (including the filename extensions) of the file
for the upbeats.{@link
- AgoraRhythmPlayerConfig} The configuration of rhythm player.public abstract int stopRhythmPlayer()
public abstract int configRhythmPlayer(AgoraRhythmPlayerConfig config)
{@link
- AgoraRhythmPlayerConfig} The configuration of rhythm player.public abstract int setDirectCdnStreamingAudioConfiguration(int profile)
profile
- Sets the sample rate, bitrate, encoding mode, and the number of channels:
#AUDIO_PROFILE_TYPE.public abstract int setDirectCdnStreamingVideoConfiguration(VideoEncoderConfiguration config)
config
- The local video encoder configuration: VideoEncoderConfiguration.public abstract long getCurrentMonotonicTimeInMs()
public abstract int startDirectCdnStreaming(IDirectCdnStreamingEventHandler eventHandler, java.lang.String publishUrl, DirectCdnStreamingMediaOptions options)
eventHandler
- A pointer to the direct cdn streaming event handler.
"IDirectCdnStreamingEventHandler".publishUrl
- The url of the cdn used to publish the stream.options
- The direct cdn streaming media options: DirectCdnStreamingMediaOptions.
This API must pass an audio-related option, and temporarily cannot pass more than one.
For video-related options, you can either choose to not pass any, or only one.public abstract int stopDirectCdnStreaming()
public abstract int updateDirectCdnStreamingMediaOptions(DirectCdnStreamingMediaOptions options)
options
- The direct cdn streaming media options: DirectCdnStreamingMediaOptions.public abstract int createCustomVideoTrack()
public abstract int createCustomEncodedVideoTrack(EncodedVideoTrackOptions encodedOpt)
public abstract int destroyCustomVideoTrack(int video_track_id)
video_track_id
- The video track id which was created by createCustomVideoTrackpublic abstract int destroyCustomEncodedVideoTrack(int video_track_id)
video_track_id
- The video track id which was created by createCustomEncodedVideoTrackpublic abstract int setCloudProxy(int proxyType)
onConnectionStateChanged
`(CONNECTION_STATE_CONNECTING,
CONNECTION_CHANGED_SETTING_PROXY_SERVER)` callback.
To disable the cloud proxy that has been set, call `setCloudProxy(NONE_PROXY)`. To change the
cloud proxy type that has been set, call `setCloudProxy(NONE_PROXY)` first, and then call
`setCloudProxy`, and pass the value that you expect in `proxyType`.proxyType
- The cloud proxy type. This parameter is required, and the SDK reports an error
if you do not pass in a value. The cloud proxy types include:
- TRANSPORT_TYPE_NONE_PROXY(0)
- TRANSPORT_TYPE_UDP_PROXY(1)
public abstract int setLocalAccessPoint(LocalAccessPointConfiguration config)
config
- Configurations for local access point. For details, see LocalAccessPointConfiguration
public abstract int enableCustomAudioLocalPlayback(int sourceId, boolean enabled)
sourceId
- custom audio source id.enabled
- Determines whether to local playback the external audio source:
- true: Local playback the external audio source.
- false: Local don`t playback the external audio source.public abstract int SetAdvancedAudioOptions(AdvancedAudioOptions options)
AdvancedAudioOptions
- advanced audio option.public abstract int setAVSyncSource(java.lang.String channelId, int uid)
channelId
- The channel iduid
- The user ID of the remote user to be bound with (local user)public abstract int enableVideoImageSource(boolean enabled, ImageTrackOptions options)
enabled
- true for enable, false for disableoptions
- options for image trackpublic abstract int enableWirelessAccelerate(boolean enabled)
enabled
- - true:Turn WIFI acceleration on.
- false:Turn WIFI acceleration off.public abstract int getNetworkType()
public abstract long getNtpTimeInMs()