AliRtcEngine interface

更新时间:
复制 MD 格式

This topic describes the AliRtcEngine interface for the Android SDK.

Interface description

For details about all APIs, see AliRtcEngine.

Contents

Basic interfaces

API

Description

Minimum supported version

setH5CompatibleMode

Sets the H5 compatibility mode.

1.1

getH5CompatibleMode

Checks if H5 compatibility mode is enabled.

1.1

getInstance

Creates an AliRtcEngine instance. Only one instance can exist at a time. This method can only be called from the main thread.

1.17

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 can only be called from the main thread.

1.17

destroy

Destroys the SDK instance.

1.1

uploadLog

You can manually upload logs.

1.1

setRtcEngineEventListener

Sets a listener for local user behavior callback events.

1.1

setRtcEngineNotify

Sets a listener for remote user behavior notification events.

1.1

Channel-related interfaces

API

Description

Minimum supported version

joinChannel

Joins a channel.

1.1

leaveChannel

Leaves a channel.

1.1

switchChannel

Switches to a different channel.

2.1

isInCall

Checks if the user is in a channel.

1.1

setChannelProfile

You can set the channel mode.

1.15

createChannel

Creates an AliRtcEngine sub-channel instance.

2.1

destroyChannel

Destroys a sub-channel instance.

2.1

Publishing-related interfaces

API

Description

Minimum supported version

publishLocalVideoStream

Sets whether to publish the local video stream.

2.1

isLocalVideoStreamPublished

Queries whether the local video stream is being published.

1.1

isScreenSharePublished

Queries whether the screen sharing stream is being published.

1.1

publishLocalAudioStream

Sets whether to publish the local audio stream.

2.1

isLocalAudioStreamPublished

Queries whether the local audio stream is being published.

1.1

publishLocalDualStream

Sets whether to publish the secondary video stream.

2.1

isDualStreamPublished

Queries whether the secondary video stream is being published.

2.1

Subscription-related interfaces

API

Description

Minimum supported version

setRemoteVideoStreamType

Sets the subscribed camera stream type to the main stream or the substream.

2.1

setRemoteDefaultVideoStreamType

Sets the default subscribed camera stream type to the main stream or the substream.

2.1

setDefaultSubscribeAllRemoteAudioStreams

Sets whether to subscribe to remote audio streams by default.

2.1

subscribeAllRemoteAudioStreams

Stops or resumes subscribing to all remote audio streams.

2.1

subscribeRemoteAudioStream

Stops or resumes pulling the audio stream of a specific remote user.

2.1

setDefaultSubscribeAllRemoteVideoStreams

Sets whether to subscribe to remote video streams by default.

2.1

subscribeAllRemoteVideoStreams

Stops or resumes subscribing to all remote video streams.

2.1

subscribeRemoteVideoStream

Stops or resumes pulling the video stream of a specific remote user.

2.1

Video-related interfaces

API

Description

Minimum supported version

createRenderSurfaceView

Creates a SurfaceView rendering view.

2.1

createRenderTextureView

Creates a TextureView rendering view.

2.1

setScreenShareEncoderConfiguration

Sets the encoding properties for screen sharing.

2.1

setLocalViewConfig

Sets the rendering window and drawing parameters for the local preview.

1.1

setCameraCapturerConfiguration

Sets the camera capture preference.

2.1

enableLocalVideo

Disables or re-enables local video capture.

2.1

muteLocalCamera

Sets whether to stop publishing the local video stream.

1.1

muteAllRemoteVideoRendering

Stops or resumes rendering all remote video streams.

2.1

setRemoteViewConfig

Sets the rendering window and drawing parameters for a remote video stream.

1.1

isCameraOn

Checks if the camera is on.

1.1

stopRecord

Stops recording.

1.17

startRecord

Starts recording.

1.17

setBeautyEffect

Sets the basic retouching effect.

1.17.9

setVideoEncoderConfiguration

Sets the video encoding properties.

2.1

addVideoWatermark

Adds a watermark.

2.1

clearVideoWatermark

Clears the watermark information for the corresponding data stream.

2.1

snapshotVideo

Takes a snapshot.

2.1

switchCamera

Switches between the front and rear cameras. The front camera is used by default.

1.1

getCurrentCameraDirection

Gets the current camera direction.

1.1

setCameraZoom

Sets the camera zoom factor.

1.1

setCameraFlash

Sets whether to turn on the camera flash.

1.14

setCameraFocusPoint

Sets the manual focus point for the camera.

1.14

setCameraExposurePoint

Sets the camera exposure point.

1.14

isCameraAutoFocusFaceModeSupported

Checks if the camera supports face autofocus.

2.1

setCameraAutoFocusFaceModeEnabled

Enables or disables camera face autofocus.

2.1

getVideoCaptureData

Manually gets captured data.

2.4

getVideoPreEncoderData

Manually gets pre-encoding data.

2.4

getVideoRenderData

Manually gets stream pulling data.

2.4

Video sharing interfaces

API

Description

Minimum supported version

startScreenShare

Starts screen sharing.

2.1

startScreenShare

Starts screen sharing.

2.1

stopScreenShare

Stops screen sharing.

2.1

Audio-related interfaces

API

Description

Minimum supported version

setAudioOnlyMode

Sets the mode to audio-only or audio and video.

1.1

isAudioOnly

Queries whether the current mode is audio-only.

1.1

muteLocalMic

Pauses or resumes sending local audio data.

1.1

muteRemoteAudioPlaying

Sets whether to stop playing a remote audio stream.

1.1

muteAllRemoteAudioPlaying

Stops or resumes playing all remote audio streams.

1.16.2

startAudioCapture

Starts audio capture.

1.1

startAudioCapture

Starts audio capture.

2.2

stopAudioCapture

Stops audio capture.

1.1

startAudioPlayer

Starts the audio playback device.

1.1

stopAudioPlayer

Stops audio playback.

1.1

setRemoteAudioVolume

Sets the local playback volume of a specific remote user.

2.1

enableSpeakerphone

Sets the audio output to the earpiece or the speaker.

2.1

isSpeakerOn

Gets whether the current audio output is the earpiece or the speaker.

2.1

setRecordingVolume

Sets the recording volume.

1.16.2

setPlayoutVolume

Sets the playback volume.

1.16.2

enableAudioVolumeIndication

Sets the volume callback frequency and smoothing coefficient.

1.17.9

setAudioProfile

Sets the audio profile.

2.1

enableAudioDTX

Enables local audio traffic shaping (voice).

2.1

enableAudioAMD

Enables local audio traffic shaping (microphone).

2.1

setAudioEffectVoiceChangerMode

Sets the voice changer effect mode.

2.1

setAudioEffectPitchValue

Sets the pitch parameter.

2.1

setAudioEffectReverbMode

Sets the reverb effect mode.

2.1

setAudioEffectReverbParamType

Sets the reverb effect type and specific parameters.

2.1

startAudioAccompany

Starts audio mixing.

1.15

stopAudioAccompany

Stops audio mixing.

1.15

setAudioAccompanyVolume

Sets the audio mixing volume.

1.15

setAudioAccompanyPublishVolume

Sets the volume of the mixed audio for stream ingest.

1.15

getAudioAccompanyPublishVolume

Gets the volume of the mixed audio for stream ingest.

1.15

setAudioAccompanyPlayoutVolume

Sets the local playback volume of the mixed audio.

1.15

getAudioAccompanyPlayoutVolume

Gets the local playback volume of the mixed audio.

1.15

pauseAudioAccompany

