Public Member Functions | |
abstract int | setChannelProfile (int profile) |
abstract int | setClientRole (int role) |
abstract int | joinChannel (String token, String channelName, String optionalInfo, int optionalUid) |
abstract int | switchChannel (String token, String channelName) |
abstract int | leaveChannel () |
abstract int | renewToken (String token) |
abstract int | registerLocalUserAccount (String appId, String userAccount) |
abstract int | joinChannelWithUserAccount (String token, String channelName, String userAccount) |
abstract int | getUserInfoByUserAccount (String userAccount, UserInfo userInfo) |
abstract int | getUserInfoByUid (int uid, UserInfo userInfo) |
abstract int | enableWebSdkInteroperability (boolean enabled) |
abstract int | getConnectionState () |
abstract int | enableAudio () |
abstract int | disableAudio () |
abstract int | pauseAudio () |
abstract int | resumeAudio () |
abstract int | setAudioProfile (int profile, int scenario) |
abstract int | setHighQualityAudioParameters (boolean fullband, boolean stereo, boolean fullBitrate) |
abstract int | adjustRecordingSignalVolume (int volume) |
abstract int | adjustPlaybackSignalVolume (int volume) |
abstract int | enableAudioVolumeIndication (int interval, int smooth, boolean report_vad) |
abstract int | enableAudioQualityIndication (boolean enabled) |
abstract int | enableLocalAudio (boolean enabled) |
abstract int | muteLocalAudioStream (boolean muted) |
abstract int | muteRemoteAudioStream (int uid, boolean muted) |
abstract int | adjustUserPlaybackSignalVolume (int uid, int volume) |
abstract int | muteAllRemoteAudioStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteAudioStreams (boolean muted) |
abstract int | enableVideo () |
abstract int | disableVideo () |
abstract int | setVideoProfile (int profile, boolean swapWidthAndHeight) |
abstract int | setVideoProfile (int width, int height, int frameRate, int bitrate) |
abstract int | setVideoEncoderConfiguration (VideoEncoderConfiguration config) |
abstract int | setCameraCapturerConfiguration (CameraCapturerConfiguration config) |
abstract int | setupLocalVideo (VideoCanvas local) |
abstract int | setupRemoteVideo (VideoCanvas remote) |
abstract int | setLocalRenderMode (int renderMode) |
abstract int | setLocalRenderMode (int renderMode, int mirrorMode) |
abstract int | setRemoteRenderMode (int uid, int renderMode) |
abstract int | setRemoteRenderMode (int uid, int renderMode, int mirrorMode) |
abstract int | startPreview () |
abstract int | stopPreview () |
abstract int | enableLocalVideo (boolean enabled) |
abstract int | muteLocalVideoStream (boolean muted) |
abstract int | muteRemoteVideoStream (int uid, boolean muted) |
abstract int | muteAllRemoteVideoStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteVideoStreams (boolean muted) |
abstract int | setBeautyEffectOptions (boolean enabled, BeautyOptions options) |
abstract int | setDefaultAudioRoutetoSpeakerphone (boolean defaultToSpeaker) |
abstract int | setEnableSpeakerphone (boolean enabled) |
abstract boolean | isSpeakerphoneEnabled () |
abstract int | enableInEarMonitoring (boolean enabled) |
abstract int | setInEarMonitoringVolume (int volume) |
abstract int | useExternalAudioDevice () |
abstract int | setLocalVoicePitch (double pitch) |
abstract int | setLocalVoiceEqualization (int bandFrequency, int bandGain) |
abstract int | setLocalVoiceReverb (int reverbKey, int value) |
abstract int | setLocalVoiceChanger (int voiceChanger) |
abstract int | setLocalVoiceReverbPreset (int preset) |
abstract int | enableSoundPositionIndication (boolean enabled) |
abstract int | setRemoteVoicePosition (int uid, double pan, double gain) |
abstract int | startAudioMixing (String filePath, boolean loopback, boolean replace, int cycle) |
abstract int | stopAudioMixing () |
abstract int | pauseAudioMixing () |
abstract int | resumeAudioMixing () |
abstract int | adjustAudioMixingVolume (int volume) |
abstract int | adjustAudioMixingPlayoutVolume (int volume) |
abstract int | adjustAudioMixingPublishVolume (int volume) |
abstract int | getAudioMixingPlayoutVolume () |
abstract int | getAudioMixingPublishVolume () |
abstract int | getAudioMixingDuration () |
abstract int | getAudioMixingCurrentPosition () |
abstract int | setAudioMixingPosition (int pos) |
abstract IAudioEffectManager | getAudioEffectManager () |
abstract int | startAudioRecording (String filePath, int quality) |
abstract int | startAudioRecording (String filePath, int sampleRate, int quality) |
abstract int | stopAudioRecording () |
abstract int | startEchoTest () |
abstract int | startEchoTest (int intervalInSeconds) |
abstract int | stopEchoTest () |
abstract int | enableLastmileTest () |
abstract int | disableLastmileTest () |
abstract int | startLastmileProbeTest (LastmileProbeConfig config) |
abstract int | stopLastmileProbeTest () |
abstract int | setVideoSource (IVideoSource source) |
abstract int | setLocalVideoRenderer (IVideoSink render) |
abstract int | setRemoteVideoRenderer (int uid, IVideoSink render) |
abstract int | setExternalAudioSink (boolean enabled, int sampleRate, int channels) |
abstract int | pullPlaybackAudioFrame (byte[] data, int lengthInByte) |
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels) |
abstract int | pushExternalAudioFrame (byte[] data, long timestamp) |
abstract void | setExternalVideoSource (boolean enable, boolean useTexture, boolean pushMode) |
abstract boolean | pushExternalVideoFrame (AgoraVideoFrame frame) |
abstract boolean | isTextureEncodeSupported () |
abstract int | registerAudioFrameObserver (IAudioFrameObserver observer) |
abstract int | setRecordingAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setPlaybackAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setMixedAudioFrameParameters (int sampleRate, int samplesPerCall) |
abstract int | addVideoWatermark (AgoraImage watermark) |
abstract int | addVideoWatermark (String watermarkUrl, WatermarkOptions options) |
abstract int | clearVideoWatermarks () |
abstract int | setRemoteUserPriority (int uid, int userPriority) |
abstract int | setLocalPublishFallbackOption (int option) |
abstract int | setRemoteSubscribeFallbackOption (int option) |
abstract int | enableDualStreamMode (boolean enabled) |
abstract int | setRemoteVideoStreamType (int uid, int streamType) |
abstract int | setRemoteDefaultVideoStreamType (int streamType) |
abstract int | setEncryptionSecret (String secret) |
abstract int | setEncryptionMode (String encryptionMode) |
abstract int | addInjectStreamUrl (String url, LiveInjectStreamConfig config) |
abstract int | removeInjectStreamUrl (String url) |
abstract int | addPublishStreamUrl (String url, boolean transcodingEnabled) |
abstract int | removePublishStreamUrl (String url) |
abstract int | setLiveTranscoding (LiveTranscoding transcoding) |
abstract int | createDataStream (boolean reliable, boolean ordered) |
abstract int | sendStreamMessage (int streamId, byte[] message) |
abstract int | setVideoQualityParameters (boolean preferFrameRateOverImageQuality) |
abstract int | setLocalVideoMirrorMode (int mode) |
abstract int | switchCamera () |
abstract boolean | isCameraZoomSupported () |
abstract boolean | isCameraTorchSupported () |
abstract boolean | isCameraFocusSupported () |
abstract boolean | isCameraExposurePositionSupported () |
abstract boolean | isCameraAutoFocusFaceModeSupported () |
abstract int | setCameraZoomFactor (float factor) |
abstract float | getCameraMaxZoomFactor () |
abstract int | setCameraFocusPositionInPreview (float positionX, float positionY) |
abstract int | setCameraExposurePosition (float positionXinView, float positionYinView) |
abstract int | setCameraTorchOn (boolean isOn) |
abstract int | setCameraAutoFocusFaceModeEnabled (boolean enabled) |
abstract String | getCallId () |
abstract int | rate (String callId, int rating, String description) |
abstract int | complain (String callId, String description) |
abstract int | setLogFile (String filePath) |
abstract int | setLogFilter (int filter) |
abstract int | setLogFileSize (int fileSizeInKBytes) |
abstract long | getNativeHandle () |
void | addHandler (IRtcEngineEventHandler handler) |
void | removeHandler (IRtcEngineEventHandler handler) |
abstract boolean | enableHighPerfWifiMode (boolean enable) |
abstract void | monitorHeadsetEvent (boolean monitor) |
abstract void | monitorBluetoothHeadsetEvent (boolean monitor) |
abstract void | setPreferHeadset (boolean enabled) |
abstract int | setParameters (String parameters) |
abstract String | getParameter (String parameter, String args) |
abstract int | registerMediaMetadataObserver (IMetadataObserver observer, int type) |
abstract int | startChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration) |
abstract int | stopChannelMediaRelay () |
abstract int | updateChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration) |
abstract int | startDumpVideoReceiveTrack (int uid, String dumpFile) |
abstract int | stopDumpVideoReceiveTrack () |
abstract RtcChannel | createRtcChannel (String channelId) |
Static Public Member Functions | |
static synchronized RtcEngine | create (Context context, String appId, IRtcEngineEventHandler handler) throws Exception |
static synchronized RtcEngine | create (RtcEngineConfig config) throws Exception |
static synchronized void | destroy () |
static SurfaceView | CreateRendererView (Context context) |
static int | getRecommendedEncoderType () |
static String | getSdkVersion () |
static String | getMediaEngineVersion () |
static String | getErrorDescription (int error) |
RtcEngine is the main interface class of the Agora SDK.
Call the methods of this class to use all functionalities of the SDK. We recommend calling the RtcEngine API methods in the same thread instead of in multiple threads. In previous versions, this class was named AgoraAudio, and was renamed to RtcEngine from v1.0.
|
static |
Creates an RtcEngine instance.
Unless otherwise specified, all the methods provided by the RtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread.
context | The context of Android Activity. |
appId | The App ID issued to you by Agora. See How to get the App ID. Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only one RtcEngine instance. To change your App ID, call destroy to destroy the current RtcEngine instance and then call create to create an RtcEngine instance with the new App ID. |
handler | IRtcEngineEventHandler is an abstract class providing default implementation. The SDK uses this class to report to the app on SDK runtime events. |
Exception | Fails to create an RtcEngine instance. |
|
static |
Creates an RtcEngine instance.
Unless otherwise specified, all the methods provided by the RtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread.
config | Configurations for the RtcEngine instance. For details, see RtcEngineConfig. |
Exception | Fails to create an RtcEngine instance. |
|
static |
Destroys the RtcEngine instance and releases all resources used by the Agora SDK.
This method is useful for apps that occasionally make voice or video calls, to free up resources for other operations when not making calls.
|
abstract |
Sets the channel profile of the Agora RtcEngine.
The Agora 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 of the Agora RtcEngine:
|
|
abstract |
Sets the role of a user (Live Broadcast only).
This method sets the role of a user, such as a host or an audience (default), before joining a channel.
This method can be used to switch the user role after a user joins a channel. In the Live Broadcast profile, when a user switches user roles after joining a channel, a successful setClientRole method call triggers the following callbacks:
role | Sets the role of a user:
|
|
abstract |
Allows a user to join a channel.
Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.
You must call the leaveChannel method to exit the current call before joining another channel.
A successful joinChannel method call triggers the following callbacks:
When the connection between the client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the onRejoinChannelSuccess callback on the local client.
token | The token for authentication:
|
channelName | The unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
|
optionalInfo | Additional information about the channel. This parameter can be set as null or contain channel related information. Other users in the channel do not receive this message. |
optionalUid | (Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to (2^32-1). optionalUid must be unique. If optionalUid is not assigned (or set to 0), the SDK assigns and returns uid in the onJoinChannelSuccess callback. Your app must record and maintain the returned uid since the SDK does not do so. |
The uid
is represented as a 32-bit unsigned integer in the SDK. Since unsigned integers are not supported by Java, the uid
is handled as a 32-bit signed integer and larger numbers are interpreted as negative numbers in Java. If necessary, the uid
can be converted to a 64-bit integer through “uid&0xffffffffL”.
uid
. If you set uid
as 0, the system automatically assigns a uid
.
|
abstract |
Switches to a different channel.
This method allows the audience of a Live-broadcast channel to switch to a different channel.
After the user successfully switches to another channel, the onLeaveChannel and onJoinChannelSuccess callbacks are triggered to indicate that the user has left the original channel and joined a new one.
token | The token for authentication:
|
channelName | Unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
|
|
abstract |
Allows a user to leave a channel.
After joining a channel, the user must call the leaveChannel method to end the call before joining another channel. This method returns 0 if the user leaves the channel and releases all resources related to the call. This method call is asynchronous, and the user has not exited the channel when the method call returns. Once the user leaves the channel, the SDK triggers the onLeaveChannel callback.
A successful leaveChannel method call triggers the following callbacks:
|
abstract |
Renews the token when the current token expires.
The token expires after a period of time once the token schema is enabled when:
The app should retrieve a new token from the server and call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
token | The new token. |
|
abstract |
Registers a user account.
Once registered, the user account can be used to identify the local user when the user joins the channel. After the user successfully registers a user account, the SDK triggers the onLocalUserRegistered callback on the local client, reporting the user ID and user account of the local user.
To join a channel with a user account, you can choose either of the following:
The difference between the two is that for the former, the time elapsed between calling the joinChannelWithUserAccount method and joining the channel is shorter than the latter.
userAccount
parameter. Otherwise, this method does not take effect.userAccount
parameter is unique in the channel.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:
|
|
abstract |
Joins the channel with a user account.
After the user successfully joins the channel, the SDK triggers the following callbacks:
token | The token generated at your server:
|
channelName | The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are:
|
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.
|
|
abstract |
Gets the user information by passing in the user account.
After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (UserInfo), and triggers the onUserInfoUpdated callback on the local client.
After receiving the onUserInfoUpdated
callback, you can call this method to get the user ID of the remote user from the userInfo object by passing in the user account.
userAccount | The user account of the user. Ensure that you set this parameter. |
userInfo | [in/out] A userInfo object that identifies the user. For details, see UserInfo.
|
|
abstract |
Gets the user information by passing in the user ID.
After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (UserInfo), and triggers the onUserInfoUpdated callback on the local client.
After receiving the onUserInfoUpdated
callback, you can call this method to get the user ID of the remote user from the userInfo object by passing in the user account.
uid | The user ID of the user. Ensure that you set this parameter. |
userInfo | [in/out] A userInfo object that identifies the user. For details, see UserInfo.
|
|
abstract |
Enables interoperability with the Agora Web SDK (Live Broadcast only).
If the channel has Web SDK users, ensure that you call this method, or the video of the Native user will be a black screen for the Web user.
Use this method when the channel profile is Live Broadcast. Interoperability with the Agora Web SDK is enabled by default when the channel profile is Communication.
enabled | Sets whether to enable/disable interoperability with the Agora Web SDK:
|
|
abstract |
Gets the connection state of the SDK.
|
abstract |
Enables the audio module.
The audio module is enabled by default.
|
abstract |
Disables the audio module.
|
abstract |
Disables the audio function in the channel.
|
abstract |
Resumes the audio playback in the channel.
|
abstract |
Sets the audio parameters and application scenarios.
profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See Audio Profile. |
scenario | Sets the audio application scenarios. See Audio Scenario. Under different audio scenarios, the device uses different volume tracks, i.e. either the in-call volume or the media volume. For details, see What is the difference between the in-call volume and the media volume?. |
profile
as AUDIO_SCENARIO_SHOWROOM(4) and scenario
as AUDIO_SCENARIO_GAME_STREAMING(3). For example, for music education scenarios.
|
abstract |
Sets the high-quality audio preferences.
fullband | Sets whether to enable/disable full-band codec (48-kHz sample rate), not compatible with versions earlier than v1.7.4:
|
stereo | Sets whether to enable/disable stereo codec, not compatible with versions earlier than v1.7.4:
|
fullBitrate | Sets whether to enable/disable high-bitrate mode. Recommended in voice-only mode:
|
|
abstract |
Adjusts the recording volume.
volume
between 0 and 100. If you need to set the value higher than 100, contact suppo first. rt@a gora. iovolume | Recording volume. The value ranges between 0 and 400:
|
|
abstract |
Adjusts the playback volume of all remote users.
adjustPlaybackSignalVolume
and adjustAudioMixingVolume, and set volume
as 0.volume
between 0 and 100. If you need to set the value higher than 100, contact suppo first. rt@a gora. iovolume | The playback volume of all remote users. The value ranges from 0 to 400:
|
|
abstract |
Enables the onAudioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.
Once this method is enabled, the SDK returns the volume indication in the onAudioVolumeIndication callback at the set time interval, regardless of whether any user is speaking in the channel.
interval | Sets the time interval between two consecutive volume indications:
|
smooth | The smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3. |
report_vad |
|
|
abstract |
Enables the audio quality callbacks.
The SDK triggers the onAudioQuality callback after this method is enabled.
enabled | Sets whether to enable/disable the audio quality callback:
|
|
abstract |
Enables/Disables the local audio capture.
The audio function is enabled by default. This method disables/re-enables the local audio function, that is, to stop or restart local audio capture and processing.
This method does not affect receiving or playing the remote audio streams, and enableLocalAudio(false) is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
The SDK triggers the onMicrophoneEnabled callback once the local audio function is disabled or re-enabled.
enabled | Sets whether to disable/re-enable the local audio function:
|
enableLocalAudio
method, the local user may hear a pause in the remote audio playback.
|
abstract |
Stops/Resumes sending the local audio stream.
A successful muteLocalAudioStream method call triggers the onUserMuteAudio callback on the remote client.
muted | Sets whether to send/stop sending the local audio stream:
|
muted
is set as true
, this method does not disable the microphone and thus does not affect any ongoing recording.setChannelProfile
after this method, the SDK resets whether or not to mute the local audio according to the channel profile and user role. Therefore, we recommend calling this method after the setChannelProfile
method.
|
abstract |
Stops/Resumes receiving a specified audio stream.
uid | ID of the specified remote user. |
muted | Sets whether to receive/stop receiving the specified remote user's audio stream:
|
muted
as true
to stop receiving all remote video streams, ensure that the muteAllRemoteAudioStreams method is called and set muted
as false
before calling this method. The muteAllRemoteAudioStreams method sets all remote audio streams, while the muteRemoteAudioStream method sets a specified remote user's audio stream.
|
abstract |
Adjusts the playback volume of a specified remote user.
You can all this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user.
uid | ID of the remote user. |
volume | The playback volume of the specified remote user. The value ranges from 0 to 100:
|
|
abstract |
Stops/Resumes receiving all remote audio streams.
muted | Sets whether to receive/stop receiving all remote audio streams:
|
|
abstract |
Sets whether to receive all remote audio streams by default.
You can call this method either before or after joining a channel. If you call setDefaultMuteAllRemoteAudioStreams
(true) after joining a channel, you will not receive the audio streams of any subsequent user.
muteRemoteAudioStream
(false), and specify the ID of the remote user that you want to subscribe to. To resume audio streams of multiple users, call muteRemoteAudioStream
as many times. Calling setDefaultMuteAllRemoteAudioStreams
(false) resumes receiving audio streams of the subsequent users only.muted | Sets whether or not to receive/stop receiving the remote audio streams by default:
|
|
abstract |
Enables the video module.
You can call this method either before joining a channel or during a call. If you call this method before joining a channel, the service starts in the video mode. If you call this method during an audio call, the audio mode switches to the video mode.
A successful enableVideo method call triggers the onUserEnableVideo(true) callback on the remote client.
To disable the video, call the disableVideo method.
|
abstract |
Disables the video module.
You can call this method before joining a channel or during a call. If you call this method before joining a channel, the service starts in audio mode. If you call this method during a video call, the video mode switches to the audio mode.
A successful disableVideo method call triggers the onUserEnableVideo(false) callback on the remote client.
To enable the video mode, call the enableVideo method.
|
abstract |
Sets the video encoding profile.
If you do not need to change the video encoding profile after joining a channel, call this method before calling the enableVideo method to reduce the render time of the first video frame.
Each video encoding profile includes a set of parameters, such as the resolution, frame rate, and bitrate. When the camera does not support the specified resolution, the SDK chooses a suitable camera resolution, while the encoder resolution is specified by this method.
profile | Sets the video encoding profile. See VideoProfile. |
swapWidthAndHeight | The width and height of the output video is consistent with the set video profile. swapWidthAndHeight sets whether or not to swap the width and height of the stream:
|
|
abstract |
Manually sets the video encoding profile.
Each video encoding profile includes a set of parameters, such as the resolution, frame rate, and bitrate. If the camera device does not support the specified resolution, the SDK automatically chooses a suitable camera resolution, keeping the encoder resolution specified by this method. If the user does not set the video encoding profile after joining a channel, We recommend calling this method before calling the enableVideo method to minimize the time delay in receiving the first video frame.
width | Sets the width of the video. The maximum value of width × height is 1280 × 720. |
height | Sets the height of the video. The maximum value of width × height is 1280 × 720. |
frameRate | Sets the frame rate of the video. The highest value is 30. You can set frameRate as 5, 10, 15, 24, and 30. |
bitrate | Sets the bitrate of the video. You need to manually work out the bitrate according to the width, height, and frame rate. For the correlation between the width, height, and frame rate. See the table in Bitrate. |
With the same width and height, the bitrate varies with the frame rate:
If you set a bitrate beyond the proper range, the SDK automatically adjusts the bitrate to a value within the proper range.
|
abstract |
Sets the video encoder configuration.
Each video encoder configuration corresponds to a set of video parameters, including the resolution, frame rate, bitrate, and video orientation. The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.
If you do not set the video encoder configuration after joining the channel, you can call this method before calling the enableVideo method to reduce the render time of the first video frame.
config | The local video encoder configuration. See VideoEncoderConfiguration. |
|
abstract |
Sets the camera capturer configuration.
For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capture settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capturer configuration:
config
as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to avoid such problems. config
as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1)
to optimize CPU and RAM usage. config
as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2)
. config | The camera capturer configuration. For details, see CameraCapturerConfiguration. |
|
abstract |
Initializes the local video view.
This method initializes the video view of the local stream on the local device. It affects only the video view that the local user sees, not the published local video stream.
Call this method to bind the loca video stream to a video view and to set the rendering and mirror modes of the video view.
local | Sets the local video view and settings. See VideoCanvas. |
|
abstract |
Initializes the video view of a remote user.
This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees.
Call this method to bind the remote video stream to a video view and to set the rendering and mirror modes of the video view.
Typically, the app specifies the uid
of the remote user sending the video in the method call before the remote user joins a channel. If the uid
of the remote user is unknown to the app, set the uid
when the app receives the onUserJoined callback.
If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the app view because the dummy client does not send any video streams. If your app does not recognize the dummy client, bind the remote user to the view when the SDK triggers the onFirstRemoteVideoDecoded callback.
To unbind the remote user from the view, set view
in Video Canvas as null
. Once the remote user leaves the channel, the SDK unbinds the remote user.
remote | Sets the remote video view and settings. See Video Canvas. |
|
abstract |
Sets the local video display mode.
renderMode | Sets the local video display mode:
|
|
abstract |
Updates the display mode of the local video view.
After initializing the local video view, you can call this method to update its rendering and mirror modes. It affects only the video view that the local user sees, not the published local video stream.
renderMode | Sets the local video display mode:
|
mirrorMode | Sets the local video mirror mode:
|
|
abstract |
Sets the remote video display mode.
This method can be invoked multiple times during a call to change the display mode.
uid | User ID of the remote user. |
renderMode | Sets the remote video display mode:
|
|
abstract |
Updates the display mode of the video view of a remote user.
After initializing the video view of a remote user, you can call this method to update its rendering and mirror modes. This method affects only the video view that the local user sees.
uid | User ID of the remote user. |
renderMode | Sets the remote video display mode:
|
mirrorMode | Sets the remote video mirror mode:
|
|
static |
Creates the video renderer view.
CreateRendererView returns the SurfaceView type. The operation and layout of the view are managed by the app, and the Agora SDK renders the view provided by the app. The video display view must be created using this method instead of directly calling SurfaceView
.
context | The context of the Android Activity. |
|
abstract |
Starts the local video preview before joining a channel.
Before calling this method, you must:
|
abstract |
Stops the local video preview and the video.
|
abstract |
Disables/Re-enables the local video capture.
This method disables or re-enables the local video capturer, and does not affect receiving the remote video stream.
After you call the enableVideo method, the local video capturer is enabled by default. You can call enableLocalVideo(false) to disable the local video capturer. If you want to re-enable it, call enableLocalVideo(true).
After the local video capturer is successfully disabled or re-enabled, the SDK triggers the onUserEnableLocalVideo callback on the remote client.
enabled | Sets whether to disable/re-enable the local video, including the capturer, renderer, and sender:
|
|
abstract |
Stops/Resumes sending the local video stream.
A successful muteLocalVideoStream method call triggers the onUserMuteVideo callback on the remote client.
muted | Sets whether to send/stop sending the local video stream:
|
muted
as true
, this method does not disable the camera and thus does not affect the retrieval of the local video streams. This method responds faster than calling the enableLocalVideo method and set muted
as false
, which controls sending the local video stream.setChannelProfile
after this method, the SDK resets whether or not to mute the local video according to the channel profile and user role. Therefore, we recommend calling this method after the setChannelProfile
method.
|
abstract |
Stops/Resumes receiving a specified remote user's video stream.
uid | User ID of the specified remote user. |
muted | Sets whether to receive/stop receiving a specified remote user's video stream:
|
muted
as true
to stop receiving all remote video streams, ensure that the muteAllRemoteVideoStreams method is called and set muted
as false
before calling this method. The muteAllRemoteVideoStreams method sets all remote streams, while this method sets a specified remote user's stream.
|
abstract |
Stops/Resumes receiving all remote video streams.
muted | Sets whether to receive/stop receiving all remote video streams:
|
|
abstract |
Sets whether to receive all remote video streams by default.
You can call this method either before or after joining a channel. If you call setDefaultMuteAllRemoteVideoStreams
(true) after joining a channel, you will not receive the video stream of any subsequent user.
muteRemoteVideoStream
(false), and specify the ID of the remote user that you want to subscribe to. To resume receiving video streams of multiple users, call muteRemoteVideoStream
as many times. Calling setDefaultMuteAllRemoteVideoStreams
(false) resumes receiving video streams of the subsequent users only.muted | Sets whether to receive/stop receiving all remote video streams by default:
|
|
abstract |
Enables/Disables image enhancement and sets the options.
enabled | Sets whether or not to enable image enhancement:
|
options | The image enhancement options. See BeautyOptions. |
|
abstract |
Sets the default audio playback route.
This method sets whether the received audio is routed to the earpiece or speakerphone by default before joining a channel. If a user does not call this method, the audio is routed to the earpiece by default. If you need to change the default audio route after joining a channel, call the setEnableSpeakerphone method.
The default audio route for each scenario:
disableVideo
, or muteLocalVideoStream
and muteAllRemoteVideoStreams
, the default audio route automatically switches back to the earpiece.defaultToSpeaker | Sets the default audio route:
|
|
abstract |
Enables/Disables the audio playback route to the speakerphone.
This method sets whether the audio is routed to the speakerphone or earpiece. After calling this method, the SDK returns the onAudioRouteChanged callback to indicate the changes.
enabled | Sets whether to route the audio to the speakerphone or earpiece:
|
|
abstract |
Checks whether the speakerphone is enabled.
|
abstract |
Enables in-ear monitoring.
enabled | Sets whether to enable/disable in-ear monitoring:
|
|
abstract |
Sets the volume of the in-ear monitor.
volume | Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default). |
|
abstract |
Uses an external audio device.
|
abstract |
Changes the voice pitch of the local speaker.
pitch | Sets the voice pitch. The value ranges between 0.5 and 2.0. The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch). |
|
abstract |
Sets the local voice equalization effect.
bandFrequency | Sets the band frequency. The value ranges between 0 and 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. |
bandGain | Sets the gain of each band (dB). The value ranges between -15 and 15. The default value is 0. |
|
abstract |
Sets the local voice reverberation.
reverbKey | Sets the reverberation key. This method contains five reverberation keys. For details, see the description of each @ value. |
value | Sets the local voice reverberation value:
|
|
abstract |
Sets the local voice changer option.
voiceChanger | The local voice changer option:
|
|
abstract |
Sets the preset local voice reverberation effect
preset | The local voice reverberation preset:
|
|
abstract |
Enables/Disables stereo panning for remote users.
Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling setRemoteVoicePosition.
enabled | Sets whether or not to enable stereo panning for remote users:
|
|
abstract |
Sets the sound position of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
uid | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0:
|
gain | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. |
|
abstract |
Starts playing and mixing the music file.
This method mixes the specified local or online audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local or remote audio file. You can choose whether the other user can hear the local audio playback and specify the number of playback loops. When the audio mixing file playback finishes after calling this method, the SDK triggers the onAudioMixingFinished callback.
A successful startAudioMixing method call triggers the onAudioMixingStateChanged(MEDIA_ENGINE_AUDIO_EVENT_MIXING_PLAY) callback on the local client.
When the audio mixing file playback finishes, the SDK triggers the onAudioMixingStateChanged(MEDIA_ENGINE_AUDIO_EVENT_MIXING_STOPPED) callback on the local client.
filePath | Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. For example, /sdcard/emulated/0/audio.mp4 . Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv, and wav.
|
loopback | Sets which user can hear the audio mixing:
|
replace | Sets the audio mixing content:
|
cycle | Sets the number of playback loops:
|
|
abstract |
Stops playing or mixing the music file.
Call this method when you are in a channel.
|
abstract |
Pauses playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Resumes playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Adjusts the volume of audio mixing.
Call this method when you are in a channel.
volume | Audio mixing volume. The value ranges between 0 and 100 (default). |
|
abstract |
Adjusts the volume of audio mixing for local playback.
volume | Audio mixing volume for local playback. The value ranges between 0 and 100 (default). |
|
abstract |
Adjusts the volume of audio mixing for publishing (sending to other users).
volume | Audio mixing volume for publishing. The value ranges between 0 and 100 (default). |
|
abstract |
Gets the audio mixing volume for local playback.
This method helps troubleshoot audio volume related issues.
|
abstract |
Gets the audio mixing volume for publishing.
This method helps troubleshoot audio volume related issues.
|
abstract |
Gets the duration (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Gets the playback position (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Sets the playback position (ms) of the music file to a different starting position (the default plays from the beginning).
pos | The playback starting position (ms) of the audio mixing file. |
|
abstract |
Retrieves the IAudioEffectManager object associated with the current RtcEngine instance.
|
abstract |
Starts an audio recording on the client.
The SDK allows recording during a call. Supported formats of the recording file are as follows:
This method has a fixed sample rate of 32 kHz.
filePath | Full file path of the recording file. The string of the file name is in UTF-8. |
quality | Sets the audio recording quality:
|
|
abstract |
Starts an audio recording on the client.
The SDK allows recording during a call. After successfully calling this method, you can record the audio of all the users in the channel and get an audio recording file.
Supported formats of the recording file are as follows:
quality
as AUDIO_RECORDING_QUALITY_MEDIUM or AUDIO_RECORDING_QUALITY_HIGH when sampleRate
is 44.1 kHz or 48 kHz.filePath | Absolute file path (including the suffixes of the filename) of the recording file. The string of the file name is in UTF-8. For example, /sdcard/emulated/0/audio/aac . |
sampleRate | Sample rate (Hz) of the recording file. Supported values are as follows:
|
quality | The audio recording quality:
|
|
abstract |
Stops the audio recording on the client.
|
abstract |
Starts an audio call test.
This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
To conduct the test:
|
abstract |
Starts an audio call test.
In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
intervalInSeconds | The time interval (s) between when you speak and when the recording plays back. |
|
abstract |
Stops the audio call test.
|
abstract |
Enables the network connection quality test.
This method tests the quality of the users' network connections and is disabled by default.
Before users join a channel or before an audience switches to a host, call this method to check the uplink network quality. This method consumes additional network traffic, which may affect the communication quality. Call the disableLastmileTest method to disable this test after receiving the onLastmileQuality callback, and before the user joins a channel or switches the user role.
|
abstract |
Disables the network connection quality test.
|
abstract |
Starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
Once this method is enabled, the SDK returns the following callbacks:
Call this method to check the uplink network quality before users join a channel or before an audience switches to a host.
config | The configurations of the last-mile network probe test. For details, see LastmileProbeConfig. |
|
abstract |
Stops the last-mile network probe test.
|
abstract |
Customizes the video source.
Call this method to add an external video source to the SDK.
source | Sets the video source. See IVideoSource. |
|
abstract |
Customizes the local video renderer.
Call this method to add an external local video renderer to the SDK.
render | Sets the local video renderer. See IVideoSink. |
|
abstract |
Customizes the remote video renderer.
Call this method to add an external remote video renderer to the SDK.
uid | The ID of the remote user. |
render | Sets the remote video renderer. See IVideoSink. |
|
abstract |
Sets the external audio sink.
This method applies to scenarios where you want to use external audio data for playback. After enabling the external audio sink, you can call the pullPlaybackAudioFrame method to pull the remote audio data, process it, and play it with the audio effects that you want.
enabled | Sets whether to enable or disable the external audio sink:
|
sampleRate | Sets the sample rate (Hz) of the external audio sink. You can set this parameter as 16000, 32000, 44100, or 48000. |
channels | Sets the number of audio channels of the external audio sink:
|
|
abstract |
Pulls the remote audio frame.
Before calling this method, call the setExternalAudioSink(enabled: true) method to enable and set the external audio sink.
After a successful method call, the app pulls the decoded and mixed audio data for playback.
pullPlaybackAudioFrame
method successfully, the app will not retrieve any audio data from the onPlaybackFrame callback.onPlaybackFrame
callback and the pullPlaybackAudioFrame
method is as follows:onPlaybackFrame
: The SDK sends the audio data to the app once every 10 ms. Any delay in processing the audio frames may result in audio jitter.pullPlaybackAudioFrame
: The app pulls the remote audio data. After setting the audio data parameters, the SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback.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 value of the sampleRate parameter that you set in the setExternalAudioSink method: lengthInByte = sampleRate / 100 × 2 × number of channels × time (ms). |
|
abstract |
Sets the external audio source.
enabled | Sets whether to enable/disable the external audio source:
|
sampleRate | Sets the sample rate (Hz) of the external audio source, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channels | Sets the number of channels of the external audio source:
|
|
abstract |
Pushes the external audio frame to the Agora SDK for encoding.
data | External audio data to be pushed. |
timestamp | Timestamp of the external audio frame. It is mandatory. You can use this parameter for the following purposes:
|
|
abstract |
Configures the external video source.
enable | Sets whether or not to use the external video source:
|
useTexture | Sets whether or not to use texture as an input:
|
pushMode | Sets whether or not the external video source needs to call the PushExternalVideoFrame method to send the video frame to the Agora SDK:
|
|
abstract |
Pushes the video frame using the AgoraVideoFrame class and passes the video frame to the Agora SDK.
Call the setExternalVideoSource method and set pushMode
as true
before calling this method. Otherwise, a failure returns after calling this method.
frame | Video frame to be pushed. See AgoraVideoFrame. |
|
abstract |
Checks whether texture encoding is supported.
|
abstract |
Registers the audio observer object.
observer | Audio observer object to be registered. See IAudioFrameObserver. Set the value as null to cancel registering, if necessary. |
|
abstract |
Sets the audio recording format for the onRecordFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onRecordFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channel | Sets the number of audio channels (channels ) returned in the onRecordFrame callback:
|
mode | Sets the use mode of the onRecordFrame callback:
|
samplesPerCall | Sets the number of samples the onRecordFrame callback returns. In RTMP streaming scenarios, set it as 1024. |
sampleRate
, channel
, and samplesPerCall
parameters you set in this method. Sample interval (s) = samplePerCall
/(sampleRate × channel). Ensure that the value of sample interval ≥ 0.01. The SDK triggers the onRecordFrame callback according to the sample interval.
|
abstract |
Sets the audio playback format for the onPlaybackFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onPlaybackFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
channel | Sets the number of channels (channels ) returned in the onPlaybackFrame callback:
|
mode | Sets the use mode of the onPlaybackFrame callback:
|
samplesPerCall | Sets the number of samples the onPlaybackFrame callback returns. In RTMP streaming scenarios, set it as 1024. |
sampleRate
, channel
, and samplesPerCall
parameters you set in this method. Sample interval (s) = samplePerCall
/(sampleRate × channel). Ensure that the value of sample interval ≥ 0.01. The SDK triggers the onPlaybackFrame callback according to the sample interval.
|
abstract |
Sets the mixed audio format for the onMixedAudioFrame callback.
sampleRate | Sets the sample rate (samplesPerSec ) returned in the onMixedAudioFrame callback, which can be set as 8000, 16000, 32000, 44100, or 48000 Hz. |
samplesPerCall | Sets the number of samples the onMixedAudioFrame callback returns. In RTMP streaming scenarios, set it as 1024. |
sampleRate
and samplesPerCall
parameters you set in this method, and channels
in AudioFrame. Sample interval (s) = samplePerCall
/(sampleRate × channel). Ensure that the value of sample interval ≥ 0.01. The SDK triggers the onMixedAudioFrame callback according to the sample interval.
|
abstract |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video stream for the recording device, channel audience, or CDN live audience to see and capture. To add the PNG file to a CDN live publishing stream, see the setLiveTranscoding method.
watermark | Watermark image to be added to the local video stream. See Agora Image. |
url
in Agora Image refers to the absolute path of the added watermark image file in the local video stream. url
in Agora Image refers to the address of the added watermark image in the CDN live broadcast. orientationMode
as Adaptive in the setVideoEncoderConfiguration method, the watermark image rotates with the video frame around the upper left corner of the watermark image.
|
abstract |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video stream in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), and the recording 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:
visibleInPreview
member in the WatermarkOptions
class to set whether or not the watermark is visible in preview.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. |
|
abstract |
Removes the watermark image from the video stream added by addVideoWatermark.
|
abstract |
Sets the priority of a remote user's media stream.
Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
uid | The ID of the remote user. |
userPriority | The priority of the remote user:
|
|
abstract |
Sets the fallback option for the locally published video stream based on the network conditions.
If option
is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK will:
When the locally published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the onLocalPublishFallbackToAudioOnly.
option | Sets the fallback option for the locally published video stream:
|
|
abstract |
Sets the fallback option for the remotely subscribed video stream based on the network conditions.
If option
is set as STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network condition cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve. When the remotely subscribed video stream falls back to audio only, or the audio-only stream switches back to the video, the SDK triggers the onRemoteSubscribeFallbackToAudioOnly callback.
option | Sets the fallback option for the remotely subscribed video stream:
|
|
abstract |
Enables/Disables the dual video stream mode.
If dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution high-bitrate video stream) or low stream (low-resolution low-bitrate video stream) video.
enabled | Sets the stream mode:
|
|
abstract |
Sets the stream type of the remote video.
Under limited network conditions, if the publisher has not disabled the dual-stream mode using enableDualStreamMode(false)
, the receiver can choose to receive either the high-video stream (the high resolution, and high bitrate video stream) or the low-video stream (the low resolution, and low bitrate video stream).
By default, users receive the high-video stream. Call this method if you want to switch to the low-video stream. This method allows the app to adjust the corresponding video stream type based on the size of the video window to reduce the bandwidth and resources.
The aspect ratio of the low-video stream is the same as the high-video stream. Once the resolution of the high-video stream is set, the system automatically sets the resolution, frame rate, and bitrate of the low-video stream.
The SDK reports the result of calling this method in the onApiCallExecuted callback.
uid | ID of the remote user sending the video stream. |
streamType | Sets the video-stream type:
|
|
abstract |
Sets the default video-stream type of the remotely subscribed video stream when the remote user sends dual streams.
streamType | Sets the default video-stream type:
|
|
abstract |
Enables built-in encryption with an encryption password before joining a channel.
All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user leaves the channel. If the encryption password is not specified or set to empty, the encryption functionality is disabled.
secret | Encryption password. |
|
abstract |
Sets the built-in encryption mode.
The Agora SDK supports built-in encryption, which is set to aes-128-xts
mode by default. Call this method to set the encryption mode to use other encryption modes. All users in the same channel must use the same encryption mode and password.
Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
encryptionMode | Sets the encryption mode:
|
|
abstract |
Injects an online media stream to a live broadcast.
If this method call is successful, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all audience members in the channel can watch a live show and interact with each other.
The addInjectStreamUrl method call triggers the following callbacks:
url | The URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and HTTP-FLV.
|
config | The LiveInjectStreamConfig object which contains the configuration information for the added voice or video stream. |
|
abstract |
Removes the injected online media stream from a live broadcast.
This method removes the URL address (added by addInjectStreamUrl) from a live broadcast.
If this method call is successful, the SDK triggers the onUserOffline callback and returns a stream uid of 666.
url | HTTP/HTTPS URL address of the added stream to be removed. |
|
abstract |
Publishes the local stream to the CDN.
The addPublishStreamUrl method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.
url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters. |
transcodingEnabled | Sets whether transcoding is enabled/disabled. If you set this parameter as true , ensure that you call the setLiveTranscoding method before this method.
|
|
abstract |
Removes an RTMP stream from the CDN.
This method removes the RTMP URL address (added by addPublishStreamUrl) from a CDN live stream. The SDK reports the result of this method call in the onRtmpStreamingStateChanged callback.
url | The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters. |
|
abstract |
Sets the video layout and audio settings for CDN live.
The SDK triggers the onTranscodingUpdated callback when you call this method to update the LiveTranscoding
class. If you call this method to set the LiveTranscoding
class for the first time, the SDK does not trigger the onTranscodingUpdated
callback.
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
|
abstract |
Creates a data stream.
Each user can create up to five data streams during the lifecycle of the RtcEngine.
reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether or not the recipients receive the data stream in the sent order:
|
reliable
and ordered
parameters to true
or false
. Do not set one as true
and the other as false
.
|
abstract |
Sends data stream messages.
The SDK has the following restrictions on this method:
A successful sendStreamMessage method call triggers the onStreamMessage callback on the remote client, from which the remote user gets the stream message.
A failed sendStreamMessage method call triggers the onStreamMessageError callback on the remote client.
streamId | ID of the sent data stream returned by the createDataStream method. |
message | Sent data. |
|
abstract |
Sets the preference option for the video quality (Live Broadcast only).
preferFrameRateOverImageQuality | Sets the video quality preference:
|
|
abstract |
Sets the local video mirror mode.
Use this method before calling the startPreview method, or the mirror mode does not take effect until you call the startPreview method again.
mode | Sets the local video mirror mode:
|
|
static |
Gets the recommended encoder type.
|
abstract |
Switches between front and rear cameras.
|
abstract |
Checks whether the camera zoom function is supported.
|
abstract |
Checks whether the camera flash function is supported.
|
abstract |
Checks whether the camera manual focus function is supported.
|
abstract |
Checks whether the camera exposure function is supported.
|
abstract |
Checks whether the camera auto-face focus function is supported.
|
abstract |
Sets the camera zoom ratio.
factor | Sets the camera zoom factor. The value ranges between 1.0 and the maximum zoom supported by the device. |
|
abstract |
Gets the maximum zoom ratio supported by the camera.
|
abstract |
Sets the camera manual focus position.
A successful setCameraFocusPositionInPreview method call triggers the onCameraFocusAreaChanged callback on the local client.
positionX | The horizontal coordinate of the touch point in the view. |
positionY | The vertical coordinate of the touch point in the view. |
|
abstract |
Sets the camera exposure position.
A successful setCameraExposurePosition method call triggers the 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. |
|
abstract |
Enables the camera flash function.
isOn | Sets whether to enable/disable the camera flash function:
|
|
abstract |
Enables the camera auto-face focus function.
enabled | Sets whether to enable/disable the camera auto-face focus function:
|
|
abstract |
Gets the current call ID.
When a user joins a channel on a client, a call ID is generated to identify the call from the client. Feedback methods, such as the rate and complain method, must be called after the call ends to submit feedback to the SDK.
The rate and complain methods require the callId
parameter retrieved from the getCallId method during a call. callId
is passed as an argument into the rate and complain methods after the call ends.
|
abstract |
Allows the user to rate a call after the call ends.
callId | ID of the call retrieved from the getCallId method. |
rating | Rating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the ERR_INVALID_ARGUMENT(-2) error occurs. |
description | (Optional) The description of the rating. The string length must be less than 800 bytes. |
|
abstract |
Allows a user to complain about the call quality after a call ends.
callId | ID of the call retrieved from the getCallId method. |
description | (Optional) The description of the complaint. The string length must be less than 800 bytes. |
|
static |
Gets the SDK version.
|
static |
Gets the media engine version.
|
abstract |
Specifies an SDK output log file.
The log file records all log data for the SDK’s operation. Ensure that the directory for the log file exists and is writable.
filePath | File path of the log file. The string of the log file is in UTF-8. The default file path is /storage/emulated/0/Android/data/<package name>="">/files/agorasdk.log. |
|
abstract |
Sets the output log level of the SDK.
You can use one or a combination of the filters. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level. For example, if you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
filter | Sets the log filter level:
|
|
abstract |
Sets the log file size (KB).
The Agora SDK has two log files, each with a default size of 512 KB. If you set fileSizeInKBytes
as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.
fileSizeInKBytes | The SDK log file size (KB). |
|
abstract |
Gets the native handle of the SDK engine.
This interface is used to retrieve the native C++ handle of the SDK engine used in special scenarios, such as registering the audio and video frame observer.
void io.agora.rtc.RtcEngine.addHandler | ( | IRtcEngineEventHandler | handler | ) |
Adds the IRtcEngineEventHandler class.
The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the app, and the app inherits the methods of the IRtcEngineEventHandler interface class to retrieve the callbacks.
handler | IRtcEngineEventHandler |
void io.agora.rtc.RtcEngine.removeHandler | ( | IRtcEngineEventHandler | handler | ) |
Removes the specified IRtcEngineEventHandler object.
For callback events that you only want to listen for once, call this method to remove subsequent IRtcEngineEventHandler objects after you have received them. This interface is used to remove the specific IRtcEngineEventHandler interface class instance.
handler | The IRtcEngineEventHandler object. |
|
abstract |
Enables the Wi-Fi mode.
enable | Sets whether to enable/disable the Wi-Fi mode:
|
|
static |
Gets the warning or error description.
error | Detailed warning or error description in Warning Code or Error Code. |
|
abstract |
Monitors external headset device events.
monitor | Sets whether to enable/disable monitoring external headset device events:
|
|
abstract |
Monitors Bluetooth headset device events.
monitor | Sets whether to enable/disable monitoring Bluetooth headset device events:
|
|
abstract |
Sets the default audio route to the headset.
enabled | Sets whether or not the default audio route is to the headset:
|
|
abstract |
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
parameters | Sets the parameter as a JSON string in the specified format. |
|
abstract |
Gets the Agora SDK’s parameters for customization purposes. This method is not disclosed yet. Contact support@agora.io for more information.
|
abstract |
Registers the metadata observer.
You need to implement the IMetadataObserver class and specify the metadata type in this method. A successful call of this method triggers the getMaxMetadataSize callback.
This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.
observer | The IMetadataObserver class. |
type | The metadata type. Currently, the SDK supports VIDEO_METADATA(0) only.
|
|
abstract |
Starts to relay media streams across channels.
After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged and onChannelMediaRelayEvent callbacks, and these callbacks return the state and events of the media stream relay.
onChannelMediaRelayStateChanged
callback returns RELAY_STATE_RUNNING(2) and RELAY_OK(0), and the onChannelMediaRelayEvent
callback returns RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4), the SDK starts relaying media streams between the original and the destination channel.onChannelMediaRelayStateChanged
callback returns RELAY_STATE_FAILURE(3), an exception occurs during the media stream relay.channelMediaRelayConfiguration | The configuration of the media stream relay: ChannelMediaRelayConfiguration. |
|
abstract |
Stops the media stream relay.
Once the relay stops, the broadcaster quits all the destination channels. After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged callback. If the callback returns RELAY_STATE_IDLE(0) and RELAY_OK(0), the broadcaster successfully stops the relay.
onChannelMediaRelayStateChanged
callback with the RELAY_ERROR_SERVER_NO_RESPONSE(2) or RELAY_ERROR_SERVER_CONNECTION_LOST(8) state code. You can leave the channel by calling the leaveChannel method, and the media stream relay automatically stops.
|
abstract |
Updates the channels for media relay.
After the channel media relay starts, if you want to relay the media stream to more channels, or leave the current relay channel, you can call the updateChannelMediaRelay
method.
After a successful method call, the SDK triggers the onChannelMediaRelayEvent callback with the RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7) state code.
startChannelMediaRelay
method to update the destination channel.ChannelMediaRelayConfiguration
before calling this method.channelMediaRelayConfiguration | The media stream relay configuration: ChannelMediaRelayConfiguration. |
|
abstract |
Creates and gets an RtcChannel instance.
To join more than one channel, call this method multiple times to create as many RtcChannel instances as needed, and call the joinChannel method of each created RtcChannel object.
After joining multiple channels, you can simultaneously subscribe to streams of all the channels, but publish a stream in only one channel at one time.
channelId | The unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. This parameter does not have a default value. You must set it. Do not set it as the empty string "". Otherwise, the SDK returns ERR_REFUSED(-5). Supported character scopes are:
|
channelId
as the empty string "".