This topic describes the AliRtcEngine interface for the Android software development kit (SDK).
Contents
Basic interfaces
| API | Description | Supported in the versions above |
| setH5CompatibleMode | Sets the H5 compatibility mode. | 1.1 |
| getH5CompatibleMode | Checks whether the current mode is H5 compatible. | 1.1 |
| getInstance | Creates an AliRTCEngine instance. Only one instance can exist at a time. This method must be called in the main thread. | 1.1 |
| getInstance | Creates an AliRTCEngine instance and lets you configure special SDK features by passing parameters. Only one instance can exist at a time. This method must be called in the main thread. | 1.1 |
| setRtcEngineEventListener | Sets a listener for local user behavior callbacks. | 1.1 |
| setRtcEngineNotify | Sets a listener for remote user behavior notifications. | 1.1 |
| destroy | Destroys the SDK. | 1.1 |
| uploadLog | Uploads logs. | 1.15 |
Channel-related interfaces
| API | Description | Supported in this and later versions |
| setAutoPublish | Sets whether to automatically publish and subscribe to streams. Use the setAutoPublishSubscribe interface instead. | 1.1 |
| joinChannel | Joins a channel. | 1.1 |
| leaveChannel | Leaves a channel. | 1.1 |
| isInCall | Checks whether the user is in a channel. | 1.1 |
| setChannelProfile | Sets the channel mode. | 1.15 |
| setAutoPublishSubscribe | Sets whether to automatically publish or subscribe to streams. | 1.17 |
Publishing-related interfaces
| API | Description | Supported in the preceding versions |
| isAutoPublish | Queries whether the current mode is auto-publish. | 1.1 |
| configLocalCameraPublish | Sets whether to allow publishing the camera stream. | 1.1 |
| isLocalCameraPublishEnabled | Queries whether publishing the camera stream is allowed. | 1.1 |
| configLocalScreenPublish | Sets whether to allow publishing the screen stream. | 1.1 |
| isLocalScreenPublishEnabled | Queries whether publishing the screen stream is allowed. | 1.1 |
| configLocalAudioPublish | Sets whether to allow publishing the audio stream. | 1.1 |
| isLocalAudioPublishEnabled | Queries whether publishing the audio stream is allowed. | 1.1 |
| configLocalSimulcast | Sets whether to allow publishing the secondary video stream. | 1.1 |
| isLocalSimulcastEnabled | Queries whether publishing the secondary video stream is allowed. | 1.1 |
| publish | Manually publishes video and audio streams. | 1.1 |
Subscription-related interfaces
| API | Description | Supported in the versions above |
| isAutoSubscribe | Queries whether the current mode is auto-subscribe. | 1.1 |
| configRemoteCameraTrack | Sets whether to subscribe to the remote camera stream. | 1.1 |
| configRemoteScreenTrack | Sets whether to subscribe to the remote screen stream. | 1.1 |
| configRemoteAudio | Sets whether to subscribe to the remote audio stream. | 1.1 |
| subscribe | Manually subscribes to video and audio streams. | 1.1 |
| registerTexturePreObserver | Subscribes to pre-processing texture data. | 1.15 |
| unRegisterTexturePreObserver | Unsubscribes from pre-processing texture data. | 1.15 |
Video-related interfaces
| API | Description | Supported in the versions above |
| setVideoProfile | Sets the parameters for the video stream. | 1.1 |
| getVideoProfile | Queries the current video stream parameters. | 1.1 |
| setLocalViewConfig | Sets the rendering window and drawing parameters for the local preview. | 1.1 |
| muteLocalCamera | Sets whether to stop publishing the local video stream. | 1.1 |
| setRemoteViewConfig | Sets the rendering window and drawing parameters for the remote video. | 1.1 |
| switchCamera | Switches between the front and rear cameras. | 1.1 |
| getCurrentCameraType | Gets the current camera type. | 1.1 |
| setPreCameraType | Sets the default camera direction. | 1.1 |
| getPreCameraType | Gets the default camera direction. | 1.1 |
| setCameraZoom | Sets camera parameters. | 1.1 |
| isCameraOn | Checks whether the camera is on. | 1.1 |
| isCameraSupportExposurePoint | Checks whether the camera supports manual exposure. | 1.14 |
| isCameraSupportFocusPoint | Specifies whether the camera supports manual focus. | 1.14 |
| setCameraExposurePoint | Sets the coordinates for manual exposure. | 1.14 |
| setCameraFocusPoint | Sets the coordinates for manual focus. | 1.14 |
| isCameraFlash | Checks whether the flash is on. | 1.14 |
| getCameraZoom | Gets the camera's zoom value. | 1.14 |
| registerPreprocessVideoObserver | Registers for facial recognition pre-processing. | 1.14 |
| muteAllRemoteVideoRendering | Mutes or unmutes the rendering of all remote video tracks. | 1.16.2 |
| setBeautyEffect | Sets basic retouching effects. | 1.17.9 |
| registerVideoSampleObserver | Registers for video data callbacks. | 1.17 |
| unRegisterVideoSampleObserver | Unregisters from video data callbacks. | 1.17 |
| setVideoEncoderConfiguration | Sets video encoding properties. | 1.17.31 |
| isCameraAutoFocus | Checks whether autofocus is enabled. | 1.17 |
| registerVideoRawDataInterface | Registers the external video data callback interface. | 1.17 |
| unRegisterVideoRawDataInterface | Unregisters the external video data callback interface. | 1.17 |
| createRenderSurfaceView | Creates a SurfaceView rendering view. | 1.17.39 |
| createRenderTextureView | Creates a TextureView rendering view. | 1.17.39 |
| enableLocalVideo | Disables or re-enables local video capture. | 1.17.39 |
Audio-related interfaces
| API | Description | Supported in the preceding versions |
| setAudioOnlyMode | Sets the mode to audio-only or audio-and-video. | 1.1 |
| isAudioOnly | Queries whether the current mode is audio-only. | 1.1 |
| muteRemoteAudioPlaying | Sets whether to stop playing the remote audio stream. | 1.1 |
| enableSpeakerphone | Switches between earpiece and speakerphone output. | 1.1 |
| isSpeakerOn | Queries whether the speakerphone is on. | 1.1 |
| startAudioCapture | Starts audio capture. | 1.11 |
| stopAudioCapture | Stops audio capture. | 1.11 |
| startAudioPlayer | Starts audio playback. | 1.11 |
| stopAudioPlayer | Stops audio playback. | 1.11 |
| enableEarBack | Enables in-ear monitoring. | 1.15 |
| startAudioAccompany | Starts playing audio accompaniment. | 1.15 |
| pauseAudioAccompany | Pauses audio accompaniment. | 1.15 |
| resumeAudioAccompany | Resumes audio accompaniment. | 1.15 |
| stopAudioAccompany | Stops playing audio accompaniment. | 1.15 |
| setAudioAccompanyPublishVolume | Sets the publishing volume for audio accompaniment. | 1.15 |
| setAudioAccompanyPlayoutVolume | Sets the local volume for audio accompaniment. | 1.15 |
| getAudioAccompanyPublishVolume | Gets the publishing volume for audio accompaniment. | 1.15 |
| getAudioAccompanyPlayoutVolume | Gets the local volume for audio accompaniment. | 1.15 |
| setAudioAccompanyVolume | Sets the publishing and local volumes for audio accompaniment. | 1.15 |
| preloadAudioEffect | Preloads a sound effect. | 1.15 |
| unloadAudioEffect | Purges a preloaded sound effect. | 1.15 |
| playAudioEffect | Starts playing a sound effect. | 1.15 |
| setAudioEffectPublishVolume | Sets the publishing volume for a sound effect. | 1.15 |
| getAudioEffectPublishVolume | Gets the publishing volume for a sound effect. | 1.15 |
| setAudioEffectPlayoutVolume | Sets the local volume for a sound effect. | 1.15 |
| getAudioEffectPlayoutVolume | Gets the local volume for a sound effect. | 1.15 |
| pauseAudioEffect | Pauses a sound effect. | 1.15 |
| resumeAudioEffect | Resumes a sound effect. | 1.15 |
| stopAudioEffect | Stops a sound effect. | 1.15 |
| setEarBackVolume | Sets the in-ear monitoring volume. | 1.15 |
| setRecordingVolume | Sets the recording volume. | 1.16 |
| setPlayoutVolume | Sets the playback volume. | 1.16 |
| muteAllRemoteAudioPlaying | Stops playing all remote audio streams. | 1.16.2 |
| registerAudioVolumeObserver | Registers for volume callbacks. | 1.16.2 |
| unRegisterAudioVolumeObserver | Unregisters from volume callbacks. | 1.16.2 |
| startRecord | Starts recording to a file. | 1.17 |
| stopRecord | Stops recording to a file. | 1.17 |
| setAudioEffectReverbMode | Sets the reverb effect mode. | 1.17 |
| setAudioEffectReverbParamType | Sets the reverb effect type. | 1.17 |
| setVolumeCallbackIntervalMs | Sets the volume callback frequency and smoothing coefficient. | 1.17 |
| setExternalAudioSource | Sets whether to use external audio data as the input source for stream ingest. | 1.17.9 |
| pushExternalAudioFrameRawData | Inputs audio data. | 1.17.9 |
| setExternalAudioVolume | Sets the external audio input volume. | 1.17.9 |
| getExternalAudioVolume | Gets the external audio input volume. | 1.17.9 |
| setMixedWithMic | Sets whether to mix external audio input with audio captured by the microphone. | 1.17.9 |
| setExteranlAudioRender | Sets whether to enable playback of external audio input. | 1.17.9 |
| pushExternalAudioRenderRawData | Inputs audio playback data. | 1.17.9 |
| getCurrentClientRole | Gets the current role. | 1.17.9 |
| setSubscribeAudioNumChannel | Sets the number of sound channels for the audio callback. | 1.17.13 |
| setSubscribeAudioSampleRate | Sets the audio sampling rate for the audio callback. | 1.17.13 |
| requestAudioFocus | Requests audio focus. | 1.17.19 |
| abandonAudioFocus | Abandons audio focus. | 1.17.19 |
| registerAudioObserver | Registers for audio data callbacks. | 1.17 |
| muteLocalMic | Captures local audio. | 1.17.30 |
| getAudioAccompanyDuration | Gets the duration of the audio accompaniment file. | 1.17.30 |
| getAudioAccompanyCurrentPosition | Gets the playback progress of the music file. | 1.17.30 |
| setAudioAccompanyPosition | Sets the playback position of the audio file. | 1.17.30 |
| stopAllAudioEffects | Stops playing all sound effects. | 1.17.30 |
| setAllAudioEffectsPublishVolume | Sets the publishing volume for all sound effects. | 1.17.30 |
| setAllAudioEffectsPlayoutVolume | Sets the local playback volume for all sound effects. | 1.17.30 |
| pauseAllAudioEffects | Pauses all sound effects. | 1.17.30 |
| resumeAllAudioEffects | Resumes playing all sound effects. | 1.17.30 |
| unRegisterAudioObserver | Unregisters from audio data callbacks. | 1.17 |
Preview interfaces
| API | Description | The preceding versions are supported |
| startPreview | Starts the local preview. | 1.1 |
| stopPreview | Stops the local preview. | 1.1 |
| enableHighDefinitionPreview | Sets whether to enable high-definition preview. | 1.16 |
Remote user query interfaces
| API | Description | Supported since |
| getOnlineRemoteUsers | Gets the list of online remote users. | 1.1 |
| getUserInfo | Queries remote user information. | 1.1 |
| isUserOnline | Queries whether a user is online. | 1.1 |
| getMediaInfoWithUserId | Gets media stream information. | 1.9 |
Other interfaces
| API | Description | Supported in the above versions |
| setLogLevel | Sets the log level. | 1.1 |
| getSdkVersion | Gets the SDK version number. | 1.1 |
| setClientRole | Sets the user role. | 1.16 |
| setLogDirPath | Sets the path to save SDK log files. | 1.16.2 |
| setDeviceOrientationMode | Sets the device orientation (portrait or landscape). | 1.16.2 |
| startNetworkQualityProbeTest | Starts a network quality probe test. | 1.16.2 |
| stopNetworkQualityProbeTest | Stops a network quality probe test. | 1.16.2 |
| postFeedback | Submits SDK issue feedback. | 1.17.13 |
| sendMediaExtensionMsg | Sends a media extension message. | 1.17.1 |
| respondMessageNotification | Sends a message notification. | 1.17 |
| refreshAuthInfo | Refreshes the token. | 1.17.41 |
API details
setH5CompatibleMode: Sets whether to enable H5 compatibility.
Parameter descriptionAliRtcEngine.setH5CompatibleMode(int enable)Name Type Description enable int 0 indicates not compatible with H5. 1 indicates compatible with H5. The default is not compatible with H5. Important You must call this method before you create an `AliRtcEngine` instance.getH5CompatibleMode: Checks whether H5 compatibility is enabled.
public static int getH5CompatibleMode()Return value
A value of 1 indicates compatibility. A value of 0 indicates incompatibility.
Important You must call this method after you create an `AliRtcEngine` instance.getInstance: Creates an `AliRtcEngine` instance.
Parameter descriptionpublic static AliRtcEngineImpl getInstance(Context context)Name Type Description context Context The context of the Android Activity. Important Only one instance can exist at a time. You must call this method in the main thread.getInstance: Creates an `AliRtcEngine` instance and lets you configure special SDK features by passing parameters.
Parameter descriptionpublic static AliRtcEngineImpl getInstance(Context context, String extras)Name Type Description context Context The context of the Android Activity. extras String Configures special SDK features using JSON. For more information, see extras features. Important Only one instance can exist at a time. You must call this method in the main thread.setRtcEngineEventListener: Sets a listener for local user event callbacks.
Parameter descriptionpublic abstract void setRtcEngineEventListener(AliRtcEngineEventListener listener)Name Type Description listener AliRtcEngineEventListener The listener that receives callback events. setRtcEngineNotify: Sets a listener for remote user event notifications.
Parameter descriptionpublic abstract void setRtcEngineNotify(AliRtcEngineNotify engineNotify)Name Type Description engineNotify AliRtcEngineNotify The listener that receives notifications. destroy: Destroys the SDK instance.
In versions 1.15 and later, you can destroy the SDK only by calling the `destroy` method.
In versions earlier than 1.15, the `AliRtcEngine` instance is destroyed when you leave a channel. To perform subsequent operations, such as joining another channel, you must call `getInstance` again to re-initialize the `AliRtcEngine` instance.
public abstract void destroy();Important You must call this method in the main thread.uploadLog: Uploads log files.
AliRtcEngine.uploadLog();Important This method is `static` in versions 1.17 and later. In earlier versions, usepublic abstract void uploadLog();.setAutoPublish: Controls whether to automatically publish and subscribe to streams.
Parameterspublic int setAutoPublish(boolean autoPub, boolean autoSub);Name Type Description autoPub boolean `true`: Auto-publish. `false`: Manual publish. The default is auto-publish. autoSub boolean `true`: Auto-subscribe. `false`: Manual subscribe. The default is auto-subscribe. Return value
A return value of 0 indicates that the method call succeeded. Any other value indicates that it failed.
Important You must set this method before joining a channel.joinChannel: Joins a channel.
After you successfully join a channel, you must call `leaveChannel` to leave the current channel before you can join another one. If joining a channel fails, you do not need to call `leaveChannel` before you retry.
Parameter descriptionpublic abstract void joinChannel(AliRtcAuthInfo authInfo, String userName)Name Type Description authInfo AliRtcAuthInfo Authentication information. userName String The user's display name, not the user ID. leaveChannel: Leaves a channel.
public abstract void leaveChannel()In versions 1.15 and later, calling `leaveChannel` does not destroy the instance.
In versions earlier than 1.15, the `AliRtcEngine` instance is destroyed when you leave a channel. To perform subsequent operations, such as joining another channel, you must call `getInstance` again to re-initialize the `AliRtcEngine` instance.
- For SDK versions 1.8 and later, call the following method.
public abstract void leaveChannel() - For SDK versions 1.7 and earlier, you must add the timeout parameter. We recommend that you set this parameter to 1000, which specifies a timeout of 1 second for the method call.
public abstract void leaveChannel(long timeout)
- For SDK versions 1.8 and later, call the following method.
isInCall: Checks whether the user is in a channel.
public abstract boolean isInCall()Return value
Returns `true` if the user is in a channel or `false` otherwise.
setChannelProfile: Sets the channel mode.
Parameter descriptionpublic abstract int setChannelProfile(AliRTCSDK_Channel_Profile profile);Name Type Description profile AliRTCSDK_Channel_Profile The channel mode type. The default is communication mode. Return value
Returns 0 on success. A non-zero value indicates failure.
Important You can call this method only before `joinChannel`. You cannot reset the channel mode during a call. You can reset the channel mode after you call `leaveChannel`.setAutoPublishSubscribe: Sets whether to automatically publish or subscribe to streams.
Parameter descriptionpublic abstract int setAutoPublishSubscribe(boolean autoPub, boolean autoSub);Name Type Description autoPub boolean `true`: Auto-publish. `false`: Manual publish. The default is auto-publish. autoSub boolean `true`: Auto-subscribe. `false`: Manual subscribe. The default is auto-subscribe. Return value
Returns 0 on success. A non-zero value indicates failure.
Note You must call this method before joining a channel.isAutoPublish: Checks whether auto-publish is enabled.
public abstract boolean isAutoPublish()Return value
truespecifies automatic publishing, andfalsespecifies manual publishing.configLocalCameraPublish: Configures whether to publish the local camera stream.
Parameter descriptionpublic abstract void configLocalCameraPublish(boolean enable)Name Type Description enable boolean `true` allows publishing the camera stream. `false` disallows it. The default is to allow publishing the camera stream. Important In manual publishing mode, you must call `publish` for this setting to take effect.isLocalCameraPublishEnabled: Checks whether publishing the local camera stream is enabled.
public abstract boolean isLocalCameraPublishEnabled()Return value
A value of true indicates that it is allowed. A value of false indicates that it is not allowed.
configLocalScreenPublish: Configures whether to publish the local screen stream.
Parameter descriptionpublic abstract void configLocalScreenPublish(boolean enable)Name Type Description enable boolean `true` allows publishing the screen stream. `false` disallows it. The default is to not allow publishing the screen stream. Important In manual publishing mode, you must call `publish` for this setting to take effect.isLocalScreenPublishEnabled: Checks whether publishing the local screen stream is enabled.
public abstract boolean isLocalScreenPublishEnabled()Return value
Returns `true` if publishing the screen stream is enabled or `false` if it is not.
configLocalAudioPublish: Configures whether to publish the local audio stream.
Parameter descriptionpublic abstract void configLocalAudioPublish(boolean enable)Name Type Description enable boolean `true` allows publishing. `false` disallows it. The default is to allow publishing the audio stream. Important In manual publishing mode, you must call `publish` for this setting to take effect.isLocalAudioPublishEnabled: Checks whether publishing the local audio stream is enabled.
Return valuepublic abstract boolean isLocalAudioPublishEnabled()Returns `true` if publishing the audio stream is enabled or `false` if it is not.
configLocalSimulcast: Configures whether to publish the secondary video stream.
Parameter descriptionpublic abstract int configLocalSimulcast(boolean enable, AliRtcVideoTrack track)Name Type Description enable boolean `true` allows publishing the secondary stream. `false` disallows it. The default is to allow publishing the secondary video stream. track AliRtcVideoTrack The stream type. Currently, only AliVideoTrackCamera (camera stream) is supported. Return value
Returns 0 on success. A non-zero value indicates failure.
Important In manual publishing mode, you must call `publish` for this setting to take effect.isLocalSimulcastEnabled: Checks whether publishing the secondary video stream is enabled.
public abstract boolean isLocalSimulcastEnabled()Return value
Returns `true` if publishing the secondary video stream is enabled or `false` if it is not.
publish: Manually publishes video and audio streams.
public abstract void publish()- The behavior of `publish` depends on the configurations that are set by methods such as `configLocalCameraPublish`, `configLocalScreenPublish`, `configLocalAudioPublish`, and `configLocalSimulcast`.
- You can configure the parameters of the preceding four methods to publish the corresponding video and audio streams.
- You can use the `publish` method to both start and stop publishing.
- To stop publishing, set the parameters of all four configuration methods to `false`, and then call `publish`.
- You must call this method after you successfully join a channel.
isAutoSubscribe: Checks whether auto-subscribe is enabled.
public abstract boolean isAutoSubscribe()Return value
trueindicates automatic subscription, andfalseindicates manual subscription.configRemoteCameraTrack: Sets whether to subscribe to the remote camera stream.
Parameter descriptionpublic abstract void configRemoteCameraTrack(String uid, boolean master, boolean enable)Name Type Description uid String The user ID. master boolean `true` subscribes to the main stream. `false` subscribes to the substream. The default is to subscribe to the main stream. enable boolean The default is not to subscribe. `true` subscribes to the remote camera stream. `false` stops subscribing to the remote camera stream. Important When you perform stream operations such as manual subscription or unsubscribing, you must call `subscribe` for this setting to take effect.configRemoteScreenTrack: Sets whether to subscribe to the remote screen stream.
Parameter descriptionpublic abstract void configRemoteScreenTrack(String uid, boolean enable)Name Type Description uid String The user ID. enable boolean `true` subscribes to the remote screen stream. `false` stops subscribing to the remote screen stream. The default is not to subscribe to the remote screen stream. Important When you perform stream operations such as manual subscription or unsubscribing, you must call `subscribe` for this setting to take effect.configRemoteAudio: Sets whether to subscribe to the remote audio stream.
Parameter descriptionpublic abstract void configRemoteAudio(String uid, boolean enable)Name Type Description uid String The user ID. enable boolean `true` subscribes to the remote audio stream. `false` stops subscribing to the remote audio stream. The default is to subscribe to the remote audio stream. Important When you perform stream operations such as manual subscription or unsubscribing, you must call `subscribe` for this setting to take effect.subscribe: Manually subscribes to video and audio streams.
public abstract int subscribe(String uid)- The behavior of `subscribe` depends on the configurations that are set by methods such as `configRemoteCameraTrack`, `configRemoteScreenTrack`, and `configRemoteAudio`.
- You can configure the parameters of the preceding three methods to subscribe to the corresponding video and audio streams.
- You can use the `subscribe` method to both start and stop a subscription.
- To stop subscribing, set the parameters of all three configuration methods to `false`, and then call `subscribe`.
Name Type Description uid String The user ID. Return value
Returns 0 if the method is executed. To confirm whether the subscription is successful, check the subscription callback result. A non-zero value indicates that the method execution was interrupted and the subscription failed.
- registerTexturePreObserver: Subscribes to pre-processing texture data.
Parameter descriptionpublic abstract void registerTexturePreObserver(String userId, AliRtcEngine.AliTextureObserver observer);Name Type Description userId String The ID of the user to subscribe to. For local retouching, you can enter an empty string ("") or the local user ID. observer AliTextureObserver The video stream callback interface. - unRegisterTexturePreObserver: Unsubscribes from pre-processing texture data.
Parameter descriptionpublic abstract void unRegisterTexturePreObserver(String userId);Name Type Description userId String The ID of the user to subscribe to. For local retouching, you can enter an empty string ("") or the local user ID. setVideoProfile: Sets the video stream parameters.
Parameter descriptionpublic abstract void setVideoProfile(AliRtcVideoProfile profile, AliRtcVideoTrack track)Name Type Description profile AliRtcVideoProfile Video stream parameters. The default is a camera stream with a resolution of 480 × 640 and a frame rate of 15. track AliRtcVideoTrack The type of video stream to set. The default is the camera stream. getVideoProfile: Retrieves the current video stream parameters.
Parameter descriptionpublic abstract AliRtcVideoProfile getVideoProfile(AliRtcVideoTrack track)Name Type Description track AliRtcVideoTrack The type of video stream to query. Return value
This method returns AliRtcVideoProfile (video stream specification data type).
setLocalViewConfig: Sets the rendering window and drawing parameters for the local preview.
public abstract int setLocalViewConfig(AliVideoCanvas viewConfig, AliRtcVideoTrack track)- This method lets you switch the rendering window before or after you join a channel. If `viewConfig` or its rendering view member is `null`, rendering stops.
- To reset the rendering mode during playback, keep the other member variables in `viewConfig` unchanged and modify only `renderMode`.
- The default rendering mode in `viewConfig` is `AliRtcRenderModeAuto`.
Name Type Description viewConfig AliVideoCanvas Rendering parameters, including the rendering window and rendering mode. track AliRtcVideoTrack The preview video track type can only be AliVideoTrackCamera (camera stream). muteLocalCamera: Mutes or unmutes the local video stream.
Parameter descriptionpublic abstract int muteLocalCamera(boolean mute, AliRtcVideoTrack track)Name Type Description mute boolean `true` stops publishing the video stream. `false` resumes publishing. The default is to resume publishing. track AliRtcVideoTrack The type of video track whose publishing state needs to be changed. The default is the camera stream. Return value
Returns 0 on success. A non-zero value indicates failure.
Important This method does not change the capture state of the video stream.setRemoteViewConfig: Sets the rendering window and drawing parameters for the remote video.
public abstract int setRemoteViewConfig(AliVideoCanvas canvas, String uid, AliRtcVideoTrack track)- This method lets you switch the rendering window before or after you join a channel. If `canvas` or its rendering view member is `null`, rendering of the corresponding stream stops.
- To reset the rendering mode during playback, keep the other member variables in `canvas` unchanged and modify only `renderMode`.
- The default rendering mode in `canvas` is `AliRtcRenderModeAuto`.
- We recommend that you call this method after the subscription result callback.
Name Type Description canvas AliVideoCanvas Rendering parameters, including the rendering window and rendering mode. uid String The user ID. track AliRtcVideoTrack The type of video track to set. Return value
Returns 0 on success. A non-zero value indicates failure.
switchCamera: Switches between the front and rear cameras.
public abstract int switchCamera()Return value
Returns 0 on success. A non-zero value indicates failure.
getCurrentCameraType: Retrieves the current camera type.
Returns the camera type AliRTCCameraType.
public abstract AliRTCCameraType getCurrentCameraType()setPreCameraType: Sets the default camera direction.
Parameter descriptionpublic abstract void setPreCameraType(int faceTo)Name Type Description faceTo int 0 for rear-facing, 1 for front-facing. The default value is 1. getPreCameraType: Retrieves the default camera direction.
public abstract int getPreCameraType()Return value
Returns 0 for the rear camera or 1 for the front camera.
setCameraZoom: Sets the camera zoom factor.
Parameter descriptionpublic abstract int setCameraZoom(float zoom, boolean flash, boolean autoFocus)Name Type Description zoom float The zoom level. The default value is 1.0. flash boolean `true` turns on the flash. `false` turns it off. The default is off. autoFocus boolean `true` enables autofocus. `false` disables it. The default is disabled. Return value
Returns 0 on success. A non-zero value indicates failure.
isCameraOn: Checks whether the camera is on.
public abstract boolean isCameraOn()Return value
Returns `true` if the camera is on or `false` if it is off.
isCameraSupportExposurePoint: Checks whether the camera supports manual exposure.
public abstract boolean isCameraSupportExposurePoint();Return value
trueindicates that the feature is supported.falseindicates that the feature is not supported.isCameraSupportFocusPoint: Checks whether the camera supports manual focus.
public abstract boolean isCameraSupportFocusPoint();Return value
A value of
trueindicates that the feature is supported. A value offalseindicates that the feature is not supported.setCameraExposurePoint: Sets the coordinates for manual exposure.
Parameter descriptionpublic abstract int setCameraExposurePoint(float x, float y);Name Type Description x float The x-coordinate. y float The y-coordinate. Return value
Returns 0 on success. A non-zero value indicates failure.
setCameraFocusPoint: Sets the coordinates for manual focus.
Parameter descriptionpublic abstract int setCameraFocusPoint(float x, float y);Name Type Description x float The x-coordinate. y float The y-coordinate. Return value
Returns 0 on success. A non-zero value indicates failure.
isCameraFlash: Checks whether the camera flash is on.
public abstract boolean isCameraFlash();Return value
truemeans enabled, andfalsemeans disabled.getCameraZoom: Retrieves the camera zoom value.
public abstract float getCameraZoom();Return value
The return value ranges from 0.0 to 1.0. A value of 0 indicates the minimum zoom that is supported by the camera. A value of 1 indicates the maximum zoom that is supported by the camera.
registerPreprocessVideoObserver: Registers for facial recognition pre-processing.
Parameter descriptionpublic abstract void registerPreprocessVideoObserver(AliDetectObserver observer);Name Type Description observer AliDetectObserver Facial recognition pre-processing. muteAllRemoteAudioPlaying: Mutes all remote audio streams.
Parameter descriptionpublic abstract int muteAllRemoteAudioPlaying(boolean mute);Name Type Description mute boolean `true` stops playback. `false` resumes playback. The default is to resume playback. Return value
Returns 0 on success. Other values are error codes.
Important This method does not affect subscription or decoding. You can call this method before or after you join a channel.setAudioOnlyMode: Switches between audio-only mode and audio-and-video mode.
Parameter descriptionpublic abstract int setAudioOnlyMode(boolean audioOnly)Name Type Description audioOnly boolean `true` indicates only audio is published and subscribed. `false` indicates both audio and video are supported. The default is audio-and-video mode. Return value
Returns 0 on success. A non-zero value indicates failure.
Note The default mode is audio-and-video. You must call this method before you call `joinChannel`.isAudioOnly: Checks whether the current mode is audio-only.
public abstract boolean isAudioOnly()Return value
Returns `true` if the mode is audio-only or `false` if the mode is audio-and-video.
muteRemoteAudioPlaying: Mutes or unmutes a remote audio stream.
Parameter descriptionpublic abstract int muteRemoteAudioPlaying(String uid, boolean mute)Name Type Description uid String The user ID. mute boolean `true` stops playback. `false` resumes playback. The default is to resume playback. Return value
Returns 0 on success or -1 on failure.
enableSpeakerphone: Switches the audio output between the earpiece and the speakerphone.
Parameter descriptionpublic abstract int enableSpeakerphone(boolean enable)Name Type Description enable boolean `true` for speakerphone mode. `false` for earpiece mode. The default is speakerphone mode. Return value
Returns 0 on success. A non-zero value indicates failure.
Important You must call this method in the main thread.isSpeakerOn: Checks whether the speakerphone is enabled.
public abstract boolean isSpeakerOn()Return value
Returns `true` if the speakerphone is on or `false` if it is off.
startAudioCapture: Starts audio capture.
You can start audio capture in advance. If you do not call this method, the SDK starts audio capture when stream ingest begins.
public int startAudioCapture();Return value
Returns 0 on success. A non-zero value indicates failure.
stopAudioCapture: Stops audio capture.
This method lets you control when to stop audio capture.
public int stopAudioCapture();startAudioPlayer: Starts audio playback.
You can start audio playback in advance. If you do not call this method, the SDK starts audio playback after a stream is successfully subscribed.
public int startAudioPlayer();Return value
Returns 0 on success. A non-zero value indicates failure.
stopAudioPlayer: Stops audio playback.
public int stopAudioPlayer();Return value
Returns 0 on success. A non-zero value indicates failure.
Important You must call this method before joining a channel.enableEarBack: Enables or disables in-ear monitoring.
Parameter descriptionpublic abstract int enableEarBack(boolean enable);Name Type Description enable boolean `true` enables in-ear monitoring. `false` disables it. The default is disabled. Return value
Returns 0 on success. A non-zero value indicates failure.
startAudioAccompany: Starts playing audio accompaniment.
Parameter descriptionpublic abstract int startAudioAccompany(String fileName, boolean onlyLocalPlay, boolean replaceMic, int loopCycles);Name Type Description fileName String The path of the accompaniment file. Supports local files and network URLs. onlyLocalPlay boolean `true` for local playback only. `false` for local playback and publishing to remote users. replaceMic boolean `true` replaces the local microphone audio stream with the accompaniment audio stream. `false` publishes both the accompaniment and microphone audio streams simultaneously. loopCycles int The number of times to loop playback. -1 indicates infinite looping. Return value
Returns 0 on success. A non-zero value indicates failure.
pauseAudioAccompany: Pauses audio accompaniment.
public abstract int pauseAudioAccompany();Return value
Returns 0 on success. A non-zero value indicates failure.
resumeAudioAccompany: Resumes audio accompaniment.
public abstract int resumeAudioAccompany();Return value
Returns 0 on success. A non-zero value indicates failure.
stopAudioAccompany: Stops playing audio accompaniment.
public abstract int stopAudioAccompany();Return value
Returns 0 on success. A non-zero value indicates failure.
setAudioAccompanyPublishVolume: Sets the publishing volume for audio accompaniment.
Parameter descriptionpublic abstract int setAudioAccompanyPublishVolume(int volume);Name Type Description volume int The publishing volume for the accompaniment. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
setAudioAccompanyPlayoutVolume: Sets the local playback volume for audio accompaniment.
Parameter descriptionpublic abstract int setAudioAccompanyPlayoutVolume(int volume);Name Type Description volume int The local playback volume for the accompaniment. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
getAudioAccompanyPublishVolume: Retrieves the publishing volume for audio accompaniment.
public abstract int getAudioAccompanyPublishVolume();Return value
Returns the publishing volume of the accompaniment. The value ranges from 0 to 100. A return value of -1 indicates failure.
getAudioAccompanyPlayoutVolume: Retrieves the local playback volume for audio accompaniment.
public abstract int getAudioAccompanyPlayoutVolume();Return value
Returns the publishing volume of the accompaniment. The value ranges from 0 to 100. A return value of -1 indicates failure.
setAudioAccompanyVolume: Sets the publishing and local playback volumes for audio accompaniment.
Parameter descriptionpublic abstract int setAudioAccompanyVolume(int volume);Name Type Description volume int The local playback volume for the accompaniment. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
preloadAudioEffect: Preloads a sound effect.
Parameter descriptionpublic abstract int preloadAudioEffect(int soundId, String filePath);Name Type Description soundId int The sound effect ID, generated by the caller. filePath String The path of the sound effect file. Return value
Returns 0 on success. A non-zero value indicates failure.
unloadAudioEffect: Unloads a preloaded sound effect.
Parameter descriptionpublic abstract int unloadAudioEffect(int soundId);Name Type Description soundId int The sound effect ID. This should be the same ID passed during preloading. Return value
Returns 0 on success. A non-zero value indicates failure.
playAudioEffect: Starts playing a sound effect.
Parameter descriptionpublic abstract int playAudioEffect(int soundId, String filePath, int cycles, boolean publish);Name Type Description soundId int The sound effect ID. filePath String The path of the sound effect file. Supports local files and network URLs. cycles int The number of times to loop playback. -1 indicates infinite looping. publish boolean Whether to publish the sound effect audio stream to remote users. Return value
Returns 0 on success. A non-zero value indicates failure.
setAudioEffectPublishVolume: Sets the publishing volume for a sound effect.
Parameter descriptionpublic abstract int setAudioEffectPublishVolume(int soundId, int volume);Name Type Description soundId int The sound effect ID. volume int The publishing volume for the sound effect. The value ranges from 0 to 100. Return value
Returns 0 on success. A non-zero value indicates failure.
getAudioEffectPublishVolume: Retrieves the publishing volume for a sound effect.
Returns the publishing volume of the sound effect. The value ranges from 0 to 100. A return value of -1 indicates failure.
Parameter descriptionpublic abstract int getAudioEffectPublishVolume(int soundId);Name Type Description soundId int The sound effect ID. Return value
Returns the publishing volume of the sound effect. The value ranges from 0 to 100. A return value of -1 indicates failure.
setAudioEffectPlayoutVolume: Sets the local playback volume for a sound effect.
Parameter descriptionpublic abstract int setAudioEffectPlayoutVolume(int soundId, int volume);Name Type Description soundId int The sound effect ID. volume int The local playback volume for the sound effect. The value ranges from 0 to 100. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
getAudioEffectPlayoutVolume: Retrieves the local playback volume for a sound effect.
Parameter descriptionpublic abstract int getAudioEffectPlayoutVolume(int soundId);Name Type Description soundId int The sound effect ID. Return value
Returns the local playback volume of the sound effect. The value ranges from 0 to 100. A return value of -1 indicates failure.
pauseAudioEffect: Pauses a sound effect.
Parameter descriptionpublic abstract int pauseAudioEffect(int soundId);Name Type Description soundId int The sound effect ID. Return value
Returns 0 on success. A non-zero value indicates failure.
resumeAudioEffect: Resumes a sound effect.
Parameter descriptionpublic abstract int resumeAudioEffect(int soundId);Name Type Description soundId int The sound effect ID. Return value
Returns 0 on success. A non-zero value indicates failure.
stopAudioEffect: Stops a sound effect.
Parameter descriptionpublic abstract int stopAudioEffect(int soundId);Name Type Description soundId int The sound effect ID. Return value
Returns 0 on success. A non-zero value indicates failure.
setEarBackVolume: Sets the in-ear monitoring volume.
Parameter descriptionpublic abstract int setEarBackVolume(int volume);Name Type Description volume int The in-ear monitoring volume. The value ranges from 0 to 100. You can only set the volume when in-ear monitoring is enabled. Otherwise, the method returns an error. The default value is 100. Return value
Returns 0 on success. A non-zero value indicates failure.
setRecordingVolume: Sets the recording volume.
Parameter descriptionpublic abstract int setRecordingVolume(int volume);Name Type Description volume int The volume. The value ranges from 0 to 400. 0 means mute. The default value is 100. - Values greater than 100 amplify the volume.
- Values less than 100 reduce the volume.
Return value
Returns 0 on success. A non-zero value indicates failure.
Important Recording volume adjustment: You can call this method if a remote user finds the playback volume too low even after the device's physical volume is set to the maximum. The recommended value is 100 to 200. Values over 200 may degrade audio quality.setPlayoutVolume: Sets the playback volume.
Parameter descriptionpublic abstract int setPlayoutVolume(int volume);Name Type Description volume int The volume. The value ranges from 0 to 400. 0 means mute. The default value is 100. - Values greater than 100 amplify the volume.
- Values less than 100 reduce the volume.
Return value
Returns 0 on success. A non-zero value indicates failure.
Important Playback volume adjustment: You can call this method if the local user finds the playback volume too low even after the device's physical volume is set to the maximum. The recommended value is 100 to 200. Values over 200 may degrade audio quality.muteAllRemoteVideoRendering: Mutes or unmutes the rendering of all remote video tracks.
Parameter descriptionpublic abstract int muteAllRemoteVideoRendering(boolean mute);Name Type Description mute boolean `true` stops rendering. `false` resumes rendering. The default is to resume rendering. Return value
Returns 0 on success. Other values are error codes.
Important This method does not affect subscription or decoding. You can call this method before or after you join a channel.setBeautyEffect: Sets basic retouching effects.
Parameter descriptionpublic abstract int setBeautyEffect(boolean enable, AliRtcEngine.AliRtcBeautyConfig config);Name Type Description enable boolean `true` enables effects. `false` disables them. The default is disabled. config AliRtcBeautyConfig Basic retouching parameters. Return value
Returns 0 on success. A non-zero value indicates failure.
Important Currently, only whitening and smoothing are supported.registerVideoSampleObserver: Registers for video data callbacks.
public abstract void registerVideoSampleObserver(AliRtcEngine.AliVideoObserver aliVideoObserver);For more information, see Audio and video output.
Parameter descriptionName Type Description aliVideoObserver AliVideoObserver The video data callback interface. - unRegisterVideoSampleObserver: Unregisters from video data callbacks.
public abstract void unRegisterVideoSampleObserver(); - setVideoEncoderConfiguration: Sets video encoding properties.
Parameter descriptionpublic abstract void setVideoEncoderConfiguration(AliRtcEngine.AliRtcVideoEncoderConfiguration config);Name Type Description config AliRtcVideoEncoderConfiguration Predefined video encoding properties. - isCameraAutoFocus: Checks whether autofocus is enabled.
public abstract boolean isCameraAutoFocus();Return value
Returns `true` if autofocus is enabled or `false` if it is not.
- registerVideoRawDataInterface: Registers the external video data callback interface.For more information, see Input external video stream.
Parameter descriptionpublic abstract VideoRawDataInterface registerVideoRawDataInterface(AliRawDataStreamType streamType, AliRtcRenderMode renderMode);Name Type Description streamType AliRawDataStreamType The video stream type. renderMode AliRtcRenderMode The rendering mode. Return value
Returns the VideoRawDataInterface stream processing object.
- unRegisterVideoRawDataInterface: Unregisters the external video data callback interface.For more information, see Input external video stream.
Parameter descriptionpublic abstract void unRegisterVideoRawDataInterface(AliRawDataStreamType streamType);Name Type Description streamType AliRawDataStreamType The video stream type. - createRenderSurfaceView: Creates a SurfaceView rendering view.
public abstract SophonSurfaceView createRenderSurfaceView(Context context);Parameter description
Name Type Description context Context The context of the Android Activity. - createRenderTextureView: Creates a TextureView rendering view.
public abstract SophonTextureView createRenderTextureView(Context context);Parameter description
Name Type Description context Context The context of the Android Activity. - enableLocalVideo: Disables or re-enables local video capture.
public abstract int enableLocalVideo(boolean enabled);Parameter description
Name Type Description enabled boolean Disables or re-enables local video capture. Valid values: - YES: Enable.
- NO: Disable.
Return value
Returns 0 on success. A non-zero value indicates failure.
registerAudioVolumeObserver: Registers for volume callbacks.
Parameter descriptionpublic abstract void registerAudioVolumeObserver(AliRtcEngine.AliRtcAudioVolumeObserver observer);Name Type Description observer AliRtcAudioVolumeObserver The volume interface. - unRegisterAudioVolumeObserver: Unregisters from volume callbacks.
public abstract void unRegisterAudioVolumeObserver(); startRecord: Starts recording audio to a file.
public abstract boolean startRecord(AliRtcEngine.AliRtcRecordType recordType, AliRtcEngine.AliRtcRecordFormat recordFormat, String path, AliRtcEngine.AliRtcRecordAudioConfig audioConfig, AliRtcEngine.AliRtcRecordVideoConfig videoConfig);The recorded audio includes external input PCM data, locally captured audio, and audio data from remote streams.
Parameter descriptionName Type Description recordType AliRtcRecordType The record type. recordFormat AliRtcRecordFormat The file format. path String The path to store the recording file. audioConfig AliRtcRecordAudioConfig The audio property configuration for the recording. Return value
Returns `true` on success or `false` on failure.
stopRecord: Stops recording.
public abstract void stopRecord();You can use this method in conjunction with `startRecord`. Recording stops automatically after you call `leaveChannel`.
setAudioEffectReverbMode: Sets the reverb effect mode.
Parameter descriptionpublic abstract int setAudioEffectReverbMode(AliRtcEngine.AliRTCSDK_AudioEffect_Reverb_Mode mode);Name Type Description mode AliRTCSDK_AudioEffect_Reverb_Mode The reverb mode type. The default is off. Return value
Returns 0 on success. A non-zero value indicates failure.
setAudioEffectReverbParamType: Sets the reverb effect type.
Parameter descriptionpublic abstract int setAudioEffectReverbParamType(AliRtcEngine.AliRTCSDK_AudioEffect_Reverb_Param_Type type, float value);Name Type Description type AliRTCSDK_AudioEffect_Reverb_Param_Type The reverb effect type. value float The value corresponding to the reverb effect type. Return value
Returns 0 on success. A non-zero value indicates failure.
setVolumeCallbackIntervalMs: Sets the volume callback frequency and smoothing coefficient.
Parameter descriptionpublic abstract int setVolumeCallbackIntervalMs(int interval, int smooth, int reportVad);Name Type Description interval int The time interval in ms. The minimum value is 10 ms. The default is 160 ms. smooth int The smoothing coefficient. A higher value means more smoothing. A lower value means better real-time performance. The value ranges from 0 to 9. The default is 3. reportVad int The local voice activity detection switch. The default value is 1. Valid values: - 1: Enabled. The callback is triggered through the onAudioVolumeCallback interface.
- 0: Disabled.
Return value
Returns 0 on success. Returns -1 if the interval is set to less than 10. Returns -2 if the smoothing coefficient is out of range.
setExternalAudioSource: Enables or disables using an external audio source for stream ingest.
Parameter descriptionpublic abstract int setExternalAudioSource(boolean enable, int sampleRate, int channelsPerFrame);Name Type Description enable boolean `true` enables using external audio data as the stream ingest input source. `false` stops it. sampleRate int The sample rate of the external audio data. channelsPerFrame int The number of sound channels for the external audio data. Mono and stereo are currently supported. Return value
Returns 0 on success. A non-zero value indicates failure.
pushExternalAudioFrameRawData: Inputs external audio data.
Parameter descriptionpublic abstract int pushExternalAudioFrameRawData(byte[] data, int samples, long timestamp);Name Type Description data byte[] The audio data. We recommend that the data not exceed 40 ms. samples int The sample rate. timestamp long The timestamp. You can pass 0 for now. Return value
Returns 0 on success. A non-zero value indicates failure.
setExternalAudioVolume: Sets the external audio input volume.
Parameter descriptionpublic abstract int setExternalAudioVolume(int volume);Name Type Description volume int The volume. The value ranges from 0 to 100. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
getExternalAudioVolume: Retrieves the external audio input volume.
public abstract int getExternalAudioVolume();Return value
Returns 0 on success. A non-zero value indicates failure.
setMixedWithMic: Enables or disables mixing external audio with audio that is captured by the microphone.
Parameter descriptionpublic abstract int setMixedWithMic(boolean mixed);Name Type Description mixed boolean `true` enables mixing. `false` completely replaces the microphone-captured data. The default is to mix. Return value
Returns 0 on success. A non-zero value indicates failure.
setExteranlAudioRender: Enables or disables local playback of external audio.
Parameter descriptionpublic abstract int setExteranlAudioRender(boolean enable, int sampleRate, int channelsPerFrame);Name Type Description enable boolean `true` enables using external audio as the local playback input source. `false` stops it. sampleRate int The sample rate of the external audio data. channelsPerFrame int The number of sound channels for the external audio data. Mono and stereo are currently supported. Return value
Returns 0 on success. A non-zero value indicates failure.
pushExternalAudioRenderRawData: Inputs external audio data for local playback.
Parameter descriptionpublic abstract int pushExternalAudioRenderRawData(byte[] audioSamples, int sampleLength, int sampleRate, int channelsPerFrame, long timestamp);Name Type Description audioSamples byte[] The audio data. sampleLength int The length of the audio data. sampleRate int The audio sampling rate. channelsPerFrame int The number of audio channels. timestamp long The timestamp. You can pass 0 for now. Return value
Returns 0 on success. A non-zero value indicates failure.
getCurrentClientRole: Retrieves the current user role.
public abstract AliRtcEngine.AliRTCSDK_Client_Role getCurrentClientRole();Return value
Returns the current user role.
setSubscribeAudioNumChannel: Sets the number of sound channels for the subscribed audio callback.
Parameter descriptionpublic abstract void setSubscribeAudioNumChannel(AliRtcAudioNumChannel numChannel);Name Type Description numChannel AliRtcAudioNumChannel The audio channel. The default is mono audio. setSubscribeAudioSampleRate: Sets the audio sampling rate for the subscribed audio callback.
Parameter descriptionpublic abstract void setSubscribeAudioSampleRate(AliRtcAudioSampleRate sampleRate);Name Type Description sampleRate AliRtcAudioSampleRate The audio sampling rate. The default is 16K. - requestAudioFocus: Requests audio focus.
public abstract int requestAudioFocus()Return value
Returns 0 on success. A non-zero value indicates failure.
- abandonAudioFocus: Abandons audio focus.
public abstract int abandonAudioFocus()Return value
Returns 0 on success. A non-zero value indicates failure.
- registerAudioObserver: Registers for audio data callbacks.
public abstract void registerAudioObserver(AliRtcEngine.AliAudioType audioType, AliRtcEngine.AliAudioObserver audioObserver);You can specify the type of audio data to output. To output multiple types of data, you must register each type separately. After registration, audio data is continuously returned through the `AliAudioObserver` callback. For more information, see Audio and video output.
Parameter descriptionName Type Description audioType AliAudioType The type of audio data for the callback. audioObserver AliAudioObserver The audio data callback interface. muteLocalMic: Mutes the local audio capture.
Parameter descriptionpublic abstract int muteLocalMic(boolean mute, AliRtcEngine.AliRtcMuteLocalAudioMode var2);Name Type Description mute boolean YES sends empty frames for local audio capture. NO does not send empty frames. mode AliRtcMuteLocalAudioMode The local mute mode. Return value
Returns 0 on success. A non-zero value indicates failure.
getAudioAccompanyDuration: Retrieves the duration of the accompaniment file in milliseconds.
public int getAudioAccompanyDuration();getAudioAccompanyCurrentPosition: Retrieves the playback progress of the accompaniment file in milliseconds.
public int getAudioAccompanyCurrentPosition();setAudioAccompanyPosition: Sets the playback position of the accompaniment file.
Parameter descriptionpublic int setAudioAccompanyPosition(int posMs);Name Type Description posMs AliRtcMuteLocalAudioMode The local mute mode. Return value
Returns 0 on success. A non-zero value indicates failure.
stopAllAudioEffects: Stops playing all sound effects.
public abstract int stopAllAudioEffects();Return value
Returns 0 on success. A non-zero value indicates failure.
setAllAudioEffectsPublishVolume: Sets the publishing volume for all sound effects.
Parameter descriptionpublic abstract int setAllAudioEffectsPublishVolume(int volume);Name Type Description volume int The mixing volume. The value ranges from 0 to 100. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
setAllAudioEffectsPlayoutVolume: Sets the local playback volume for all sound effects.
Parameter descriptionpublic abstract int setAllAudioEffectsPlayoutVolume(int volume);Name Type Description volume int The mixing volume. The value ranges from 0 to 100. The default value is 50. Return value
Returns 0 on success. A non-zero value indicates failure.
pauseAllAudioEffects: Pauses all sound effects.
public abstract int pauseAllAudioEffects();Return value
Returns 0 on success. A non-zero value indicates failure.
resumeAllAudioEffects: Resumes playing all sound effects.
public abstract int resumeAllAudioEffects();Return value
Returns 0 on success. A non-zero value indicates failure.
unRegisterAudioObserver: Unregisters from audio data callbacks.
Parameter descriptionpublic abstract void unRegisterAudioObserver(AliAudioType type);Name Type Description type AliAudioType The type of audio data for the callback. startPreview: Starts the local preview.
public abstract int startPreview()Return value
Returns 0 on success. A non-zero value indicates failure.
Important You can start the local preview before you join a channel. You must call `setLocalViewConfig` before you start the preview.stopPreview: Stops the local preview.
public abstract int stopPreview()Return value
Returns 0 on success. A non-zero value indicates failure.
enableHighDefinitionPreview: Enables or disables high-definition preview.
Returns 0 on success. Returns -1 if the operation fails.
Parameter descriptionpublic abstract int enableHighDefinitionPreview(boolean enable);Name Type Description enable boolean `true` enables high-definition preview. `false` disables it. High-definition preview is enabled by default. Return value
Returns 0 on success or -1 on failure.
getOnlineRemoteUsers: Retrieves a list of online remote users.
public abstract String[] getOnlineRemoteUsers()Return value
Returns a list of user IDs.
Important This method has a delay when called while joining a channel. We recommend that you call this method after the onRemoteUserOnLineNotify callback is triggered or maintain your own remote user list.getUserInfo: Retrieves the information of a remote user.
Parameter descriptionpublic abstract AliRtcRemoteUserInfo getUserInfo(String uid)Name Type Description uid String The user ID. Return value
Returns an AliRtcRemoteUserInfo object.
isUserOnline: Checks whether a specified user is online.
Parameter descriptionpublic abstract boolean isUserOnline(String uid)Name Type Description uid String The user ID. Return value
Returns `true` if the user is online or `false` if the user is offline.
getMediaInfoWithUserId: Retrieves media stream information.
Parameter descriptionpublic String getMediaInfoWithUserId(String userId, AliRtcVideoTrack track, String[] keys);Name Type Description userId String The user ID for which to get media stream information. track AliRtcVideoTrack The type of media stream to query. keys String[] The array of key values to query. setLogLevel: Sets the log level.
Parameter descriptionpublic abstract void setLogLevel(AliRtcLogLevel logLevel)Name Type Description logLevel AliRtcLogLevel The log level. The default value is AliRtcLogLevelInfo. getSdkVersion: Retrieves the SDK version number.
public abstract String getSdkVersion()setClientRole: Sets the user role.
Parameter descriptionpublic abstract int setClientRole(AliRTCSDK_Client_Role role);Name Type Description role AliRTCSDK_Client_Role The user role type. The default is viewer role. Return value
Returns 0 on success. A non-zero value indicates failure.
Important You can call this method only when the channel mode is `InteractiveLive`. You can set the role before or during a session. On success, you receive the `onUpdateRoleNotify` callback. To switch the role from Interactive to Live, you must stop stream ingest first. Otherwise, the method call fails.setLogDirPath: Sets the path where the SDK log files are saved.
Parameter descriptionpublic static int setLogDirPath(String logDirPath)Name Type Description logDirPath String The absolute path to save log files. Return value
Returns 0 on success. Other values are error codes.
Important You must call this method before you call any other SDK methods to prevent log loss. You must also ensure that the specified directory exists and is writable.setDeviceOrientationMode: Sets the device orientation (portrait or landscape).
Parameter descriptionpublic abstract void setDeviceOrientationMode(AliRtcEngine.AliRtcOrientationMode mode);Name Type Description mode AliRtcOrientationMode The device orientation. Valid values: - AliRtcOrientationModePortrait (default): Fixed portrait mode.
- AliRtcOrientationModeLandscapeLeft: Fixed left landscape mode.
- AliRtcOrientationModeLandscapeRight: Fixed right landscape mode.
- AliRtcOrientationModeAuto: Automatic rotation mode.
Return value
Returns 0 on success. Other values are error codes.
Important Currently, only fixed portrait and landscape modes are supported. You must set the orientation before you publish a stream or start a preview.startNetworkQualityProbeTest: Starts a network quality probe test.
public abstract int startNetworkQualityProbeTest();Return value
Returns 0 on success. Other values are error codes.
Important You must call this method before you join a channel. The test stops automatically after you join the channel. The test results are returned in the onNetworkQualityProbeTest callback.stopNetworkQualityProbeTest: Stops a network quality probe test.
public abstract int stopNetworkQualityProbeTest();Return value
Returns 0 on success. Other values are error codes.
- postFeedback: Submits SDK issue feedback.Parameter description
public abstract void postFeedback(String uid, String channelId, String description, AliRtcFeedbackType type, long timeStamp);Name Type Description uid String The current user ID. channelId String The current channel ID. description String The problem description (supports Chinese and English). type AliRtcFeedbackType The problem type (see AliRtcFeedbackType comments). timeStamp long The timestamp when the problem occurred (Unix timestamp). Approximate time is acceptable. You can pass 0. - sendMediaExtensionMsg: Sends a media extension message.
Parameter descriptionpublic abstract int sendMediaExtensionMsg(byte[]message, int repeatCount);Parameter Type Description message String Custom message data. The length is limited to 8 bytes. repeatCount int The number of times to send the message. Return value
- 0: The message is sent.
- -1: You are not publishing a stream, so custom messages cannot be sent.
- -2: A parameter is invalid. The message length exceeds 8 bytes, or `repeatCount` is less than or equal to 0.
- -3: Messages are sent too frequently. You must reduce the sending frequency.
Important You can use the audio and video data tunnel to send custom messages to other users in the channel. The following prerequisites must be met:- You have joined the channel and are publishing a stream.
- Other users in the channel have subscribed to your audio and video streams. After the message is sent, the result is returned in the onMediaExtensionMsgReceived callback.
- respondMessageNotification: Sends a message notification.
Parameter descriptionpublic abstract int respondMessageNotification(String tid, String contentType, String content);Parameter Type Description tid String The message ID. contentType String The message content type. content String The message content. Return value
Returns 0 on success. A non-zero value indicates failure.
- refreshAuthInfo: Refreshes the token.
Parameter descriptionpublic abstract int refreshAuthInfo(AliRtcAuthInfo auth_info);Parameter Type Description auth_info AliRtcAuthInfo User authentication information. Return value
Returns 0 on success. A non-zero value indicates failure.