Pauses audio mixing.

1.15

resumeAudioAccompany

Resumes audio mixing.

1.15

getAudioAccompanyDuration

Gets the duration of the 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

preloadAudioEffect

Preloads a sound effect file.

1.15

unloadAudioEffect

Deletes a preloaded sound effect file.

1.15

playAudioEffect

Starts playing a sound effect.

1.15

stopAudioEffect

Stops playing a sound effect.

1.15

stopAllAudioEffects

Stops playing all sound effects.

1.15

setAudioEffectPublishVolume

Sets the stream ingest volume for a sound effect.

1.15

getAudioEffectPublishVolume

Gets the stream ingest volume for a sound effect.

1.15

setAudioEffectPlayoutVolume

Sets the local playback volume for a sound effect.

1.15

getAudioEffectPlayoutVolume

Gets the local playback volume for a sound effect.

1.15

setAllAudioEffectsPublishVolume

Sets the stream ingest mixing volume for all sound effects.

1.15

setAllAudioEffectsPlayoutVolume

Sets the local playback volume for all sound effects.

1.15

pauseAudioEffect

Pauses a sound effect.

1.15

pauseAllAudioEffects

Pauses all sound effects.

1.15

resumeAudioEffect

Resumes playing a sound effect.

1.15

resumeAllAudioEffects

Resumes playing all sound effects.

1.15

enableEarBack

Enables in-ear monitoring.

1.15

setEarBackVolume

Sets the in-ear monitoring volume.

1.15

requestAudioFocus

Requests audio focus.

1.17.19

abandonAudioFocus

Abandons audio focus.

1.17.19

Media engine interfaces

API

Description

Minimum supported version

registerVideoSampleObserver

Registers a video data output object.

1.17

unRegisterVideoSampleObserver

Unregisters a video data output object.

1.17

registerLocalVideoTextureObserver

Registers an observer for OpenGL texture data from the local camera stream.

1.15

unRegisterLocalVideoTextureObserver

Unregisters the observer for OpenGL texture data from the local camera stream.

1.15

registerAudioObserver

Subscribes to audio data output.

1.17

unRegisterAudioObserver

Unsubscribes from audio data output.

1.17

setSubscribeAudioNumChannel

Sets the number of output audio channels.

2.1

setSubscribeAudioSampleRate

Sets the output audio sampling rate.

2.1

registerAudioVolumeObserver

Registers a volume data output object.

1.16.2

unRegisterAudioVolumeObserver

Unregisters a volume data output object.

1.16.2

setExternalVideoSource

Enables an external video input source.

2.1

pushExternalVideoFrame

Inputs video data.

2.1

setExternalAudioSource

Sets whether to enable an external audio input source.

1.17.9

pushExternalAudioFrameRawData

Inputs audio data.

1.17.9

setExternalAudioVolume

Sets the external audio volume.

1.17.9

getExternalAudioVolume

Gets the audio mixing volume.

1.17.9

setMixedWithMic

Sets whether to mix the external audio input with the audio captured by the microphone.

1.17.9

setExteranlAudioRender

Sets whether to enable playback for external audio input.

1.17.9

pushExternalAudioRenderRawData

Inputs external audio playback data.

1.17.9

Live stream bypass interfaces

API

Description

Minimum supported version

startPublishLiveStream

Starts a bypass live stream.

2.4

updatePublishLiveStream

Updates the parameters for the bypass live stream.

2.4

stopPublishLiveStream

Stops the bypass live stream.

2.1

getPublishLiveStreamState

Gets the status of the bypass live stream.

2.4

Cross-channel co-streaming interfaces

API

Description

Minimum supported version

startChannelRelay

Starts cross-channel co-streaming.

2.1

updateChannelRelay

Updates cross-channel co-streaming.

2.1

stopChannelRelay

Stops cross-channel co-streaming.

2.1

Preview interfaces

API

Description

Minimum supported version

startPreview

Starts the local preview.

1.1

stopPreview

Stops the local preview.

1.1

Remote user query interfaces

API

Description

Minimum supported version

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

Other interfaces

API

Description

Minimum supported version

setLogDirPath

Sets the path to save the SDK log files.

1.17

setLogLevel

Sets the log level.

1.1

getSdkVersion

Gets the SDK version number.

2.4

getErrorDescription

Gets the description of an error code.

2.1

setClientRole

Sets the user role.

1.16

getCurrentClientRole

Gets the user role.

1.17.19

startNetworkQualityProbeTest

Starts a network quality probe test.

1.16.2

stopNetworkQualityProbeTest

Stops the network quality probe test.

1.16.2

respondMessageNotification

Sends a downstream channel message.

2.1

uplinkChannelMessage

Sends an upstream channel message.

2.1

postFeedback

SDK feedback.

1.17.12

sendMediaExtensionMsg

Sends media extension information.

1.17.1

startIntelligentDenoise

Enables intelligent noise reduction.

1.17.19

stopIntelligentDenoise

Disables intelligent noise reduction.

1.17.19

refreshAuthInfo

Refreshes the authentication information.

1.17.41

getCurrentConnectionStatus

Gets the current network connection status.

2.1

showDebugView

Shows the dashboard.

2.4

