Public Member Functions | |
abstract int | setChannelProfile (int profile) |
abstract int | setClientRole (int role) |
abstract int | joinChannel (String token, String channelName, String optionalInfo, int optionalUid) |
abstract int | leaveChannel () |
abstract int | renewToken (String token) |
abstract int | enableWebSdkInteroperability (boolean enabled) |
abstract int | enableAudio () |
abstract int | disableAudio () |
abstract int | pauseAudio () |
abstract int | resumeAudio () |
abstract int | setAudioProfile (int profile, int scenario) |
abstract int | setHighQualityAudioParameters (boolean fullband, boolean stereo, boolean fullBitrate) |
abstract int | adjustRecordingSignalVolume (int volume) |
abstract int | adjustPlaybackSignalVolume (int volume) |
abstract int | enableAudioVolumeIndication (int interval, int smooth) |
abstract int | enableAudioQualityIndication (boolean enabled) |
abstract int | enableLocalAudio (boolean enabled) |
abstract int | muteLocalAudioStream (boolean muted) |
abstract int | muteRemoteAudioStream (int uid, boolean muted) |
abstract int | muteAllRemoteAudioStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteAudioStreams (boolean muted) |
abstract int | enableVideo () |
abstract int | disableVideo () |
abstract int | setVideoProfile (int profile, boolean swapWidthAndHeight) |
abstract int | setVideoProfile (int width, int height, int frameRate, int bitrate) |
abstract int | setVideoEncoderConfiguration (VideoEncoderConfiguration config) |
abstract int | setupLocalVideo (VideoCanvas local) |
abstract int | setupRemoteVideo (VideoCanvas remote) |
abstract int | setLocalRenderMode (int mode) |
abstract int | setRemoteRenderMode (int uid, int mode) |
abstract int | startPreview () |
abstract int | stopPreview () |
abstract int | enableLocalVideo (boolean enabled) |
abstract int | muteLocalVideoStream (boolean muted) |
abstract int | muteRemoteVideoStream (int uid, boolean muted) |
abstract int | muteAllRemoteVideoStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteVideoStreams (boolean muted) |
abstract int | 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 | 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 | getAudioMixingDuration () |
abstract int | getAudioMixingCurrentPosition () |
abstract int | setAudioMixingPosition (int pos) |
abstract IAudioEffectManager | getAudioEffectManager () |
abstract int | startAudioRecording (String filePath, int quality) |
abstract int | stopAudioRecording () |
abstract int | startEchoTest () |
abstract int | stopEchoTest () |
abstract int | enableLastmileTest () |
abstract int | disableLastmileTest () |
abstract int | setVideoSource (IVideoSource source) |
abstract int | setLocalVideoRenderer (IVideoSink render) |
abstract int | setRemoteVideoRenderer (int uid, IVideoSink render) |
abstract int | setExternalAudioSource (boolean enabled, int sampleRate, int channels) |
abstract int | pushExternalAudioFrame (byte[] data, long timestamp) |
abstract void | setExternalVideoSource (boolean enable, boolean useTexture, boolean pushMode) |
abstract boolean | pushExternalVideoFrame (AgoraVideoFrame frame) |
abstract boolean | isTextureEncodeSupported () |
abstract int | registerAudioFrameObserver (IAudioFrameObserver observer) |
abstract int | setRecordingAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setPlaybackAudioFrameParameters (int sampleRate, int channel, int mode, int samplesPerCall) |
abstract int | setMixedAudioFrameParameters (int sampleRate, int samplesPerCall) |
abstract int | addVideoWatermark (AgoraImage watermark) |
abstract int | clearVideoWatermarks () |
abstract int | setLocalPublishFallbackOption (int option) |
abstract int | setRemoteSubscribeFallbackOption (int option) |
abstract int | enableDualStreamMode (boolean enabled) |
abstract int | setRemoteVideoStreamType (int uid, int streamType) |
abstract int | setRemoteDefaultVideoStreamType (int streamType) |
abstract int | setEncryptionSecret (String secret) |
abstract int | setEncryptionMode (String encryptionMode) |
abstract int | addInjectStreamUrl (String url, LiveInjectStreamConfig config) |
abstract int | removeInjectStreamUrl (String url) |
abstract int | addPublishStreamUrl (String url, boolean transcodingEnabled) |
abstract int | removePublishStreamUrl (String url) |
abstract int | setLiveTranscoding (LiveTranscoding transcoding) |
abstract int | configPublisher (PublisherConfiguration config) |
abstract int | setVideoCompositingLayout (VideoCompositingLayout layout) |
abstract int | clearVideoCompositingLayout () |
abstract int | createDataStream (boolean reliable, boolean ordered) |
abstract int | sendStreamMessage (int streamId, byte[] message) |
abstract int | setVideoQualityParameters (boolean preferFrameRateOverImageQuality) |
abstract int | setLocalVideoMirrorMode (int mode) |
abstract int | switchCamera () |
abstract boolean | isCameraZoomSupported () |
abstract boolean | isCameraTorchSupported () |
abstract boolean | isCameraFocusSupported () |
abstract boolean | isCameraAutoFocusFaceModeSupported () |
abstract int | setCameraZoomFactor (float factor) |
abstract float | getCameraMaxZoomFactor () |
abstract int | setCameraFocusPositionInPreview (float positionX, float positionY) |
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 long | getNativeHandle () |
void | addHandler (IRtcEngineEventHandler handler) |
abstract boolean | enableHighPerfWifiMode (boolean enable) |
abstract void | monitorHeadsetEvent (boolean monitor) |
abstract void | monitorBluetoothHeadsetEvent (boolean monitor) |
abstract void | setPreferHeadset (boolean enabled) |
abstract int | setParameters (String parameters) |
abstract String | getParameter (String parameter, String args) |
Static Public Member Functions | |
static synchronized RtcEngine | create (Context context, String appId, IRtcEngineEventHandler handler) throws Exception |
static synchronized void | destroy () |
static SurfaceView | CreateRendererView (Context context) |
static int | getRecommendedEncoderType () |
static String | getSdkVersion () |
static String | getMediaEngineVersion () |
static String | getErrorDescription (int error) |
RtcEngine is the main interface class of the Agora SDK.
Call the methods of this class to use all functionalities of the SDK. Agora recommends calling the RtcEngine API methods in the same thread instead of in multiple threads. In previous versions, this class was named AgoraAudio, and was renamed to RtcEngine from v1.0.
|
static |
Creates an RtcEngine instance.
The Agora SDK only supports one RtcEngine instance at a time, therefore the app should create one RtcEngine object only. Unless otherwise specified:
context | The context of Android Activity. |
appId | The App ID issued by Agora to the developers. Apply for a new App ID from Agora if it is missing from your kit. |
handler | IRtcEngineEventHandler is an abstract class providing default implementations. The SDK uses this class to report to the app on the SDK runtime events. |
Exception | Descriptions of possible exceptions when calling this method. |
|
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.
The Agora RtcEngine needs to know the application scenario to set the appropriate channel profile to apply different optimization methods.
profile | Sets the channel profile:
|
|
abstract |
Sets the role of the user (Live Broadcast only).
This method sets the role of the user, such as a host or an audience (default), before joining a channel.
This method can be used to switch the user role after the user joins a channel.
role | Sets the role of the client. See ClientRole. |
|
abstract |
Allows a user to join a channel.
Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.
You must call the leaveChannel method to exit the current call before entering another channel.
token | A token generated by the server. In most circumstances, the static App ID suffices. For added security, use a token.
|
channelName | Unique channel name for the AgoraRTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
|
optionalInfo | Additional information about the channel. This parameter can be set to 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). The uid must be unique. If a uid is not assigned (or set to 0), the SDK assigns and returns a 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”.
|
abstract |
Allows a user to leave a channel.
After joining a channel, the user must call the leaveChannel method to end the call before joining another channel. This method returns 0 if the user leaves the channel and releases all resources related to the call. This method call is asynchronous, and the user has not exited the channel when the method call returns. Once the user leaves the channel, the SDK triggers the onLeaveChannel callback.
|
abstract |
Renews the token when the current token expires.
The token expires after a period of time once the token schema is enabled when:
The app should retrieve a new token from the server and call this method to renew it. Failure to do so results in the SDK disconnecting from the server.
token | The new token. |
|
abstract |
Enables interoperability with the Agora Web SDK (Live Broadcast only).
Use this method when the channel profile is live broadcast. The interoperability with 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 |
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 in the channel.
|
abstract |
Sets the audio parameters and application scenarios.
profile | Sets the sampling rate, bitrate, encoding mode, and the number of channels. See Audio Profile. |
scenario | Sets the audio application scenarios. See Audio Scenario. |
|
abstract |
Sets the high-quality audio preferences.
fullband | Sets whether to enable/disable full-band codec (48-kHz sampling rate), not compatible with versions before v1.7.4:
|
stereo | Sets whether to enable/disable stereo codec, not compatible with versions before v1.7.4:
|
fullBitrate | Sets whether to enable/disable high-bitrate mode. Recommended in voice-only mode:
|
|
abstract |
Adjusts the recording volume.
volume | Recording volume. The value ranges between 0 and 400:
|
|
abstract |
Adjusts the playback volume.
volume | Playback volume. The value ranges between 0 and 400:
|
|
abstract |
Enables the onAudioVolumeIndication callback at a set time interval to report on which user is speaking and the speaker's volume.
Once this method is enabled, the SDK returns the volume indication in the onAudioVolumeIndication callback at the set time interval, regardless of whether any user is speaking in the channel.
interval | Sets the time interval between two consecutive volume indications:
|
smooth | The smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The greater the value, the more sensitive the indicator. The recommended value is 3. |
|
abstract |
Enables the audio quality notification callbacks.
The onAudioQuality callback triggers periodically after this method is enabled.
enabled | Sets whether to enable/disable the audio quality notification callbacks:
|
|
abstract |
Enables/Disables the local audio capture.
The audio function is enabled by default. This method disables/re-enables the local audio function, that is, to stop or restart local audio capture and processing.
This method does not affect receiving or playing the remote audio streams, and is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
The onMicrophoneEnabled callback is triggered once the local audio function is disabled or re-enabled.
enabled | Sets whether to disable/re-enable the local audio function:
|
|
abstract |
Sends/Stops sending the local audio stream.
muted | Sets whether to send/stop sending the local audio stream:
|
|
abstract |
Receives/Stops receiving a specified audio stream.
uid | ID of the specified remote user. |
muted | Sets whether to receive/stop receiving the specified remote user's audio stream:
|
|
abstract |
Receives/Stops receiving all the audio streams.
muted | Sets whether to receive/stop receiving all remote users' audio streams:
|
|
abstract |
Sets whether to receive the audio streams by default.
Call this method either before or after joining a channel. If you call this method after joining the channel, the audio streams of any subsequent user are not received.
muted | Sets whether or not to receive/stop receiving all remote users' audio streams by default:
|
|
abstract |
Enables the video module.
The app can call this method either before entering a channel or during a call. If the method is called before entering a channel, the service starts in the video mode. If this method is called during an audio call, the audio mode switches to the video mode. To disable the video, call the disableVideo method.
|
abstract |
Disables the video module.
The app may call this method before entering a channel or during a call. If the method is called before entering a channel, the service starts in audio mode. If this method is called during a video call, the video mode switches to the audio mode. To enable the video mode, call the enableVideo method.
|
abstract |
Sets the video encoding profile.
If you do not need to change the video encoding profile after joining the channel, call this method before enableVideo 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 setVideoProfile.
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 setVideoProfile. If the user does not set the video encoding profile after joining the channel, Agora recommends calling this method before enableVideo 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 the bitrate you set is 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. If you do not set the video encoder configuration after joining the channel, you can call this method before enableVideo to reduce the render time of the first video frame.
config | Sets the video encoder configuration. See VideoEncoderConfiguration. |
|
abstract |
Sets the local video view and configures the video display settings on the local device.
The app calls this method to bind each video window (view) of the local video streams and configures the video display settings. Call this method after initialization to configure the local video display settings before entering a channel. The binding is still valid after the user leaves the channel, which means that the window still displays. To unbind the view, set the view in Video Canvas to null.
local | Sets the local video view and settings. See Video Canvas. |
|
abstract |
Sets the remote user's video view.
This method binds the remote user to the video display window (sets the view for the remote user of the specified uid).
Typically, the app specifies the uid of the remote video in the method call before the user joins a channel. If the remote uid 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 onFirstRemoteVideoDecoded callback is triggered.
To unbind the remote user from the view, set the view as null. Once the user leaves the channel, the SDK unbinds the remote user.
remote | Sets the remote video view and settings. See Video Canvas. |
|
abstract |
Sets the local video display mode.
This method may be invoked multiple times during a call to change the display mode.
mode | Sets the local video display mode:
|
|
abstract |
Sets the remote video display mode.
This method can be invoked multiple times during a call to change the display mode.
uid | User ID of the remote user. |
mode | Sets the remote video display mode:
|
|
static |
Creates the video renderer view.
CreateRendererView returns the SurfaceView type. The operation and layout of the view are managed by the app, and the Agora SDK renders the view provided by the app. The video display view must be created using this method instead of directly calling SurfaceView.
|
abstract |
Starts the local video preview before joining the channel.
Before calling this method, you must:
|
abstract |
Stops the local video preview and the video.
|
abstract |
Disables/Re-enables the local video capture.
The local video is enabled by default. This method disables/re-enables the local video and is only applicable when the user wants to watch the remote video without sending any video stream to the other user. Call this method after enableVideo, otherwise this method may not work properly. After enableVideo is called, the local video enables by default. This method is used to disable/re-enable the local video while the remote video remains unaffected.
enabled | Sets whether disable/re-enable the local video, including the capturer, renderer, and sender:
|
|
abstract |
Sends/Stops sending the local video stream.
muted | Sets whether to send/stop sending the local video stream:
|
|
abstract |
Receives/Stops receiving a specified remote video stream.
uid | User ID of the specified remote user. |
muted | Sets whether to receive/stop receiving a specified remote user's video stream:
|
|
abstract |
Receives/Stops receiving all the video streams.
muted | Sets whether to receive/stop receiving all remote users' video streams:
|
|
abstract |
Sets whether to receive the video streams by default.
muted | Sets whether to receive/stop receiving all remote video streams by default:
|
|
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 the channel. If the 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 the channel, call setEnableSpeakerphone.
The default settings for each mode:
defaultToSpeaker | Sets the default audio route:
|
|
abstract |
Enables/Disables the audio playback routing to the speakerphone.
This method sets whether the audio is routed to the speakerphone or earpiece.
See the default audio route explanation in setDefaultAudioRouteToSpeakerphone and check whether it is necessary to call this method.
enabled | Sets whether to route the audio to the speakerphone or earpiece:
|
|
abstract |
Checks whether the speakerphone is enabled.
|
abstract |
Enables in-ear monitoring.
enabled | Sets whether to enable/disable the in-ear monitoring function:
|
|
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 the 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 in 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 |
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 onAudioMixingFinished callback is triggered.
filePath | Specifies the absolute path of the local or online audio file to be mixed. Supported audio formats include mp3, mp4, m4a, aac, 3gp, mkv, wav, and flac. See Supported Media Formats for details.
|
loopback | Sets which user can hear the audio mixing:
|
replace | Sets the audio mixing content:
|
cycle | Sets the number of playback loops:
|
|
abstract |
Stops playing or mixing the music file.
Call this method when you are in a channel.
|
abstract |
Pauses playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Resumes playing and mixing the music file.
Call this method when you are in a channel.
|
abstract |
Adjusts the volume during audio mixing.
Call this method when you are in a channel.
volume | Audio mixing volume. The value ranges between 0 and 100 (default). |
|
abstract |
Gets the duration (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Gets the playback position (ms) of the music file.
Call this method when you are in a channel.
|
abstract |
Sets the playback position (ms) of the music file to a different start position (the default plays from the beginning).
pos | The starting playback position (ms) of the audio mixing file. |
|
abstract |
Retrieves the IAudioEffectManager object associated with the current RtcEngine.
|
abstract |
Starts an audio recording on the client.
The SDK allows recording during a call. Supported formats:
Ensure that the directory to save the recording file exists and is writable. This method is usually called after 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. |
quality | Sets the audio recording quality:
|
|
abstract |
Stops the audio recording on the client.
|
abstract |
Starts an audio call test.
This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
To conduct the test:
|
abstract |
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 disableLastmileTest to disable the test immediately after receiving the onLastmileQuality callback, and before the user joins the channel or switches the user role.
|
abstract |
Disables the network connection quality test.
|
abstract |
Customizes the video source.
Call this method to add an external video source into the SDK.
source | Sets the video source. See IVideoSource. |
|
abstract |
Customizes the local video renderer.
Call this method to add an external renderer into the SDK.
render | Sets the local video renderer. See IVideoSink. |
|
abstract |
Customizes the remote video renderer.
Call this method to add an external renderer into the SDK.
render | Sets the remote video renderer. See IVideoSink. |
|
abstract |
Sets the external audio source.
enabled | Sets whether to enable/disable the external audio source:
|
sampleRate | Sets the sampling rate of the external audio source, which can set be as 8000, 16000, 32000, 44100, or 48000. |
channels | Sets the number of external audio source channels (two channels maximum). |
|
abstract |
Pushes the external audio frame to the Agora SDK for encoding.
data | External audio data to be pushed. |
timestamp | Timestamp of the external audio frame to be synchronized with the external video source. |
|
abstract |
Configures the external video source.
enable | Sets whether or not to use the external video source:
|
useTexture | Sets whether or not to use texture as an input:
|
pushMode | Sets whether or not the external video source needs to call PushExternalVideoFrame 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 setExternalVideoSource and set the pushMode parameter 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 to null to cancel registering, if necessary. |
|
abstract |
Sets the audio recording format for the onRecordFrame callback.
sampleRate | Sets the sampling rate (samplesPerSec ) returned in onRecordFrame, which can set be as 8000, 16000, 32000, 44100, or 48000. |
channel | Sets the number of audio channels (channels ) returned in onRecordFrame:
|
mode | Sets the use mode of the onRecordFrame callback:
|
samplesPerCall | Sets the sample points (samples ) returned in onRecordFrame. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Sets the audio playback format for the onPlaybackFrame callback.
sampleRate | Sets the sampling rate (samplesPerSec ) returned in onPlaybackFrame, which can set be as 8000, 16000, 32000, 44100, or 48000. |
channel | Sets the number of channels (channels ) returned in onPlaybackFrame:
|
mode | Sets the use mode of the onPlaybackFrame callback:
|
samplesPerCall | Sets the sample points (samples ) returned in onPlaybackFrame. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Sets the mixed audio format for the onMixedAudioFrame callback.
sampleRate | Sets the sampling rate (samplesPerSec ) returned in onMixedAudioFrame, which can set be as 8000, 16000, 32000, 44100, or 48000. |
samplesPerCall | Sets the sample points (samples ) returned in onMixedAudioFrame. samplesPerCall is usually set as 1024 for stream pushing. SamplesPerCall = (int)(SampleRate × sampleInterval), where sampleInterval ≥ 0.01 in seconds. |
|
abstract |
Adds a watermark image to the local video.
This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and 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. |
orientationMode
as Adaptive in the setVideoEncoderConfiguration method, the watermark image rotates with the video frame around the upper left corner of the watermark image.
|
abstract |
Removes the watermark image from the video stream added by addVideoWatermark.
|
abstract |
Sets the fallback option for the published video stream based on the network conditions.
If option
is set to STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK will:
When the locally published stream falls back to audio-only or when the audio stream switches back to the video, the onLocalPublishFallbackToAudioOnly callback is triggered.
option | Sets the fallback option for the locally published stream:
|
|
abstract |
Sets the fallback option for the remote stream based on the network conditions.
If option
is set to STREAM_FALLBACK_OPTION_AUDIO_ONLY(2), the SDK automatically switches the video from a high-stream to a low-stream, or disable 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. Once the locally published stream falls back to audio only, or the audio stream switches back to the video stream, the onRemoteSubscribeFallbackToAudioOnly callback is triggered.
option | Sets the fallback option for the remotely subscribed stream:
|
|
abstract |
Enables/Disables the dual-stream mode.
If dual-stream mode is enabled, the receiver can choose to receive the high stream (high-resolution high-bitrate video stream), or low stream (low-resolution low-bitrate video stream).
enabled | Sets the stream mode:
|
|
abstract |
Sets the video stream type of the subscribed stream when the remote user sends dual streams. This method allows the app to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.
The method result returns in the onApiCallExecuted callback. The Agora SDK receives the high-video stream by default to save the bandwidth. If needed, users may use this method to switch to the low-video stream. By default, 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.
uid | ID of the remote user sending the video stream. |
streamType | Sets the video-stream type:
|
|
abstract |
Sets the default video-stream type for the video type of the subscribed stream when the remote user sends dual streams.
streamType | Sets the default video-stream type:
|
|
abstract |
Enables built-in encryption with an encryption password before joining a channel.
All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user leaves the channel. If the encryption password is not specified or set to empty, the encryption functionality is disabled.
secret | Encryption password. |
|
abstract |
Sets the built-in encryption mode.
The Agora SDK supports built-in encryption, which is set to aes-128-xts
mode by default. Call this method to set the encryption mode to use other encryption modes. All users in the same channel must use the same encryption mode and password.
Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
encryptionMode | Sets the encryption mode:
|
|
abstract |
Injects an online media stream to a live broadcast.
The onStreamPublished callback returns the inject status. If this method is called successfully, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all of the audience members in the channel can watch a live show and interact with each other.
The onUserJoined and onFirstRemoteVideoDecoded callbacks are triggered and a stream uid of 666 is returned.
url | HTTP/HTTPS URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and FLV.
|
config | The LiveInjectStreamConfig object which contains the configuration information for the added voice or video stream. |
|
abstract |
Removes the injected online media stream from a live broadcast.
This method removes the HTTP/HTTPS URL address (added by addInjectStreamUrl) from the live broadcast.
If successful, the onUserOffline callback is triggered and a stream uid of 666 is returned.
url | HTTP/HTTPS URL address of the added stream to be removed. |
|
abstract |
Adds a CDN stream address.
The host publishes the stream to the specified CDN live HTTP/HTTPS URL address. This method triggers the onStreamPublished callback.
url | RTMP address, to which the host publishes the stream. |
transcodingEnabled | Sets whether transcoding is enabled/disabled:
|
|
abstract |
Removes a CDN stream address.
This method removes the HTTP/HTTPS URL address (added by addPublishStreamUrl) from a CDN live stream.
url | HTTP/HTTPS URL address to be removed. |
|
abstract |
Sets the video layout and audio settings for CDN live.
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
|
abstract |
Configures the CDN live streaming before joining a channel.
Builder class to configure the push-stream for CDN live: Builder Class.
config | Sets the CDN live streaming settings. See PublisherConfiguration. |
|
abstract |
Sets the picture-in-picture layout for the CDN live broadcast. (CDN live only.)
This method sets the picture-in-picture layouts for live broadcasts. This method is only applicable when you want to push streams to the Agora server. When you push the stream to the Agora server:
The push stream app formats the information of the customized layouts as JSON and packages it in the Supplemental Enhancement Information (SEI) of each keyframe when generating the H.264 video stream and pushing it to the CDN live vendors through the RTMP protocol.
layout | Sets the picture-in-picture layout. See VideoCompositingLayout. |
|
abstract |
Removes the picture-in-picture layout settings created by setVideoCompositingLayout. (CDN live only.)
|
abstract |
Creates a data stream.
Each user can have up to five simultaneous data channels.
reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether or not the recipients receive the data stream in the sent order:
|
reliable
and ordered
parameters to true or false. Do not set one as true and the other as false.
|
abstract |
Sends data stream messages.
The SDK has the following restrictions on this method:
streamId | ID of the sent data stream returned by createDataStream. |
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 startPreview, or the mirror mode does not take effect until you re-enable startPreview.
mode | Sets the local video mirror mode:
|
|
static |
Gets the recommended encoder type.
|
abstract |
Switches between the 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 auto-face focus function is supported.
|
abstract |
Sets the camera zoom ratio.
factor | Sets the camera zoom factor. The value ranges between 1.0 and the maximum zoom supported by the device. |
|
abstract |
Gets the maximum zoom ratio supported by the camera.
|
abstract |
Sets the camera manual focus position.
positionX | Sets the horizontal coordinate of the touch point in the view. |
positionY | Sets 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 rate and complain, 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 the call after the call ends.
callId | ID of the call retrieved from the getCallId method. |
rating | The rating of the call. The value is between 1 (lowest score) and 10 (highest score). |
description | (Optional) The description of the rating. The string length must be less than 800 bytes. |
|
abstract |
Allows a user to complain about the call quality after a call ends.
callId | ID of the call retrieved from the getCallId method. |
description | (Optional) The description of the complaint. The string length must be less than 800 bytes. |
|
static |
Gets the SDK version.
|
static |
Gets the media engine version.
|
abstract |
Specifies an SDK output log file.
The log file records all log data for the SDK’s operation. Ensure that the directory for the log file exists and is writable.
filePath | File path of the log file. The string of the log file is in UTF-8. The default file path is /sdcard/{Package name of the App}/agorasdk.log. |
|
abstract |
Sets the output log level of the SDK.
You can use one or a combination of the filters. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level. For example, if you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
filter | Sets the log filter level:
|
|
abstract |
Gets the native handle of the SDK engine.
This interface is used to retrieve the native C++ handle of the SDK engine used in special scenarios, such as registering the audio and video frame observer.
void io.agora.rtc.RtcEngine.addHandler | ( | IRtcEngineEventHandler | handler | ) |
Adds the IRtcEngineEventHandler class.
The SDK uses the IRtcEngineEventHandler interface class to send callbacks to the app, and the app inherits the methods of the IRtcEngineEventHandler interface class to retrieve the callbacks.
handler | IRtcEngineEventHandler |
|
abstract |
Enables the Wi-Fi mode.
enable | Sets whether to enable/disable the Wi-Fi mode:
|
|
static |
Gets the warning or error description.
error | Detailed warning or error description in Warning Code or Error Code |
|
abstract |
Monitors the external headset device events.
monitor | Sets whether to enable/disable monitoring the external headset device events:
|
|
abstract |
Monitors the Bluetooth headset device events.
monitor | Sets whether to enable/disable monitoring the 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.