Interface details

  • setH5CompatibleMode: Enables or disables H5 compatibility mode.

    public static int setH5CompatibleMode(int enable);

    Parameters

    Parameter

    Type

    Description

    enable

    int

    Specifies whether to enable H5 compatibility. Valid values:

    • 0 (default): Disables H5 compatibility.

    • 1: Enables H5 compatibility.

    Important

    In the current version, you cannot change the H5 compatibility mode after an AliRtcEngine instance is created. You must call this method before creating the instance.

  • getH5CompatibleMode: Checks whether H5 compatibility mode is enabled.

    public static int getH5CompatibleMode();

    Return value

    Returns 1 if H5 compatibility is enabled. Returns 0 if H5 compatibility is disabled.

  • getInstance: Obtains an AliRtcEngine instance.

    public static AliRtcEngineImpl getInstance(Context context);

    Parameters

    Parameter

    Type

    Description

    context

    Context

    The context of the Android Activity.

    Important

    Only one primary instance can exist at a time. This method can only be called from the main thread.

  • getInstance: Returns an AliEngineEngine instance.

    public static AliRtcEngineImpl getInstance(Context context,String extras);

    This method lets you configure special SDK features by passing parameters.

    Parameters

    Parameter

    Type

    Description

    context

    Context

    The context of the Android Activity.

    extras

    String

    Configures special SDK features in JSON format. For more information, see extras parameter configurations. If you do not need special features, pass an empty string: @"".

    Important

    Only one primary instance can exist at a time. This method can only be called from the main thread.

  • destroy: Destroys the SDK instance.

    public abstract void destroy();
    Important

    Call this method after all operations are complete.

  • uploadLog: Enables automatic log uploads. This feature is enabled by default.

    public static void uploadLog();
  • setRtcEngineEventListener: Sets a listener for local user behavior notification events.

    public abstract void setRtcEngineEventListener(AliRtcEngineEventListener listener);

    Parameters

    Parameter

    Type

    Description

    listener

    AliRtcEngineEventListener

    The listener for local user behavior notification events.

  • setRtcEngineNotify: Sets a listener for remote user behavior notification events.

    public abstract void setRtcEngineNotify(AliRtcEngineNotify listener);

    Parameters

    Parameter

    Type

    Description

    listener

    AliRtcEngineEventListener

    The listener for remote user behavior notification events.

  • joinChannel: Joins a channel.

    public abstract int joinChannel(AliRtcAuthInfo authInfo, String userName);

    After successfully joining a channel, you must call leaveChannel to leave the current channel before joining another one. If you fail to join a channel and need to retry, you do not need to call leaveChannel first.

    Parameters

    Parameter

    Type

    Description

    authInfo

    AliRtcAuthInfo

    The authentication information.

    userName

    String

    The display name of the user, not the user ID.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Important

    This is an asynchronous method. To check whether the user has successfully joined the channel, listen for the onJoinChannelResult callback.

  • leaveChannel: Leaves a channel.

    public abstract int leaveChannel();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Note

    For versions 1.15 and later, you can only destroy the engine instance by calling the destroy method. For versions earlier than 1.15, the AliEngine instance is destroyed when you leave a channel. To perform subsequent operations such as joining a channel, you must call the getInstance method again to initialize a new AliEngine instance.

    If the user is not in a channel, calling leaveChannel has no effect on the instance but sends a notification to other users in the channel.

  • switchChannel: Switches to a different channel.

    public abstract int switchChannel(AliRtcAuthInfo authInfo);

    Parameters

    Parameter

    Type

    Description

    authInfo

    AliRtcAuthInfo

    The authentication information.

    Return value

    This method is used in interactive live streaming mode (AliRTCSdkInteractiveLive) by users with the viewer role (AliRTCSdkLive).

    This is an asynchronous method. After you call this method to switch channels, the SDK first triggers the onLeaveChannelResult callback for leaving the original channel, and then triggers the onJoinChannelResult callback for joining the new channel.

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    • If ERR_SDK_INVALID_STATE is returned, check whether the channel profile or user role is incorrect, or whether the user is not currently in a channel.

    • If ERR_INVALID_ARGUMENTS is returned, check whether the authentication information is valid or whether you are trying to join the same channel.

    • ERR_INNER indicates an internal SDK error.

  • isInCall: Checks whether the user is in a channel.

    public abstract boolean isInCall();

    Return value

    Returns true if the user is in a channel. Returns false otherwise.

  • setChannelProfile: Sets the channel profile.

    public abstract int setChannelProfile(AliRTCSdkChannelProfile channelProfile);

    Parameters

    Parameter

    Type

    Description

    channelProfile

    AliRTCSdkChannelProfile

    The channel profile. The default value is AliEngineCommunication.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Important

    You can only call this method before joining a channel. You cannot reset the channel profile while in a meeting. You can reset it after leaving the channel.

  • createChannel: Creates an AliEngine sub-channel instance.

    public abstract AliRtcEngine createChannel(String extras);

    Parameters

    Parameter

    Type

    Description

    extras

    String

    Configures special SDK features in JSON format. For more information, see extras parameter configurations. If you do not need special features, pass an empty string: @"".

    Return value

    Returns the sub-channel instance if successful. Returns null otherwise.

  • destroyChannel: Destroys a sub-channel created by createChannel.

    public abstract void destroyChannel();
  • publishLocalVideoStream: Enables or disables publishing of the camera stream.

    public abstract int publishLocalVideoStream(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to publish the camera stream. Valid values:

    • true (default): Publishes the camera stream.

    • false: Does not publish the camera stream.

  • isLocalVideoStreamPublished: Queries whether the camera stream is being published.

    public abstract boolean isLocalVideoStreamPublished();

    Return value

    Returns true if the camera stream is being published. Returns false otherwise.

  • isScreenSharePublished: Queries whether the screen sharing stream is being published.

    public abstract boolean isScreenSharePublished();

    Return value

    Returns true if the screen sharing stream is being published. Returns false otherwise.

  • publishLocalAudioStream: Enables or disables publishing of the audio stream.

    public abstract int publishLocalAudioStream(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to publish the audio stream. Valid values:

    • true (default): Publishes the audio stream.

    • false: Does not publish the audio stream.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isLocalAudioStreamPublished: Queries whether the audio stream is being published.

    public abstract boolean isLocalAudioStreamPublished();

    Return value

    Returns true if the audio stream is being published. Returns false otherwise.

  • publishLocalDualStream: Enables or disables publishing of the secondary video stream.

    public abstract int publishLocalDualStream(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to publish the secondary video stream. Valid values:

    • true: Publishes the secondary video stream.

    • false (default): Does not publish the secondary video stream.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isDualStreamPublished: Queries whether the secondary video stream is being published.

    public abstract boolean isDualStreamPublished();

    Return value

    Returns true if the secondary video stream is being published. Returns false otherwise.

  • setRemoteVideoStreamType: Sets the subscribed camera stream type to the main stream or the substream.

    public abstract int setRemoteVideoStreamType(String uid, AliRtcVideoStreamType streamType);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The remote user ID.

    streamType

    AliRtcVideoStreamType

    The camera stream type. The default value is AliRtcVideoStreamTypeHigh (main stream).

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setRemoteDefaultVideoStreamType: Sets the default subscribed camera stream type to the main stream or the substream.

    public abstract int setRemoteDefaultVideoStreamType(AliRtcVideoStreamType streamType);

    Parameters

    Parameter

    Type

    Description

    streamType

    AliRtcVideoStreamType

    The camera stream type. The default value is AliRtcVideoStreamTypeHigh (main stream).

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setDefaultSubscribeAllRemoteAudioStreams: Sets whether to subscribe to remote audio streams by default.

    public abstract int setDefaultSubscribeAllRemoteAudioStreams(boolean sub);

    Parameters

    Parameter

    Type

    Description

    sub

    boolean

    Specifies whether to subscribe to remote audio streams by default. Valid values:

    • true (default): Subscribes to remote audio streams by default.

    • false: Does not subscribe to remote audio streams by default.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • subscribeAllRemoteAudioStreams: Enables or disables subscription to all remote audio streams.

    public abstract int subscribeAllRemoteAudioStreams(boolean sub);

    Parameters

    Parameter

    Type

    Description

    sub

    boolean

    Specifies whether to subscribe to all remote audio streams. Valid values:

    • true (default): Subscribes to all remote audio streams.

    • false: Does not subscribe to all remote audio streams.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • subscribeRemoteAudioStream: Stops or resumes pulling the audio stream of a specific remote user.

    public abstract int subscribeRemoteAudioStream(String uid, boolean sub);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The remote user ID.

    sub

    boolean

    Specifies whether to stop or resume pulling the audio stream of a specific remote user. Valid values:

    • true (default): Resumes.

    • false: Stops.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setDefaultSubscribeAllRemoteVideoStreams: Sets whether to subscribe to remote video streams by default.

    public abstract int setDefaultSubscribeAllRemoteVideoStreams(boolean sub);

    Parameters

    Parameter

    Type

    Description

    sub

    boolean

    Specifies whether to subscribe to remote video streams by default. Valid values:

    • true (default): Subscribes by default.

    • false: Does not subscribe by default.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • subscribeAllRemoteVideoStreams: Stops or resumes subscribing to all remote video streams.

    public abstract int subscribeAllRemoteVideoStreams(boolean sub);

    Parameters

    Parameter

    Type

    Description

    sub

    boolean

    Specifies whether to stop or resume subscribing to all remote video streams. Valid values:

    • true (default): Resumes.

    • false: Stops.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • subscribeRemoteVideoStream: Stops or resumes pulling the video stream of a specific remote user.

    public abstract int subscribeRemoteVideoStream(String uid, AliRtcVideoTrack track, boolean sub);

    Parameters

    Parameter

    Type

    Description

    uid

    Srring

    The remote user ID.

    track

    AliRtcVideoTrack

    The video stream type.

    sub

    boolean

    Specifies whether to stop or resume pulling the video stream of a specific remote user. Valid values:

    • true (default): Resumes.

    • false: Stops.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • createRenderSurfaceView: Creates a SurfaceView rendering view.

    public abstract SophonSurfaceView createRenderSurfaceView(Context context);

    Parameters

    Parameter

    Type

    Description

    context

    Context

    The context of the Android Activity.

  • createRenderTextureView: Creates a TextureView rendering view.

    public abstract SophonTextureView createRenderTextureView(Context context);

    Parameters

    Parameter

    Type

    Description

    context

    Context

    The context of the Android Activity.

  • setScreenShareEncoderConfiguration: Sets the encoding properties for screen sharing.

    public abstract void setScreenShareEncoderConfiguration(AliRtcScreenShareEncoderConfiguration config);

    Parameters

    Parameter

    Type

    Description

    config

    AliRtcScreenShareEncoderConfiguration

    The encoding properties for screen sharing. Default values:

    • dimensions: [0,0]

    • frameRate: 5

    • bitrate: 0

    • rotation: 0

  • setLocalViewConfig: Sets the rendering window and drawing parameters for the local preview.

    public abstract int setLocalViewConfig(AliVideoCanvas viewConfig, AliRtcVideoTrack track);

    You can switch the window before or after joining a channel. If AliVideoCanvas or the view parameter in AliVideoCanvas is null, rendering stops.

    To reset the renderMode parameter of AliVideoCanvas during playback, keep the other parameters unchanged and only modify renderMode.

    To reset the mirrorMode parameter of AliVideoCanvas during playback, keep the other parameters unchanged and only modify mirrorMode.

    Parameters

    Parameter

    Type

    Description

    viewConfig

    AliVideoCanvas

    The rendering parameters, including the rendering window and rendering mode.

    track

    AliRtcVideoTrack

    The video stream type.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setCameraCapturerConfiguration: Sets the camera capture preference.

    public abstract int setCameraCapturerConfiguration(AliEngineCameraCapturerConfiguration cameraCapturerConfiguration);

    Parameters

    Parameter

    Type

    Description

    cameraCapturerConfiguration

    AliEngineCameraCapturerConfiguration

    The camera capture preference. Default values:

    • preference: 0

    • cameraDirection: 0

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • enableLocalVideo: Disables or re-enables local video capture.

    public abstract int enableLocalVideo(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to disable or re-enable local video capture. Valid values:

    • true (default): Re-enables.

    • false: Disables.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • muteLocalCamera: Stops or resumes sending local video data.

    public abstract int muteLocalCamera(boolean mute, AliRtcVideoTrack track);

    Parameters

    Parameter

    Type

    Description

    mute

    boolean

    Specifies whether to stop or resume sending local video data. Valid values:

    • true: Stops.

    • false (default): Resumes.

    track

    AliRtcVideoTrack

    The type of video stream whose publishing state needs to be changed.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Important

    This method only controls whether to send black frames on the specified video stream. It does not stop video capture or data transmission. To disable video capture, use the enableLocalVideo method. To stop sending video data, use the publishLocalVideoStream method.

  • muteAllRemoteVideoRendering: Stops or resumes rendering all remote video streams.

    public abstract int muteAllRemoteVideoRendering(boolean mute);

    Stream pulling and decoding are not affected. You can call this method before or after joining a channel.

    Parameters

    Parameter

    Type

    Description

    mute

    boolean

    Specifies whether to stop or resume rendering all remote video streams. Valid values:

    • true: Stops rendering. All video streams appear as black frames.

    • false (default): Resumes rendering.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setRemoteViewConfig: Sets the rendering window and drawing parameters for a remote video stream.

    public abstract int setRemoteViewConfig(AliVideoCanvas canvas, String uid,AliRtcVideoTrack track);

    You can switch the window before or after joining a channel. If AliVideoCanvas or the view parameter in AliVideoCanvas is null, rendering stops.

    To reset the renderMode parameter of AliVideoCanvas during playback, keep the other parameters unchanged and only modify renderMode.

    To reset the mirrorMode parameter of AliVideoCanvas during playback, keep the other parameters unchanged and only modify mirrorMode.

    Parameters

    Parameter

    Type

    Description

    canvas

    AliVideoCanvas

    The rendering parameters, including the rendering window and rendering mode.

    uid

    String

    The user ID.

    track

    AliRtcVideoTrack

    The type of video stream to set.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isCameraOn: Checks whether the camera is on.

    public abstract boolean isCameraOn();

    Return value

    Returns true if the camera is on. Returns false otherwise.

  • stopRecord: Stops recording.

    public abstract void stopRecord();
  • startRecord: Starts non-layout recording.

    public abstract boolean startRecord(AliRtcRecordType recordType,AliRtcRecordFormat recordFormat,
                                        String filePath,AliRtcRecordAudioConfig audioConfig, 
                                        AliRtcRecordVideoConfig videoConfig);

    Parameters

    Parameter

    Type

    Description

    recordType

    AliRtcRecordType

    The record type.

    recordFormat

    AliRtcRecordFormat

    The record format.

    filePath

    String

    The file path.

    audioConfig

    AliRtcRecordAudioConfig

    The parameter settings for recording an audio file.

    videoConfig

    AliRtcRecordVideoConfig

    The parameter settings for recording a video file. Recording video is not supported on mobile clients.

    Return value

    Returns true if the method is called successfully. Returns false otherwise.

  • setBeautyEffect: Enables or disables the basic retouching effect.

    public abstract int setBeautyEffect(boolean enable, AliRtcBeautyConfig config);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to enable the basic retouching effect. Valid values:

    • true: Enables retouching.

    • false: Disables retouching.

    The default value is false.

    config

    AliRtcBeautyConfig

    The basic retouching parameters.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Note

    This method currently supports only skin whitening and smoothing.

  • setVideoEncoderConfiguration: Sets the video encoding properties.

    public abstract void setVideoEncoderConfiguration(AliRtcVideoEncoderConfiguration config);

    Parameters

    Parameter

    Type

    Description

    config

    AliRtcVideoEncoderConfiguration

    The predefined encoding properties. Default values:

    • dimensions: [640,480]

    • frameRate: 15

    • bitrate: 0

    • mirrorMode: 0

    • orientationMode: 0

    • rotation: 0

  • addVideoWatermark: Adds a watermark.

    public abstract int addVideoWatermark(AliRtcVideoTrack track, String imageUrl, AliRtcWatermarkConfig config);

    Parameters

    Parameter

    Type

    Description

    track

    AliRtcVideoTrack

    The data stream type.

    imageUrl

    String

    The path of the watermark image.

    config

    AliRtcWatermarkConfig

    The watermark configuration.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • clearVideoWatermark: Clears the watermark information for the corresponding data stream.

    public abstract int clearVideoWatermark(AliRtcVideoTrack track);

    Parameters

    Parameter

    Type

    Description

    track

    AliRtcVideoTrack

    The data stream type.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • snapshotVideo: Takes a snapshot.

    public abstract int snapshotVideo(String userId, AliRtcVideoTrack trackType);

    Parameters

    Parameter

    Type

    Description

    userId

    String

    The user ID. If this is empty, it refers to the local user.

    trackType

    AliRtcVideoTrack

    The stream type.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. The snapshot result is returned through the onSnapshotComplete callback.

  • switchCamera: Switches between the front and rear cameras. The front camera is used by default.

    public abstract int switchCamera();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getCurrentCameraDirection: Gets the current camera direction.

    public abstract AliRTCCameraDirection getCurrentCameraDirection();

    Return value

    • Returns CAMERA_REAR(0) for the rear camera.

    • Returns CAMERA_FRONT(1) for the front camera.

    • Returns CAMERA_INVALID(-1) for an invalid camera.

    Note

    This method must be called after the camera is turned on. Otherwise, it returns CAMERA_INVALID(-1).

  • setCameraZoom: Sets the camera zoom factor.

    public abstract int setCameraZoom(float zoom);

    Parameters

    Parameter

    Type

    Description

    zoom

    float

    The zoom level. The default value is 1.0.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setCameraFlash: Turns the camera flash on or off.

    public abstract int setCameraFlash(boolean flash);

    Parameters

    Parameter

    Type

    Description

    flash

    boolean

    Specifies whether to turn on the camera flash. Valid values:

    • true: Turns on.

    • false (default): Turns off.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setCameraFocusPoint: Sets the manual focus point for the camera.

    public abstract int setCameraFocusPoint(float pointX, float pointY);

    Parameters

    Parameter

    Type

    Description

    pointX

    float

    The X coordinate of the focus point.

    pointY

    float

    The Y coordinate of the focus point.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setCameraExposurePoint: Sets the camera exposure point.

    public abstract int setCameraExposurePoint(float pointX, float pointY);

    Parameters

    Parameter

    Type

    Description

    pointX

    float

    The X coordinate of the exposure point.

    pointY

    float

    The Y coordinate of the exposure point.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isCameraAutoFocusFaceModeSupported: Checks whether the camera supports face autofocus.

    public abstract boolean isCameraAutoFocusFaceModeSupported();

    Return value

    Returns true if supported. Returns false otherwise.

  • setCameraAutoFocusFaceModeEnabled: Enables or disables camera face autofocus.

    public abstract boolean setCameraAutoFocusFaceModeEnabled(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to enable camera face autofocus. Valid values:

    • true: Enables.

    • false (default): Disables.

    Return value

    Returns true if the method is called successfully. Returns false otherwise.

  • startScreenShare: Starts screen sharing.

    public abstract int startScreenShare();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startScreenShare: Starts sharing the screen.

    public abstract int startScreenShare(Intent intent);

    Lets you create and start screen sharing externally.

    Parameters

    Parameter

    Type

    Description

    intent

    Intent

    The externally created and started screen sharing session.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopScreenShare: Stops screen sharing.

    public abstract int stopScreenShare();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioOnlyMode: Sets the mode to audio-only or audio and video.

    public abstract int setAudioOnlyMode(boolean audioOnly);

    Parameters

    Parameter

    Type

    Description

    audioOnly

    boolean

    Sets the mode to audio-only or audio and video. Valid values:

    • true: Only audio is ingested and pulled.

    • false (default): Both audio and video are supported.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isAudioOnly: Queries whether the current mode is audio-only.

    public abstract boolean isAudioOnly();

    Parameters

    Returns true for audio-only mode. Returns false for audio and video mode.

  • muteLocalMic: Pauses or resumes sending local audio data.

    public abstract int muteLocalMic(boolean mute, AliRtcMuteLocalAudioMode mode);

    Parameters

    Parameter

    Type

    Description

    mute

    boolean

    Specifies whether to pause or resume sending local audio data. Valid values:

    • true: Sends silent audio frames.

    • false (default): Resumes.

    mode

    AliRtcMuteLocalAudioMode

    The mute mode. The default is microphone mute mode.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. For muteLocalMic to take effect, you must have already called publishLocalAudioStream(true) to start publishing the audio stream. When mute is true, only silent audio frames are sent. The capture and encoding modules continue to work.

  • muteRemoteAudioPlaying: Stops or resumes playing a remote audio stream.

    public abstract int muteRemoteAudioPlaying(String uid, boolean mute);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The user ID.

    mute

    boolean

    Specifies whether to stop or resume playing the remote audio stream. Valid values:

    • true: Stops playback.

    • false (default): Resumes playback.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • muteAllRemoteAudioPlaying: Stops or resumes playing all remote audio streams.

    public abstract int muteAllRemoteAudioPlaying(boolean mute);

    Parameters

    Parameter

    Type

    Description

    mute

    boolean

    Specifies whether to stop or resume playing all remote audio streams. Valid values:

    • true: Stops playback.

    • false (default): Resumes playback.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startAudioCapture: Starts audio capture.

    public abstract int startAudioCapture();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startAudioCapture: Starts capturing audio.

    public abstract int startAudioCapture(boolean keepAlive);

    Parameters

    Parameter

    Type

    Description

    keepAlive

    boolean

    The state of the capture device after leaving the meeting. Valid values:

    • true: The capture device remains on after leaving the meeting.

    • false (default): The capture device is turned off after leaving the meeting.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopAudioCapture: Stops audio capture.

    public abstract int stopAudioCapture();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startAudioPlayer: Starts the audio playback device.

    public abstract int startAudioPlayer();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopAudioPlayer: Stops audio playback.

    public abstract int stopAudioPlayer();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setRemoteAudioVolume: Sets the local playback volume of a specific remote user.

    public abstract int setRemoteAudioVolume(String uid, int volume);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The user ID.

    int

    volume

    The playback volume. The range is [0, 100]. 0 means mute, and 100 means the original volume. The default value is 100.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • enableSpeakerphone: Sets the audio output to the earpiece or the speaker.

    public abstract int enableSpeakerphone(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Sets the audio output to the earpiece or the speaker. Valid values:

    • true (default): Speaker mode.

    • false: Earpiece mode.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • isSpeakerOn: Gets whether the current audio output is the earpiece or the speaker.

    public abstract boolean isSpeakerOn();

    Return value

    Returns true for speaker, false for earpiece.

  • setRecordingVolume: Sets the recording volume.

    public abstract int setRecordingVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The volume range is [0, 400]. 0 means mute, and 100 means the original volume. A value greater than 100 amplifies the volume, and a value less than 100 reduces the volume. The default value is 100.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setPlayoutVolume: Sets the playback volume.

    public abstract int setPlayoutVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The volume range is [0, 400]. 0 means mute, and 100 means the original volume. A value greater than 100 amplifies the volume, and a value less than 100 reduces the volume. The default value is 100.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • enableAudioVolumeIndication: Sets the volume callback frequency and smoothing coefficient.

    public abstract int enableAudioVolumeIndication(int interval, int smooth, int reportVad);

    Parameters

    Parameter

    Type

    Description

    interval

    int

    The time interval.

    • Unit: ms.

    • Default value: 300 ms.

    • Value range: The minimum value is ≥10 ms. We recommend setting it to 300 ms to 500 ms. A value ≤0 disables volume and speaker prompts.

    smooth

    int

    The smoothing coefficient. A larger value indicates a higher degree of smoothing, while a smaller value indicates better real-time performance.

    • Default value: 3.

    • Value range: 0 to 9. We recommend setting it to 3.

    reportVad

    int

    The local voice activity detection switch.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioProfile: Sets the audio profile.

    public abstract int setAudioProfile(AliRtcAudioProfile profile, AliRtcAudioScenario scenario);

    Parameters

    Parameter

    Type

    Description

    profile

    int

    The audio capture or encoding mode parameter. The default value is AliEngineBasicQualityMode. For more information, see AliRtcAudioProfile.

    scenario

    int

    The audio scenario mode parameter. The default value is AliEngineSceneDefaultMode. For more information, see AliRtcAudioScenario.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • enableAudioDTX: Enables local audio traffic shaping (voice).

    public abstract int enableAudioDTX(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Enables local audio traffic shaping. Valid values:

    • true: Enables.

    • false (default): Disables.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. This method is effective only when called before stream ingest. Enabling voice activity detection reduces the number of bytes sent when no voice is detected, saving user traffic.

  • enableAudioAMD: Enables local audio traffic shaping (microphone).

    public abstract int enableAudioAMD(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Enables local audio traffic shaping. Valid values:

    • true: Enables.

    • false (default): Disables.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. This method is effective only when called before stream ingest. Enabling voice activity detection stops sending audio packets when the microphone is muted or turned off.

  • setAudioEffectVoiceChangerMode: Sets the voice changer effect mode.

    public abstract int setAudioEffectVoiceChangerMode(AliRtcAudioEffectVoiceChangerMode mode);

    Parameters

    Parameter

    Type

    Description

    mode

    AliRtcAudioEffectVoiceChangerMode

    The voice changer effect mode. The default value is AliRtcSdk_AudioEffect_Voice_Changer_OFF (disabled).

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioEffectPitchValue: Sets the pitch parameter.

    public abstract int setAudioEffectPitchValue(double value);

    Parameters

    Parameter

    Type

    Description

    value

    double

    The parameter range is [0.5, 2.0]. The default value is 1.0, which means the pitch is unchanged.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioEffectReverbMode: Sets the reverb effect mode.

    public abstract int setAudioEffectReverbMode(AliRtcAudioEffectReverbMode mode);

    Parameters

    Parameter

    Type

    Description

    mode

    AliRtcAudioEffectReverbMode

    The reverb effect mode. The default value is AliRtcAudioEffectReverb_Off (disabled).

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioEffectReverbParamType: Sets the reverb effect type and specific parameters.

    public abstract int setAudioEffectReverbParamType(AliRtcAudioEffectReverbParamType type, float value);

    Parameters

    Parameter

    Type

    Description

    type

    AliRtcAudioEffectReverbParamType

    The reverb effect parameter.

    value

    float

    The specific parameter value.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startAudioAccompany: Starts audio mixing.

    public abstract int startAudioAccompany(String fileName, boolean onlyLocalPlay, boolean replaceMic, int loopCycles);

    Parameters

    Parameter

    Type

    Description

    filePath

    String

    The path of the audio mixing file.

    onlyLocalPlay

    boolean

    Specifies whether to play only locally. Valid values:

    • true: Plays only locally.

    • false: Plays locally and publishes to remote users.

    replaceMic

    boolean

    Specifies whether to replace the microphone audio stream. Valid values:

    • true: The accompaniment audio stream replaces the local microphone audio stream.

    • false: The accompaniment audio stream and the microphone audio stream are published simultaneously.

    loopCycles

    int

    The number of loops. -1 means to loop indefinitely.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopAudioAccompany: Stops audio mixing.

    public abstract int stopAudioAccompany();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioAccompanyVolume: Sets the audio mixing volume.

    public abstract int setAudioAccompanyVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. Setting the volume takes effect only after startAudioAccompany is called.

  • setAudioAccompanyPublishVolume: Sets the volume of the mixed audio for stream ingest (Android and iOS).

    public abstract int setAudioAccompanyPublishVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. Setting the volume takes effect only after startAudioAccompany is called.

  • getAudioAccompanyPublishVolume: Gets the volume of the mixed audio for stream ingest.

    public abstract int getAudioAccompanyPublishVolume();

    Return value

    Returns the volume of the mixed audio for stream ingest.

  • setAudioAccompanyPlayoutVolume: Sets the local playback volume of the mixed audio (Android and iOS).

    public abstract int setAudioAccompanyPlayoutVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. Setting the volume takes effect only after startAudioAccompany is called.

  • getAudioAccompanyPlayoutVolume: Gets the local playback volume of the mixed audio.

    public abstract int getAudioAccompanyPlayoutVolume();

    Return value

    The current local playback volume of the mixed audio.

  • pauseAudioAccompany: Pauses audio mixing.

    public abstract int pauseAudioAccompany();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • resumeAudioAccompany: Resumes audio mixing.

    public abstract int resumeAudioAccompany();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getAudioAccompanyDuration: Gets the duration of the accompaniment file.

    public abstract int getAudioAccompanyDuration();

    Return value

    The duration of the current accompaniment file in milliseconds.

  • getAudioAccompanyCurrentPosition: Gets the playback progress of the music file.

    public abstract int getAudioAccompanyCurrentPosition();

    Return value

    The current playback progress of the music file in milliseconds.

  • setAudioAccompanyPosition: Sets the playback position of the audio file.

    public abstract int setAudioAccompanyPosition(int posMs);

    Parameters

    Parameter

    Type

    Description

    posMs

    int

    The position of the progress bar in milliseconds.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • preloadAudioEffect: Preloads a sound effect file.

    public abstract int preloadAudioEffect(int soundId, String filePath);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    filePath

    String

    The path of the sound effect file.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • unloadAudioEffect: Deletes a preloaded sound effect file.

    public abstract int unloadAudioEffect(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • playAudioEffect: Starts playing a sound effect.

    public abstract int playAudioEffect(int soundId, String filePath, int cycles, boolean publish);

    Description

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    filePath

    String

    The path of the sound effect file.

    cycles

    int

    The number of loops. -1 means to loop indefinitely.

    publish

    boolean

    Specifies whether to publish the sound effect audio stream to remote users. Valid values:

    • true: Publishes the sound effect audio stream to remote users.

    • false (default): Does not publish the sound effect audio stream to remote users.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopAudioEffect: Stops playing a sound effect.

    public abstract int stopAudioEffect(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopAllAudioEffects: Stops playing all sound effects.

    public abstract int stopAllAudioEffects();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioEffectPublishVolume: Sets the stream ingest volume for a sound effect.

    public abstract int setAudioEffectPublishVolume(int soundId, int volume);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getAudioEffectPublishVolume: Gets the stream ingest volume for a sound effect.

    public abstract int getAudioEffectPublishVolume(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAudioEffectPlayoutVolume: Sets the local playback volume for a sound effect.

    public abstract int setAudioEffectPlayoutVolume(int soundId, int volume);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getAudioEffectPlayoutVolume: Gets the local playback volume for a sound effect (Android and iOS).

    public abstract int getAudioEffectPlayoutVolume(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAllAudioEffectsPublishVolume: Sets the stream ingest mixing volume for all sound effects.

    public abstract int setAllAudioEffectsPublishVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setAllAudioEffectsPlayoutVolume: Sets the local playback volume for all sound effects (Android and iOS).

    public abstract int setAllAudioEffectsPlayoutVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The audio mixing volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • pauseAudioEffect: Pauses a sound effect.

    public abstract int pauseAudioEffect(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • pauseAllAudioEffects: Pauses all sound effects.

    public abstract int pauseAllAudioEffects();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • resumeAudioEffect: Resumes playing a sound effect.

    public abstract int resumeAudioEffect(int soundId);

    Parameters

    Parameter

    Type

    Description

    soundId

    int

    The ID assigned to the sound effect file by the user.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • resumeAllAudioEffects: Resumes playing all sound effects.

    public abstract int resumeAllAudioEffects();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • enableEarBack: Enables in-ear monitoring.

    public abstract int enableEarBack(boolean enable);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to enable in-ear monitoring. Valid values:

    • true: Enables in-ear monitoring.

    • false (default): Disables in-ear monitoring.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setEarBackVolume: Sets the in-ear monitoring volume.

    public abstract int setEarBackVolume(int volume);

    Parameters

    Parameter

    Type

    Description

    volume

    int

    The volume. The range is 0 to 100. The default value is 100.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • requestAudioFocus: Requests audio focus.

    public abstract int requestAudioFocus();
  • abandonAudioFocus: Releases audio focus.

    public abstract int abandonAudioFocus();
  • registerVideoSampleObserver: Registers a video data output object.

    public abstract void registerVideoSampleObserver(AliVideoObserver observer);

    Parameters

    Parameter

    Type

    Description

    observer

    AliVideoObserver

    The video data output object.

    Return value

    The output data is returned through the AliVideoObserver callback.

  • unRegisterVideoSampleObserver: Unregisters a video data output object.

    public abstract void unRegisterVideoSampleObserver();
  • registerLocalVideoTextureObserver: Registers an observer for OpenGL texture data from the local camera stream.

    public abstract void registerLocalVideoTextureObserver(AliTextureObserver observer);

    Parameters

    Parameter

    Type

    Description

    observer

    AliTextureObserver

    The OpenGL texture data observer.

    Return value

    The output data is returned through the AliVideoObserver callback.

  • unRegisterLocalVideoTextureObserver: Unregisters the observer for OpenGL texture data from the local camera stream.

    public abstract void  unRegisterLocalVideoTextureObserver();
  • registerAudioObserver: Subscribes to audio data output.

    public abstract void registerAudioObserver(AliAudioType type, AliAudioObserver observer);

    Parameters

    Parameter

    Type

    Description

    type

    AliAudioType

    The data type.

    observer

    AliVideoObserver

    The audio data receiving object.

  • unRegisterAudioObserver: Unsubscribes from audio data output.

    public abstract void unRegisterAudioObserver(AliAudioType type);

    Parameters

    Parameter

    Type

    Description

    type

    AliAudioType

    The data type.

  • setSubscribeAudioNumChannel: Sets the number of output audio channels. The default is mono. This parameter is not supported for pre-mixing data.

    public abstract void setSubscribeAudioNumChannel(AliRtcAudioNumChannel numChannel);

    Parameters

    Parameter

    Type

    Description

    numChannel

    AliRtcAudioNumChannel

    The number of sound channels.

  • setSubscribeAudioSampleRate: Sets the output audio sampling rate. The default is 44.1 kHz. This parameter is not supported for pre-mixing data.

    public abstract void setSubscribeAudioSampleRate(AliRtcAudioSampleRate sampleRate );

    Parameters

    Parameter

    Type

    Description

    sampleRate

    AliRtcAudioSampleRate

    The sample rate.

  • registerAudioVolumeObserver: Registers a volume data output object.

    public abstract void registerAudioVolumeObserver(AliRtcAudioVolumeObserver observer);

    Parameters

    Parameter

    Type

    Description

    observer

    AliRtcAudioVolumeObserver

    The volume data receiving object.

  • unRegisterAudioVolumeObserver: Unregisters a volume data output object.

    public abstract void unRegisterAudioVolumeObserver();
  • setExternalVideoSource: Enables an external video input source.

    public abstract void setExternalVideoSource(boolean enable,boolean useTexture,
                                                AliRtcVideoTrack streamType,AliRtcRenderMode renderMode);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Enables an external video input source. Valid values:

    • true: Enables.

    • false (default): Disables.

    useTexture

    boolean

    Specifies whether to use texture mode. Valid values:

    • true: Uses.

    • false (default): Does not use.

    type

    AliRtcVideoTrack

    The video stream type.

    renderMode

    AliRtcRenderMode

    The rendering mode.

  • pushExternalVideoFrame: Inputs video data.

    public abstract int pushExternalVideoFrame(AliRtcRawDataFrame aliRawDataFrame,AliRtcVideoTrack streameType);

    Parameters

    Parameter

    Type

    Description

    aliRawDataFrame

    AliRtcRawDataFrame

    The frame data.

    streameType

    AliRtcVideoTrack

    The video stream type.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setExternalAudioSource: Enables or disables an external audio input source.

    public abstract  int setExternalAudioSource(boolean enable ,int sampleRate,int channels);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to enable an external audio input source.

    • true: Enables.

    • false (default): Disables.

    sampleRate

    int

    The sample rate.

    channelsPerFrame

    int

    The number of sound channels. Valid values are 1 or 2.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • pushExternalAudioFrameRawData: Inputs audio data.

    public abstract  int pushExternalAudioFrameRawData(byte[] samples,int samplesLength,long timestamp);

    Parameters

    Parameter

    Type

    Description

    samples

    byte[]

    The audio data. We recommend that it does not exceed 40 milliseconds.

    samplesLength

    int

    The sampling.

    timestamp

    double

    The timestamp.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setExternalAudioVolume: Sets the external audio volume.

    public abstract  int setExternalAudioVolume(int vol);

    Parameters

    Parameter

    Type

    Description

    vol

    int

    The volume. The range is 0 to 100. The default value is 50.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getExternalAudioVolume: Gets the audio mixing volume.

    public abstract  int getExternalAudioVolume();

    Return value

    Returns the current audio mixing volume.

  • setMixedWithMic: Sets whether to mix the external audio input with the audio captured by the microphone.

    public abstract int setMixedWithMic(boolean mixed);

    Parameters

    Parameter

    Type

    Description

    mixed

    boolean

    Specifies whether to mix with the audio captured by the microphone. Valid values:

    • true (default): Mixes.

    • false: Completely replaces the microphone capture data.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • setExteranlAudioRender: Enables or disables playback for external audio input.

    public abstract int setExteranlAudioRender(boolean enable,int sampleRate,int channelsPerFrame);

    Parameters

    Parameter

    Type

    Description

    enable

    boolean

    Specifies whether to enable playback for external audio input. Valid values:

    • true: Enables.

    • false (default): Disables.

    sampleRate

    int

    The sample rate.

    channelsPerFrame

    int

    The number of sound channels. Valid values are 1 or 2.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • pushExternalAudioRenderRawData: Inputs external audio playback data.

    public abstract int pushExternalAudioRenderRawData(byte[]audioSamples ,int sampleLength,int sampleRate,
                                                       int channelsPerFrame, long timestamp);

    Parameters

    Parameter

    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.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startPublishLiveStream: Starts a bypass live stream.

    public abstract int startPublishLiveStream(String streamUrl,AliRtcLiveTranscodingParam transcodingParam);

    Parameters

    Parameter

    Type

    Description

    streamUrl

    String

    The ingest URL.

    transcodingParam

    AliRtcLiveTranscodingParam

    The stream ingest parameters.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • updatePublishLiveStream: Updates the parameters for the bypass live stream.

    public abstract int updatePublishLiveStream(String streamUrl,AliRtcLiveTranscodingParam transcodingParam);

    Parameters

    Parameter

    Type

    Description

    streamUrl

    String

    The ingest URL.

    transcodingParam

    AliRtcLiveTranscodingParam

    The stream ingest parameters.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopPublishLiveStream: Stops the bypass live stream.

    public abstract int stopPublishLiveStream(String streamUrl);

    Parameters

    Parameter

    Type

    Description

    streamUrl

    String

    The ingest URL.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startChannelRelay: Starts cross-channel co-streaming.

    public abstract int startChannelRelay(AliRtcChannelRelayConfiguration configuration);

    Parameters

    Parameter

    Type

    Description

    configuration

    AliRtcChannelRelayConfiguration

    The configuration information.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • updateChannelRelay: Updates cross-channel co-streaming.

    public abstract int updateChannelRelay(AliRtcChannelRelayConfiguration configuration);

    Parameters

    Parameter

    Type

    Description

    configuration

    AliRtcChannelRelayConfiguration

    The configuration information.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopChannelRelay: Stops cross-channel co-streaming.

    public abstract int stopChannelRelay();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • startPreview: Starts the local preview.

    public abstract int startPreview();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • stopPreview: Stops the local preview.

    public abstract int stopPreview();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getOnlineRemoteUsers: Gets the list of online remote users.

    public abstract String[] getOnlineRemoteUsers();

    Return value

    Returns a String[] representing the user list, which contains user IDs.

  • getUserInfo: Queries the status of remote users.

    public abstract AliRtcRemoteUserInfo getUserInfo(String uid);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The remote user ID. This is a unique identifier assigned by the App server.

    Return value

    Returns a remote user object AliRtcRemoteUserInfo.

  • isUserOnline: Checks whether a user is online.

    public abstract boolean isUserOnline(String uid);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The user ID. This is a unique identifier assigned by the App server.

    Return value

    Returns true if online. Returns false if not online.

  • setLogDirPath: Sets the path to save the SDK log files.

    public static int setLogDirPath(String logDirPath);

    Parameters

    Parameter

    Type

    Description

    logDirPath

    String

    The absolute path to save the log files. The default path is the /sdcard/Ali_RTC_Log/ directory.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

    Note

    To call this method, set it before calling any other SDK methods to avoid log loss. The app must ensure that the specified path exists and is writable.

  • setLogLevel: Sets the log level.

    public static void setLogLevel(AliRtcLogLevel logLevel);

    Parameters

    Parameter

    Type

    Description

    logLevel

    AliRtcLogLevel

    The log level.

  • getSdkVersion: Gets the SDK version number.

    public static String getSdkVersion();

    Return value

    Returns the SDK version number.

  • getErrorDescription: Gets the description of an error code.

    public static String getErrorDescription(int errorCode);

    Parameters

    Parameter

    Type

    Description

    errorCode

    int

    The error code.

    Return value

    Returns the error code description string.

  • setClientRole: Sets the user role.

    public abstract int setClientRole(AliRTCSdkClientRole clientRole);

    Parameters

    Parameter

    Type

    Description

    clientRole

    AliRTCSdkClientRole

    The user role type. The default value is AliRTCSdkLive (viewer role). The role type is effective only in non-communication mode.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getCurrentClientRole: Gets the user role.

    public abstract AliRTCSdkClientRole getCurrentClientRole();

    Return value

    Returns the current user role.

  • startNetworkQualityProbeTest: Starts a network quality probe test.

    public abstract int startNetworkQualityProbeTest();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. Call this method before entering a channel. The test result is returned through the onNetworkQualityProbeTest callback.

  • stopNetworkQualityProbeTest: Stops the network quality probe test.

    public abstract int stopNetworkQualityProbeTest();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • respondMessageNotification: Sends a downstream channel message.

    public abstract int respondMessageNotification(String tid, String contentType, String content);

    Parameters

    Parameter

    Type

    Description

    tid

    String

    The signaling ID.

    contentType

    String

    The message type.

    content

    String

    The message content.

  • uplinkChannelMessage: Sends an upstream channel message.

    public abstract int uplinkChannelMessage(String contentType, String content);

    A Software as a Service (SaaS) client sends a signaling message to the SaaS server.

    Parameters

    Parameter

    Type

    Description

    contentType

    String

    The signaling type.

    content

    String

    The signaling content.

  • postFeedback: Submits issue feedback.

    public abstract void postFeedback(String uid,String channelId,String description,AliRtcFeedbackType type,long timeStamp);

    Parameters

    Parameter

    Type

    Description

    uid

    String

    The current user ID. This can be empty.

    channelId

    String

    The current channel ID. This can be empty.

    description

    String

    The issue description. This cannot be empty and supports both Chinese and English.

    type

    AliRtcFeedbackType

    The issue type.

    timeStamp

    long

    The timestamp when the issue occurred. This is a Unix timestamp. An approximate time is sufficient. It can be 0.

  • sendMediaExtensionMsg: Sends media extension information.

    public abstract int sendMediaExtensionMsg(byte[]message, int repeatCount);

    Parameters

    Parameter

    Type

    Description

    message

    byte[]

    The extension information.

    repeatCount

    int

    The number of repetitions.

    Return value

    • 0: Success.

    • -1: No stream is being published.

    • -2: Invalid parameter.

    • -3: Too frequent.

  • startIntelligentDenoise: Enables intelligent noise reduction.

    public abstract int startIntelligentDenoise();

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise. This method can be used to enable intelligent noise reduction during a call.

  • stopIntelligentDenoise: Disables intelligent noise reduction.

    public abstract void stopIntelligentDenoise();
  • refreshAuthInfo: Refreshes the authentication information.

    public abstract int refreshAuthInfo(AliRtcAuthInfo authInfo);

    Parameters

    Parameter

    Type

    Description

    authInfo

    AliRtcAuthInfo

    The authentication information.

    Return value

    Returns 0 if the method is called successfully. Returns a non-zero value otherwise.

  • getCurrentConnectionStatus: Gets the current network connection status.

    public abstract AliRtcConnectionStatus getCurrentConnectionStatus();

    Return value

    Returns the current network connection status. For details about the status, see AliRtcConnectionStatus.

  • getVideoCaptureData: Manually retrieves captured data.

    public abstract boolean getVideoCaptureData(AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);

    Parameters

    Parameter

    Type

    Description

    track

    AliRtcVideoTrack

    The video stream type.

    videoSample

    AliRtcVideoSample

    The video sample.

    Return value

    Returns true if the method is called successfully. Returns false otherwise.

  • getVideoPreEncoderData: Manually retrieves pre-encoding data.

    public abstract boolean getVideoPreEncoderData(AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);

    Parameters

    Parameter

    Type

    Description

    track

    AliRtcVideoTrack

    The video stream type.

    videoSample

    AliRtcVideoSample

    The video sample.

    Return value

    Returns true if the method is called successfully. Returns false otherwise.

  • getVideoRenderData: Manually retrieves stream pulling data.

    public abstract boolean getVideoRenderData(String userId, AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);

    Parameters

    Parameter

    Type

    Description

    userId

    String

    The remote user ID.

    track

    AliRtcVideoTrack

    The video stream type.

    videoSample

    AliRtcVideoSample

    The video sample.

    Return value

    Returns true if the method is called successfully. Returns false otherwise.

  • getPublishLiveStreamState: Gets the status of the bypass live stream.

    public abstract AliRtcEngine.AliRtcLiveTranscodingState getPublishLiveStreamState(String streamUrl);

    Parameters

    Parameter

    Type

    Description

    streamUrl

    String

    The ingest URL for the bypass live stream.

    Return value

    Returns the status of the bypass live stream.

  • showDebugView: Shows the dashboard.

    public abstract void showDebugView(ViewGroup viewGroup, int showType, String userId);

    Parameters

    Parameter

    Type

    Description

    viewGroup

    ViewGroup

    The view, which is handled by the business side for layout.

    showType

    int

    The display type. Valid values:

    • 0 (default): Does not show.

    • 1: Audio.

    • 2: Video.

    • 3: Network.

    • 4: All.

    Note

    You can set special values for non-public data.

    userId

    String

    The data related to the specified user.