This topic describes the methods of the AliRtcEngine class provided by Real-Time Communication (RTC) SDK for Android.

Description

For more information about the details of the methods of the AliRtcEngine class, see AliRtcEngine.

List of methods

Basic methods

Method Description Supported minimum version
setH5CompatibleMode Specifies whether to enable the HTML5 compatibility mode. 1.1
getH5CompatibleMode Queries whether the HTML5 compatibility mode is enabled. 1.1
getInstance Creates an AliRtcEngine instance. You must call this method in the main thread. Only one primary instance is allowed. 1.17
getInstance Creates an AliRtcEngine instance. This method allows you to pass in parameters to configure special SDK features. You must call this method in the main thread. Only one primary instance is allowed. 1.17
destroy Destroys an AliRtcEngine instance. 1.1
uploadLog Proactively uploads logs. 1.1
setRtcEngineEventListener Sets a listener to listen to the callback events of a local user. 1.1
setRtcEngineNotify Sets a listener to listen to the callback events of a remote user. 1.1

Channel-related methods

Method Description Supported minimum version
joinChannel Joins a channel. 1.1
leaveChannel Leaves a channel. 1.1
switchChannel Switches to another channel. 2.1
isInCall Checks whether you are in a channel. 1.1
setChannelProfile Sets the channel mode. 1.15
createChannel Creates a subchannel. 2.1
destroyChannel Destroys a subchannel. 2.1

Stream ingest-related methods

Method Description Supported minimum version
publishLocalVideoStream Specifies whether to enable stream ingest for a video track. 2.1
isLocalVideoStreamPublished Queries whether stream ingest is enabled for a video track. 1.1
isScreenSharePublished Queries whether stream ingest is enabled for a screen track. 1.1
publishLocalAudioStream Specifies whether to enable stream ingest for an audio track. 2.1
isLocalAudioStreamPublished Queries whether stream ingest is enabled for an audio track. 1.1
publishLocalDualStream Specifies whether to enable stream ingest for the minor stream of a video track. 2.1
isDualStreamPublished Queries whether stream ingest is enabled for the minor stream of a video track. 2.1

Stream pulling-related methods

Method Description Supported minimum version
setRemoteVideoStreamType Specifies the type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream. 2.1
setRemoteDefaultVideoStreamType Specifies the type of the stream to be pulled by default for a camera track. The stream can be a major stream or a minor stream. 2.1
setDefaultSubscribeAllRemoteAudioStreams Specifies whether to pull a stream for an audio track by default. 2.1
subscribeAllRemoteAudioStreams Pulls or stops pulling streams for the audio tracks of all remote users. 2.1
subscribeRemoteAudioStream Pulls or stops pulling a stream for the audio track of a specific remote user. 2.1
setDefaultSubscribeAllRemoteVideoStreams Specifies whether to pull a stream for a video track by default. 2.1
subscribeAllRemoteVideoStreams Pulls or stops pulling streams for the video tracks of all remote users. 2.1
subscribeRemoteVideoStream Pulls or stops pulling a stream for the video track of a specific remote user. 2.1

Video-related methods

Method Description Supported minimum 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 view and drawing parameters for local preview. 1.1
setCameraCapturerConfiguration Sets the collection preference of a camera. 2.1
enableLocalVideo Disables or re-enables local video collection. 2.1
muteLocalCamera Specifies whether to stop ingesting a stream for a local video track. 1.1
muteAllRemoteVideoRendering Renders or stops rendering the video tracks of all remote users. 2.1
setRemoteViewConfig Sets the rendering view and drawing parameters for the video track of a specific remote user. 1.1
isCameraOn Queries whether the camera is enabled. 1.1
stopRecord Stops recording. 1.17
startRecord Starts recording. 1.17
setBeautyEffect Specifies whether to enable basic retouching. 1.17.9
setVideoEncoderConfiguration Sets video encoding properties. 2.1
addVideoWatermark Adds a watermark. 2.1
clearVideoWatermark Removes the watermark information from a video track. 2.1
snapshotVideo Captures a snapshot. 2.1
switchCamera Switches between the front and rear cameras. By default, the front camera is used. 1.1
getCurrentCameraDirection Queries the current camera type. 1.1
setCameraZoom Sets the zoom factor of the camera. 1.1
setCameraFlash Specifies whether to enable the camera flash. 1.14
setCameraFocusPoint Sets the manual focus point of the camera. 1.14
setCameraExposurePoint Sets an exposure point for the camera. 1.14
isCameraAutoFocusFaceModeSupported Queries whether the camera supports face focus. 2.1
setCameraAutoFocusFaceModeEnabled Specifies whether to enable face focus for the camera. 2.1
getVideoCaptureData Proactively obtains the collected data. 2.4
getVideoPreEncoderData Proactively obtains the data that is prepared for encoding. 2.4
getVideoRenderData Proactively obtains the stream pulling data. 2.4

Methods related to screen sharing

Method Description Supported minimum version
startScreenShare Starts screen sharing. 2.1
startScreenShare Starts screen sharing. 2.1
stopScreenShare Stops screen sharing. 2.1

Audio-related methods

Method Description Supported minimum version
setAudioOnlyMode Enables the audio-only mode or the audio-video mode. 1.1
isAudioOnly Queries whether the audio-only mode is enabled. 1.1
muteLocalMic Specifies whether to mute the local audio. 1.1
muteRemoteAudioPlaying Specifies whether to stop the playback of the audio track of a specific remote user. 1.1
muteAllRemoteAudioPlaying Specifies whether to stop the playback of the audio tracks of all remote users. 1.16.2
startAudioCapture Starts audio collection. 1.1
startAudioCapture Starts audio collection. 2.2
stopAudioCapture Stops audio collection. 1.1
startAudioPlayer Starts the audio player. 1.1
stopAudioPlayer Stops the audio player. 1.1
setRemoteAudioVolume Sets the local playback volume for the audio track of a specific remote user. 2.1
enableSpeakerphone Sets the headset or speaker as the audio output device. 2.1
isSpeakerOn Queries whether the current audio output device is the headset 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 interval and smoothing factor. 1.17.9
setAudioProfile Sets the audio profile. 2.1
enableAudioDTX Enables the local audio detection feature for throttling. 2.1
enableAudioAMD Enables the microphone audio detection feature for throttling. 2.1
setAudioEffectVoiceChangerMode Sets the voice change mode. 2.1
setAudioEffectPitchValue Sets the audio pitch. 2.1
setAudioEffectReverbMode Sets the sound effect mode. 2.1
setAudioEffectReverbParamType Sets the sound effect parameter. 2.1
startAudioAccompany Starts audio mixing. 1.15
stopAudioAccompany Stops audio mixing. 1.15
setAudioAccompanyVolume Sets the volume of the mixed audio. 1.15
setAudioAccompanyPublishVolume Sets the volume of the mixed audio for stream ingest. 1.15
getAudioAccompanyPublishVolume Queries the volume of the mixed audio for stream ingest. 1.15
setAudioAccompanyPlayoutVolume Sets the volume of the mixed audio for local playback. 1.15
getAudioAccompanyPlayoutVolume Queries the volume of the mixed audio for local playback. 1.15
pauseAudioAccompany Pauses audio mixing. 1.15
resumeAudioAccompany Resumes audio mixing. 1.15
getAudioAccompanyDuration Queries the duration of a music file. 1.17.30
getAudioAccompanyCurrentPosition Queries the playback progress of a music file. 1.17.30
setAudioAccompanyPosition Sets the playback position of a music file. 1.17.30
preloadAudioEffect Preloads a sound effect. 1.15
unloadAudioEffect Deletes a preloaded sound effect. 1.15
playAudioEffect Starts the playback of a sound effect. 1.15
stopAudioEffect Stops the playback of a sound effect. 1.15
stopAllAudioEffects Stops the playback of all sound effects. 1.15
setAudioEffectPublishVolume Sets the volume of a sound effect for stream ingest. 1.15
getAudioEffectPublishVolume Queries the volume of a sound effect for stream ingest. 1.15
setAudioEffectPlayoutVolume Sets the volume of a sound effect for local playback. 1.15
getAudioEffectPlayoutVolume Queries the volume of a sound effect for local playback. 1.15
setAllAudioEffectsPublishVolume Sets the volume of all mixed sound effects for stream ingest. 1.15
setAllAudioEffectsPlayoutVolume Sets the volume of all sound effects for local playback. 1.15
pauseAudioEffect Pauses the playback of a sound effect. 1.15
pauseAllAudioEffects Pauses the playback of all sound effects. 1.15
resumeAudioEffect Resumes the playback of a sound effect. 1.15
resumeAllAudioEffects Resumes the playback of all sound effects. 1.15
enableEarBack Enables in-ear monitoring. 1.15
setEarBackVolume Sets the headset volume when in-ear monitoring is enabled. 1.15
requestAudioFocus Requests the audio focus. 1.17.19
abandonAudioFocus Abandons the audio focus. 1.17.19

Media engine-related methods

Method Description Supported minimum version
registerVideoSampleObserver Registers an object that is used to export video data. 1.17
unRegisterVideoSampleObserver Unregisters an object that is used to export video data. 1.17
registerLocalVideoTextureObserver Registers an object that is used to export the Open Graphics Library (OpenGL) texture data of a local camera track. 1.15
unRegisterLocalVideoTextureObserver Unregisters an object that is used to export the OpenGL texture data of a local camera track. 1.15
registerAudioObserver Subscribes to the data output of an audio track. 1.17
unRegisterAudioObserver Unsubscribes from the data output of an audio track. 1.17
setSubscribeAudioNumChannel Sets the number of sound channels for the output audio. 2.1
setSubscribeAudioSampleRate Sets the sampling rate for the output audio. 2.1
registerAudioVolumeObserver Registers an object that is used to export volume data. 1.16.2
unRegisterAudioVolumeObserver Unregisters an object that is used to export volume data. 1.16.2
setExternalVideoSource Specifies whether to enable an external video source. 2.1
pushExternalVideoFrame Imports video data from an external video source. 2.1
setExternalAudioSource Specifies whether to enable an external audio source. 1.17.9
pushExternalAudioFrameRawData Imports audio data from an external audio source. 1.17.9
setExternalAudioVolume Sets the volume of an external audio source. 1.17.9
getExternalAudioVolume Queries the volume of the mixed audio. 1.17.9
setMixedWithMic Specifies whether to mix an external audio source with the microphone-collected audio. 1.17.9
setExteranlAudioRender Specifies whether to enable the playback of an external audio source. 1.17.9
pushExternalAudioRenderRawData Imports audio data from an external audio source for playback. 1.17.9

Methods related to relayed live streaming

Method Description Supported minimum version
startPublishLiveStream Starts relayed live streaming. 2.4
updatePublishLiveStream Updates the parameters for relayed live streaming. 2.4
stopPublishLiveStream Stops relayed live streaming. 2.1
getPublishLiveStreamState Queries the status of relayed live streaming. 2.4

Methods related to co-streaming across channels

Method Description Supported minimum version
startChannelRelay Starts co-streaming across channels. 2.1
updateChannelRelay Updates the configuration for co-streaming across channels. 2.1
stopChannelRelay Stops co-streaming across channels. 2.1

Preview-related methods

Method Description Supported minimum version
startPreview Starts a local preview. 1.1
stopPreview Stops a local preview. 1.1

Methods for querying remote users

Method Description Supported minimum version
getOnlineRemoteUsers Queries online remote users. 1.1
getUserInfo Queries the information about a remote user. 1.1
isUserOnline Queries whether a user is online. 1.1

Other methods

Method Description Supported minimum version
setLogDirPath Sets the path for storing the log files of the SDK. 1.17
setLogLevel Sets the log level. 1.1
getSdkVersion Queries the version number of the SDK. 2.4
getErrorDescription Queries an error code. 2.1
setClientRole Specifies the role of a user. 1.16
getCurrentClientRole Queries the role of a user. 1.17.19
startNetworkQualityProbeTest Starts network quality monitoring. 1.16.2
stopNetworkQualityProbeTest Stops network quality monitoring. 1.16.2
respondMessageNotification Sends a downstream message. 2.1
uplinkChannelMessage Sends an upstream message. 2.1
postFeedback Gives feedback on an SDK issue. 1.17.12
sendMediaExtensionMsg Sends extended media 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 Queries the current status of network connection. 2.1
showDebugView Displays the debugging data of a user. 2.4

Details of methods

  • setH5CompatibleMode: specifies whether to enable the HTML5 compatibility mode.
    public static int setH5CompatibleMode(int enable);
    Parameter description
    Parameter Type Description
    enable int Specifies whether to enable the HTML5 compatibility mode. Valid values:
    • 0: disables the HTML5 compatibility mode. This is the default value.
    • 1: enables the HTML5 compatibility mode.
    Important You cannot modify the HTML5 compatibility settings for the current version after you create an AliRtcEngine instance. You must call this method before you create an AliRtcEngine instance.
  • getH5CompatibleMode: queries whether the HTML5 compatibility mode is enabled.
    public static int getH5CompatibleMode();
    Return value description

    A value of 1 indicates that the HTML5 compatibility mode is enabled. A value of 0 indicates that the HTML5 compatibility mode is disabled.

  • getInstance: creates an AliRtcEngine instance.
    public static AliRtcEngineImpl getInstance(Context context);
    Parameter description
    Parameter Type Description
    context Context The context of the Android activity.
    Important You must call this method in the main thread. Only one primary instance is allowed.
  • getInstance: creates an AliRtcEngine instance.
    public static AliRtcEngineImpl getInstance(Context context,String extras);

    This method allows you to pass in parameters to configure special SDK features.

    Parameter description
    Parameter Type Description
    context Context The context of the Android activity.
    extras String Uses a JSON string to configure a special SDK feature. For more information, see extras parameters. If you do not need to configure a special SDK feature, set this parameter to @"", which indicates an empty string.
    Important You must call this method in the main thread. Only one primary instance is allowed.
  • destroy: destroys an AliRtcEngine instance.
    public abstract void destroy();
    Important Call this method after all operations are complete.
  • uploadLog: uploads logs. By default, logs are automatically uploaded after you leave a channel.
    public static void uploadLog();
  • setRtcEngineEventListener: sets a listener to listen to the callback events of a local user.
    public abstract void setRtcEngineEventListener(AliRtcEngineEventListener listener);
    Parameter description
    Parameter Type Description
    listener AliRtcEngineEventListener The listener to listen to the callback events of the local user.
  • setRtcEngineNotify: sets a listener to listen to the callback events of a remote user.
    public abstract void setRtcEngineNotify(AliRtcEngineNotify listener);
    Parameter description
    Parameter Type Description
    listener AliRtcEngineEventListener The listener to listen to the callback events of the remote user.
  • joinChannel: joins a channel.
    public abstract int joinChannel(AliRtcAuthInfo authInfo, String userName);

    If you want to join another channel from your existing channel, you must call the leaveChannel method to leave the existing channel. If you want to retry after you fail to join a channel, you do not need to call the leaveChannel method.

    Parameter description
    Parameter Type Description
    authInfo AliRtcAuthInfo The authentication information.
    userName String The display name instead of the ID of the user.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    Important The joinChannel method is an asynchronous method. You can invoke the onJoinChannelResult callback to know whether you have joined a channel.
  • leaveChannel: leaves a channel.
    public abstract int leaveChannel();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    Note For V1.15 and later, you must call the destroy method to destroy an AliRtcEngine instance. For versions earlier than V1.15, the AliRtcEngine instance is automatically destroyed after you leave a channel. To join a channel after you leave a channel, you must call the getInstance method to initialize an AliRtcEngine instance again.

    If you call the leaveChannel method when you are not in a channel, the AliRtcEngine instance is not affected. However, a message is generated to notify other users in the channel.

  • switchChannel: switches to another channel.
    public abstract int switchChannel(AliRtcAuthInfo authInfo);
    Parameter description
    Parameter Type Description
    authInfo AliRtcAuthInfo The authentication information.
    Return value description

    This method can be called only by users of the AliRTCSdkLive role in AliRTCSdkInteractiveLive mode.

    The switchChannel method is an asynchronous method. After you switch to another channel by calling this method, the SDK first triggers the onLeaveChannelResult callback for leaving the previous channel and then the onJoinChannelResult callback for joining a new channel.

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    • If ERR_SDK_INVALID_STATE is returned, check whether the channel mode or role matches or whether you are in a channel.
    • If ERR_INVALID_ARGUMENTS is returned, check whether the authentication information is valid or whether you have already joined the channel.
    • If ERR_INNER is returned, the SDK is in an abnormal state.
  • isInCall: checks whether you are in a channel.
    public abstract boolean isInCall();
    Return value description

    A value of true indicates that you are in a channel. A value of false indicates that you are not in a channel.

  • setChannelProfile: sets the channel mode.
    public abstract int setChannelProfile(AliRTCSdkChannelProfile channelProfile);
    Parameter description
    Parameter Type Description
    channelProfile AliRTCSdkChannelProfile The channel mode. Default value: AliEngineCommunication.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    Important You can call this method only before you join a channel. You cannot change the mode of a channel when you are in the channel. However, you can change the mode of a channel after you leave the channel.
  • createChannel: creates a subchannel.
    public abstract AliRtcEngine createChannel(String extras);
    Parameter description
    Parameter Type Description
    extras String Uses a JSON string to configure a special SDK feature. For more information, see extras parameters. If you do not need to configure a special SDK feature, set this parameter to @"", which indicates an empty string.
    Return value description

    If the call is successful, the created subchannel is returned. If the call failed, null is returned.

  • destroyChannel: destroys the subchannel that is created by the calling the createChannel method.
    public abstract void destroyChannel();
  • publishLocalVideoStream: specifies whether to enable stream ingest for a video track.
    public abstract int publishLocalVideoStream(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable stream ingest for a video track. Valid values:
    • true: enables stream ingest for the video track. This is the default value.
    • false: disables stream ingest for the video track.
  • isLocalVideoStreamPublished: queries whether stream ingest is enabled for a video track.
    public abstract boolean isLocalVideoStreamPublished();
    Return value description

    A value of true indicates that stream ingest is enabled for the video track. A value of false indicates that stream ingest is disabled for the video track.

  • isScreenSharePublished: queries whether stream ingest is enabled for a screen track.
    public abstract boolean isScreenSharePublished();
    Return value description

    A value of true indicates that stream ingest is enabled for the screen track. A value of false indicates that stream ingest is disabled for the screen track.

  • publishLocalAudioStream: specifies whether to enable stream ingest for an audio track.
    public abstract int publishLocalAudioStream(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable stream ingest for an audio track. Valid values:
    • true: enables stream ingest for the audio track. This is the default value.
    • false: disables stream ingest for the audio track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isLocalAudioStreamPublished: queries whether stream ingest is enabled for an audio track.
    public abstract boolean isLocalAudioStreamPublished();
    Return value description

    A value of true indicates that stream ingest is enabled for the audio track. A value of false indicates that stream ingest is disabled for the audio track.

  • publishLocalDualStream: specifies whether to enable stream ingest for the minor stream of a video track.
    public abstract int publishLocalDualStream(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable stream ingest for the minor stream of a video track. Valid values:
    • true: enables stream ingest for the minor stream of the video track.
    • false: disables stream ingest for the minor stream of the video track. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isDualStreamPublished: queries whether stream ingest is enabled for the minor stream of a video track.
    public abstract boolean isDualStreamPublished();
    Return value description

    A value of true indicates that stream ingest is enabled for the minor stream of the video track. A value of false indicates that stream ingest is disabled for the minor stream of the video track.

  • setRemoteVideoStreamType: specifies the type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream.
    public abstract int setRemoteVideoStreamType(String uid, AliRtcVideoStreamType streamType);
    Parameter description
    Parameter Type Description
    uid String The ID of the remote user.
    streamType AliRtcVideoStreamType The type of the stream for the camera track. The default value is AliRtcVideoStreamTypeHigh, which indicates a major stream.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setRemoteDefaultVideoStreamType: specifies the type of the stream to be pulled by default for a camera track. The stream can be a major stream or a minor stream.
    public abstract int setRemoteDefaultVideoStreamType(AliRtcVideoStreamType streamType);
    Parameter description
    Parameter Type Description
    streamType AliRtcVideoStreamType The type of the stream for the camera track. The default value is AliRtcVideoStreamTypeHigh, which indicates a major stream.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setDefaultSubscribeAllRemoteAudioStreams: specifies whether to pull a stream for an audio track by default.
    public abstract int setDefaultSubscribeAllRemoteAudioStreams(boolean sub);
    Parameter description
    Parameter Type Description
    sub boolean Specifies whether to pull a stream for an audio track by default. Valid values:
    • true: pulls a stream for an audio track by default. This is the default value.
    • false: does not pull a stream for an audio track by default.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • subscribeAllRemoteAudioStreams: pulls or stops pulling streams for the audio tracks of all remote users.
    public abstract int subscribeAllRemoteAudioStreams(boolean sub);
    Parameter description
    Parameter Type Description
    sub boolean Specifies whether to pull or stop pulling streams for the audio tracks of all remote users. Valid values:
    • true: pulls streams for the audio tracks of all remote users. This is the default value.
    • false: stops pulling streams for the audio tracks of all remote users.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • subscribeRemoteAudioStream: pulls or stops pulling a stream for the audio track of a specific remote user.
    public abstract int subscribeRemoteAudioStream(String uid, boolean sub);
    Parameter description
    Parameter Type Description
    uid String The ID of the remote user.
    sub boolean Specifies whether to pull or stop pulling a stream for the audio track of a specific remote user. Valid values:
    • true: pulls a stream for the audio track of the specific remote user. This is the default value.
    • false: stops pulling a stream for the audio track of the specific remote user.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setDefaultSubscribeAllRemoteVideoStreams: specifies whether to pull a stream for a video track by default.
    public abstract int setDefaultSubscribeAllRemoteVideoStreams(boolean sub);
    Parameter description
    Parameter Type Description
    sub boolean Specifies whether to pull a stream for a video track by default. Valid values:
    • true: pulls a stream for a video track by default. This is the default value.
    • false: does not pull a stream for a video track by default.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • subscribeAllRemoteVideoStreams: pulls or stops pulling streams for the video tracks of all remote users.
    public abstract int subscribeAllRemoteVideoStreams(boolean sub);
    Parameter description
    Parameter Type Description
    sub boolean Specifies whether to pull or stop pulling streams for the video tracks of all remote users. Valid values:
    • true: pulls streams for the video tracks of all remote users. This is the default value.
    • false: stops pulling streams for the video tracks of all remote users.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • subscribeRemoteVideoStream: pulls or stops pulling a stream for the video track of a specific remote user.
    public abstract int subscribeRemoteVideoStream(String uid, AliRtcVideoTrack track, boolean sub);
    Parameter description
    Parameter Type Description
    uid Srring The ID of the remote user.
    track AliRtcVideoTrack The type of the video track.
    sub boolean Specifies whether to pull or stop pulling a stream for the video track of a specific remote user. Valid values:
    • true: pulls a stream for the video track of the specific remote user. This is the default value.
    • false: stops pulling a stream for the video track of the specific remote user.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • createRenderSurfaceView: creates a SurfaceView rendering view.
    public abstract SophonSurfaceView createRenderSurfaceView(Context context);
    Parameter description
    Parameter Type Description
    context Context The context of the Android activity.
  • createRenderTextureView: creates a TextureView rendering view.
    public abstract SophonTextureView createRenderTextureView(Context context);
    Parameter description
    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);
    Parameter description
    Parameter Type Description
    config AliRtcScreenShareEncoderConfiguration The encoding properties for screen sharing. Default values of the encoding properties:
    • dimensions: [0,0]
    • frameRate: 5
    • bitrate: 0
    • rotation: 0
  • setLocalViewConfig: sets the rendering view and drawing parameters for local preview.
    public abstract int setLocalViewConfig(AliVideoCanvas viewConfig, AliRtcVideoTrack track);

    You can switch a view before and after you join a channel. If the AliVideoCanvas class or the view parameter in the AliVideoCanvas class is left empty, rendering is stopped.

    If you need to reset the rendering mode during playback, change only the value of the renderMode parameter, but not the values of other parameters in the AliVideoCanvas class.

    If you need to reset the mirroring mode during playback, change only the value of the mirrorMode parameter, but not the values of other parameters in the AliVideoCanvas class.

    Parameter description
    Parameter Type Description
    viewConfig AliVideoCanvas The rendering configuration, including the rendering view and rendering mode.
    track AliRtcVideoTrack The type of the video track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setCameraCapturerConfiguration: sets the collection preference of a camera.
    public abstract int setCameraCapturerConfiguration(AliEngineCameraCapturerConfiguration cameraCapturerConfiguration);
    Parameter description
    Parameter Type Description
    cameraCapturerConfiguration AliEngineCameraCapturerConfiguration The collection preference of the camera. Default values of related collection preference properties:
    • preference: 0
    • cameraDirection: 0
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • enableLocalVideo: disables or re-enables local video collection.
    public abstract int enableLocalVideo(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to disable or re-enable local video collection. Valid values:
    • true: re-enables local video collection. This is the default value.
    • false: disables local video collection.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • muteLocalCamera: specifies whether to stop ingesting a stream for a local video track.
    public abstract int muteLocalCamera(boolean mute, AliRtcVideoTrack track);
    Parameter description
    Parameter Type Description
    mute boolean Specifies whether to stop ingesting a stream for a local video track. Valid values:
    • true: stops ingesting a stream for the local video track.
    • false: ingests a stream for the local video track. This is the default value.
    track AliRtcVideoTrack The type of the video track whose stream ingest status needs to be changed.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    Important You can call this method to control whether to send a black frame for a specific video track. This does not affect the video collection and sending processes. If you need to disable the video collection process, call the enableLocalVideo method. If you need to disable the video sending process, call the publishLocalVideoStream method.
  • muteAllRemoteVideoRendering: renders or stops rendering the video tracks of all remote users.
    public abstract int muteAllRemoteVideoRendering(boolean mute);

    This method does not affect the video collection and sending processes. You can call this method before or after you join a channel.

    Parameter description
    Parameter Type Description
    mute boolean Specifies whether to render or stop rendering the videos of all remote users. Valid values:
    • true: stops rendering the videos of all remote users by sending black frames.
    • false: renders the videos of all remote users. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setRemoteViewConfig: sets the rendering view and drawing parameters for the video track of a specific remote user.
    public abstract int setRemoteViewConfig(AliVideoCanvas canvas, String uid,AliRtcVideoTrack track);

    You can switch a view before and after you join a channel. If the AliVideoCanvas class or the view parameter in the AliVideoCanvas class is left empty, rendering is stopped.

    If you need to reset the rendering mode during playback, change only the value of the renderMode parameter, but not the values of other parameters in the AliVideoCanvas class.

    If you need to reset the mirroring mode during playback, change only the value of the mirrorMode parameter, but not the values of other parameters in the AliVideoCanvas class.

    Parameter description
    Parameter Type Description
    canvas AliVideoCanvas The rendering configuration, including the rendering view and rendering mode.
    uid String The ID of the user.
    track AliRtcVideoTrack The type of the video track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isCameraOn: queries whether the camera is enabled.
    public abstract boolean isCameraOn();
    Return value description

    A value of true indicates that the camera is enabled. A value of false indicates that the camera is disabled.

  • stopRecord: stops recording.
    public abstract void stopRecord();
  • StartRecord: starts recording in non-layout mode.
    public abstract boolean startRecord(AliRtcRecordType recordType,AliRtcRecordFormat recordFormat,
                                        String filePath,AliRtcRecordAudioConfig audioConfig, 
                                        AliRtcRecordVideoConfig videoConfig);
    Parameter description
    Parameter Type Description
    recordType AliRtcRecordType The recording type.
    recordFormat AliRtcRecordFormat The recording format.
    filePath String The file path.
    audioConfig AliRtcRecordAudioConfig The parameter settings of the audio recording.
    videoConfig AliRtcRecordVideoConfig The parameter settings of the video recording. This parameter is invalid for a mobile client.
    Return value description

    A value of true indicates that the call is successful. A value of false indicates that the call failed.

  • setBeautyEffect: specifies whether to enable basic retouching.
    public abstract int setBeautyEffect(boolean enable, AliRtcBeautyConfig config);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable basic retouching. Valid values:
    • true: enables basic retouching.
    • false: disables basic retouching.
    Default value: false.
    config AliRtcBeautyConfig The basic retouching configuration.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

    Note This method supports only skin whitening and skin smoothing.
  • setVideoEncoderConfiguration: sets video encoding properties.
    public abstract void setVideoEncoderConfiguration(AliRtcVideoEncoderConfiguration config);
    Parameter description
    Parameter Type Description
    config AliRtcVideoEncoderConfiguration The predefined encoding properties. Default values of the encoding properties:
    • 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);
    Parameter description
    Parameter Type Description
    track AliRtcVideoTrack The type of the video track.
    imageUrl String The URL of the watermark image.
    config AliRtcWatermarkConfig The watermark configuration.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • clearVideoWatermark: removes the watermark information from a video track.
    public abstract int clearVideoWatermark(AliRtcVideoTrack track);
    Parameter description
    Parameter Type Description
    track AliRtcVideoTrack The type of the video track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • snapshotVideo: captures a snapshot.
    public abstract int snapshotVideo(String userId, AliRtcVideoTrack trackType);
    Parameter description
    Parameter Type Description
    userId String The ID of the user. An empty value for this parameter indicates the local user.
    trackType AliRtcVideoTrack The type of the video track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. You can invoke the onSnapshotComplete callback to obtain the snapshot result.

  • switchCamera: switches between the front and rear cameras. By default, the front camera is used.
    public abstract int switchCamera();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getCurrentCameraDirection: queries the current camera type.
    public abstract AliRTCCameraDirection getCurrentCameraDirection();
    Return value description
    • A value of CAMERA_REAR(0) indicates the rear camera.
    • A value of CAMERA_FRONT(1) indicates the front camera.
    • A value of CAMERA_FRONT(1) indicates that this parameter is invalid.
    Note You can call this operation only after the camera is turned on. Otherwise, CAMERA_INVALID(-1) is returned.
  • setCameraZoom: sets the zoom factor of the camera.
    public abstract int setCameraZoom(float zoom);
    Parameter description
    Parameter Type Description
    zoom float The zoom factor. Default value: 1.0.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setCameraFlash: specifies whether to enable the camera flash.
    public abstract int setCameraFlash(boolean flash);
    Parameter description
    Parameter Type Description
    flash boolean Specifies whether to enable the camera flash. Valid values:
    • true: enables the camera flash.
    • false: disables the camera flash. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setCameraFocusPoint: sets the manual focus point of the camera.
    public abstract int setCameraFocusPoint(float pointX, float pointY);
    Parameter description
    Parameter Type Description
    pointX float The x-coordinate of the focus point.
    pointY float The y-coordinate of the focus point.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setCameraExposurePoint: sets an exposure point for the camera.
    public abstract int setCameraExposurePoint(float pointX, float pointY);
    Parameter description
    Parameter Type Description
    pointX float The x-coordinate of the exposure point.
    pointY float The y-coordinate of the exposure point.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isCameraAutoFocusFaceModeSupported: queries whether the camera supports face focus.
    public abstract boolean isCameraAutoFocusFaceModeSupported();
    Return value description

    A value of true indicates that the camera supports face focus. A value of false indicates that the camera does not support face focus.

  • setCameraAutoFocusFaceModeEnabled: specifies whether to enable face focus for the camera.
    public abstract boolean setCameraAutoFocusFaceModeEnabled(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable face focus for the camera. Valid values:
    • true: enables face focus for the camera.
    • false: disables face focus for the camera. This is the default value.
    Return value description

    A value of true indicates that the call is successful. A value of false indicates that the call failed.

  • startScreenShare: starts screen sharing.
    public abstract int startScreenShare();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startScreenShare: starts screen sharing.
    public abstract int startScreenShare(Intent intent);

    You can externally create and start the screen sharing activity.

    Parameter description
    Parameter Type Description
    intent Intent Externally creates and starts the screen sharing activity.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopScreenShare: stops screen sharing.
    public abstract int stopScreenShare();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioOnlyMode: enables the audio-only mode or the audio-video mode.
    public abstract int setAudioOnlyMode(boolean audioOnly);
    Parameter description
    Parameter Type Description
    audioOnly boolean Specifies whether to enable the audio-only mode or the audio-video mode. Valid values:
    • true: the audio-only mode. In this mode, only the stream for an audio track is ingested and pulled.
    • false: the audio-video mode. In this mode, the streams for both audio and video tracks are ingested and pulled. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isAudioOnly: queries whether the audio-only mode is enabled.
    public abstract boolean isAudioOnly();
    Parameter description

    A value of true indicates that the audio-only mode is enabled. A value of false indicates that the audio-video mode is enabled.

  • muteLocalMic: mutes or unmutes the local audio.
    public abstract int muteLocalMic(boolean mute, AliRtcMuteLocalAudioMode mode);
    Parameter description
    Parameter Type Description
    mute boolean Specifies whether to mute or unmute the local audio. Valid values:
    • true: mutes the local audio by sending a mute frame.
    • false: unmutes the local audio. This is the default value.
    mode AliRtcMuteLocalAudioMode The mute mode. By default, the microphone mute mode is used.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. If you set the mute parameter to true, the local audio is muted, but the collection and encoding processes are not affected.

  • muteRemoteAudioPlaying: specifies whether to stop the playback of the audio track of a specific remote user.
    public abstract int muteRemoteAudioPlaying(String uid, boolean mute);
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    mute boolean Specifies whether to stop the playback of the audio track of a specific remote user. Valid values:
    • true: stops the playback.
    • false: does not stop the playback. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • muteAllRemoteAudioPlaying: specifies whether to stop the playback of the audio tracks of all remote users.
    public abstract int muteAllRemoteAudioPlaying(boolean mute);
    Parameter description
    Parameter Type Description
    mute boolean Specifies whether to stop the playback of the audio tracks of all remote users. Valid values:
    • true: stops the playback.
    • false: does not stop the playback. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startAudioCapture: starts audio collection.
    public abstract int startAudioCapture();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startAudioCapture: starts audio collection.
    public abstract int startAudioCapture(boolean keepAlive);
    Parameter description
    Parameter Type Description
    keepAlive boolean The status of the audio collection device after you leave a channel. Valid values:
    • true: The audio collection device remains on after you leave the channel. This is the default value.
    • false: The audio collection device is turned off after you leave the channel.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopAudioCapture: stops audio collection.
    public abstract int stopAudioCapture();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startAudioPlayer: starts the audio player.
    public abstract int startAudioPlayer();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopAudioPlayer: stops the audio player.
    public abstract int stopAudioPlayer();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setRemoteAudioVolume: sets the local playback volume for the audio track of a specific remote user.
    public abstract int setRemoteAudioVolume(String uid, int volume);
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    int volume The local playback volume. Valid values: 0 to 100. A value of 0 indicates the mute mode. A value of 100 indicates the original volume. Default value: 100.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • enableSpeakerphone: sets the headset or speaker as the audio output device.
    public abstract int enableSpeakerphone(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to set the headset or speaker as the audio output device. Valid values:
    • true: sets the speaker as the audio output device. This is the default value.
    • false: sets the headset as the audio output device.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • isSpeakerOn: queries whether the current audio output device is the headset or the speaker.
    public abstract boolean isSpeakerOn();
    Return value description

    A value of true indicates that the current audio output device is the headset. A value of false indicates that the current audio output device is the speaker.

  • setRecordingVolume: sets the recording volume.
    public abstract int setRecordingVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The recording volume. Valid values: 0 to 400. A value of 0 indicates the mute mode. A value of 100 indicates the original volume, which is the default value. A value greater than 100 indicates a volume increase. A value less than 100 indicates a volume decrease.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setPlayoutVolume: sets the playback volume.
    public abstract int setPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The playback volume. Valid values: 0 to 400. A value of 0 indicates the mute mode. A value of 100 indicates the original volume, which is the default value. A value greater than 100 indicates a volume increase. A value less than 100 indicates a volume decrease.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • enableAudioVolumeIndication: sets the volume callback interval and smoothing factor.
    public abstract int enableAudioVolumeIndication(int interval, int smooth, int reportVad);
    Parameter description
    Parameter Type Description
    interval int The interval at which volume callbacks are sent.
    • Unit: milliseconds.
    • Default value: 300.
    • The value must be greater than or equal to 10. We recommend that you set this parameter to a value that ranges from 300 to 500. If the value is less than or equal to 0, the indicators for indicating the volume and the person who speaks are disabled.
    smooth int The smoothing factor. A larger value indicates a higher smoothing degree. A lower value indicates a lower smoothing degree but better real-time performance.
    • Default value: 3.
    • Valid values: 0 to 9. We recommend that you set this parameter to 3.
    reportVad int The switch used to detect local audio. Valid values:
    • 1: turns on the switch. You can invoke callbacks provided by the AliRtcAudioVolumeObserver class to obtain the local audio information.
    • 0: turns off the switch. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioProfile: sets the audio profile.
    public abstract int setAudioProfile(AliRtcAudioProfile profile, AliRtcAudioScenario scenario);
    Parameter description
    Parameter Type Description
    profile int The audio collection or encoding mode. Default value: AliEngineBasicQualityMode. For more information, see AliRtcAudioProfile.
    scenario int The audio scenario. Default value: AliEngineSceneDefaultMode. For more information, see AliRtcAudioScenario.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • enableAudioDTX: enables the local audio detection feature for throttling.
    public abstract int enableAudioDTX(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable the local audio detection feature for throttling. Valid values:
    • true: enables the local audio detection feature.
    • false: disables the local audio detection feature. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. Call this method before a stream is ingested. If no audio is detected after you enable the local audio detection feature, RTC performs throttling and reduces the number of bytes to be sent.

  • enableAudioAMD: enables the microphone audio detection feature for throttling.
    public abstract int enableAudioAMD(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable the microphone audio detection feature for throttling. Valid values:
    • true: enables the microphone audio detection feature.
    • false: disables the microphone audio detection feature. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. Call the method before a stream is ingested. After you enable the microphone audio detection feature, RTC stops sending audio packets if RTC detects that the microphone is muted or disabled.

  • setAudioEffectVoiceChangerMode: sets the voice change mode.
    public abstract int setAudioEffectVoiceChangerMode(AliRtcAudioEffectVoiceChangerMode mode);
    Parameter description
    Parameter Type Description
    mode AliRtcAudioEffectVoiceChangerMode The voice change mode. The default value is AliRtcSdk_AudioEffect_Voice_Changer_OFF, which indicates no voice effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioEffectPitchValue: sets the audio pitch.
    public abstract int setAudioEffectPitchValue(double value);
    Parameter description
    Parameter Type Description
    value double The pitch value. Valid values: 0.5 to 2.0. The default value is 1.0, which indicates that the pitch remains the same.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioEffectReverbMode: sets the sound effect mode.
    public abstract int setAudioEffectReverbMode(AliRtcAudioEffectReverbMode mode);
    Parameter description
    Parameter Type Description
    mode AliRtcAudioEffectReverbMode The sound effect mode. The default value is AliRtcAudioEffectReverb_Off, which indicates no sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • SetAudioEffectReverbParamType: sets the sound effect parameter.
    public abstract int setAudioEffectReverbParamType(AliRtcAudioEffectReverbParamType type, float value);
    Parameter description
    Parameter Type Description
    type AliRtcAudioEffectReverbParamType The sound effect parameter.
    value float The value of the sound effect parameter.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startAudioAccompany: starts audio mixing.
    public abstract int startAudioAccompany(String fileName, boolean onlyLocalPlay, boolean replaceMic, int loopCycles);
    Parameter description
    Parameter Type Description
    filePath String The path of the audio mixing file.
    onlyLocalPlay boolean Specifies whether to support only local playback. Valid values:
    • true: supports only local playback.
    • false: supports local playback and ingest of streams to remote users.
    replaceMic boolean Specifies whether to replace the microphone-collected audio. Valid values:
    • true: replaces the local microphone-collected audio with the background music.
    • false: ingests both the background music and the microphone-collected audio.
    loopCycles int The number of playback loops. A value of -1 indicates infinite playback loops.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopAudioAccompany: stops audio mixing.
    public abstract int stopAudioAccompany();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioAccompanyVolume: sets the volume of the mixed audio.
    public abstract int setAudioAccompanyVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. The volume that you set takes effect only after you call the startAudioAccompany method.

  • setAudioAccompanyPublishVolume: sets the volume of the mixed audio for stream ingest. This method applies to Android and iOS.
    public abstract int setAudioAccompanyPublishVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. The volume that you set takes effect only after you call the startAudioAccompany method.

  • getAudioAccompanyPublishVolume: queries the volume of the mixed audio for stream ingest.
    public abstract int getAudioAccompanyPublishVolume();
    Return value description

    The volume of the mixed audio for stream ingest is returned.

  • setAudioAccompanyPlayoutVolume: sets the volume of the mixed audio for local playback. This method applies to Android and iOS.
    public abstract int setAudioAccompanyPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. The volume that you set takes effect only after you call the startAudioAccompany method.

  • getAudioAccompanyPlayoutVolume: queries the volume of the mixed audio for local playback.
    public abstract int getAudioAccompanyPlayoutVolume();
    Return value description

    The volume of the mixed audio for local playback is returned.

  • pauseAudioAccompany: pauses audio mixing.
    public abstract int pauseAudioAccompany();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • resumeAudioAccompany: resumes audio mixing.
    public abstract int resumeAudioAccompany();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getAudioAccompanyDuration: queries the duration of a music file.
    public abstract int getAudioAccompanyDuration();
    Return value description

    The duration of the music file is returned. Unit: milliseconds.

  • getAudioAccompanyCurrentPosition: queries the playback progress of a music file.
    public abstract int getAudioAccompanyCurrentPosition();
    Return value description

    The playback progress of the music file is returned. Unit: milliseconds.

  • setAudioAccompanyPosition: sets the playback position of a music file.
    public abstract int setAudioAccompanyPosition(int posMs);
    Parameter description
    Parameter Type Description
    posMs int The position of the progress bar. Unit: milliseconds.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • preloadAudioEffect: preloads a sound effect.
    public abstract int preloadAudioEffect(int soundId, String filePath);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    filePath String The path of the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • unloadAudioEffect: deletes a preloaded sound effect.
    public abstract int unloadAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • playAudioEffect: starts the playback of a sound effect.
    public abstract int playAudioEffect(int soundId, String filePath, int cycles, boolean publish);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    filePath String The path of the sound effect.
    cycles int The number of playback loops. A value of -1 indicates infinite playback loops.
    publish boolean Specifies whether to ingest the sound effect to a remote user. Valid values:
    • true: ingests the sound effect to a remote user.
    • false: does not ingest the sound effect to a remote user. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopAudioEffect: stops the playback of a sound effect.
    public abstract int stopAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopAllAudioEffects: stops the playback of all sound effects.
    public abstract int stopAllAudioEffects();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioEffectPublishVolume: sets the volume of a sound effect for stream ingest.
    public abstract int setAudioEffectPublishVolume(int soundId, int volume);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getAudioEffectPublishVolume: queries the volume of a sound effect for stream ingest.
    public abstract int getAudioEffectPublishVolume(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAudioEffectPlayoutVolume: sets the volume of a sound effect for local playback.
    public abstract int setAudioEffectPlayoutVolume(int soundId, int volume);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getAudioEffectPlayoutVolume: queries the volume of a sound effect for local playback. This method applies to Android and iOS.
    public abstract int getAudioEffectPlayoutVolume(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAllAudioEffectsPublishVolume: sets the volume of all sound effects for stream ingest.
    public abstract int setAllAudioEffectsPublishVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setAllAudioEffectsPlayoutVolume: sets the volume of all sound effects for local playback. This method applies to Android and iOS.
    public abstract int setAllAudioEffectsPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume of the mixed audio. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • pauseAudioEffect: pauses the playback of a sound effect.
    public abstract int pauseAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • pauseAllAudioEffects: pauses the playback of all sound effects.
    public abstract int pauseAllAudioEffects();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • resumeAudioEffect: resumes the playback of a sound effect.
    public abstract int resumeAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID that is assigned by the user to the sound effect.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • resumeAllAudioEffects: resumes the playback of all sound effects.
    public abstract int resumeAllAudioEffects();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • enableEarBack: enables in-ear monitoring.
    public abstract int enableEarBack(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable in-ear monitoring. Valid values:
    • true: enables in-ear monitoring.
    • false: disables in-ear monitoring. This is the default value.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setEarBackVolume: sets the headset volume when in-ear monitoring is enabled.
    public abstract int setEarBackVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume. Valid values: 0 to 100. Default value: 100.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • requestAudioFocus: requests the audio focus.
    public abstract int requestAudioFocus();
  • abandonAudioFocus: abandons the audio focus.
    public abstract int abandonAudioFocus();
  • registerVideoSampleObserver: registers an object that is used to export video data.
    public abstract void registerVideoSampleObserver(AliVideoObserver observer);
    Parameter description
    Parameter Type Description
    observer AliVideoObserver The object that is used to export video data.
    Return value description

    The exported data is returned in the callbacks of AliVideoObserver.

  • unRegisterVideoSampleObserver: unregisters an object that is used to export video data.
    public abstract void unRegisterVideoSampleObserver();
  • registerLocalVideoTextureObserver: registers an object that is used to export the OpenGL texture data of a local camera track.
    public abstract void registerLocalVideoTextureObserver(AliTextureObserver observer);
    Parameter description
    Parameter Type Description
    observer AliTextureObserver The object that is used to export the OpenGL texture data.
    Return value description

    The exported data is returned in the callbacks of AliVideoObserver.

  • unRegisterLocalVideoTextureObserver: unregisters an object that is used to export the OpenGL texture data of a local camera track.
    public abstract void  unRegisterLocalVideoTextureObserver();
  • registerAudioObserver: registers an object that is used to export audio data.
    public abstract void registerAudioObserver(AliAudioType type, AliAudioObserver observer);
    Parameter description
    Parameter Type Description
    type AliAudioType The type of the data.
    observer AliVideoObserver The object that is used to export audio data.
  • unRegisterAudioObserver: unregisters an object that is used to export audio data.
    public abstract void unRegisterAudioObserver(AliAudioType type);
    Parameter description
    Parameter Type Description
    type AliAudioType The type of the data.
  • setSubscribeAudioNumChannel: sets the number of sound channels for the output audio. A single sound channel is used by default. You cannot configure this parameter before audio mixing is performed.
    public abstract void setSubscribeAudioNumChannel(AliRtcAudioNumChannel numChannel);
    Parameter description
    Parameter Type Description
    numChannel AliRtcAudioNumChannel The number of sound channels.
  • setSubscribeAudioSampleRate: sets the sampling rate for the output audio. The default sampling rate is 44.1 kHz. You cannot configure this parameter before audio mixing is performed.
    public abstract void setSubscribeAudioSampleRate(AliRtcAudioSampleRate sampleRate );
    Parameter description
    Parameter Type Description
    sampleRate AliRtcAudioSampleRate The sampling rate.
  • registerAudioVolumeObserver: registers an object that is used to export volume data.
    public abstract void registerAudioVolumeObserver(AliRtcAudioVolumeObserver observer);
    Parameter description
    Parameter Type Description
    observer AliRtcAudioVolumeObserver The object that is used to export volume data.
  • unRegisterAudioVolumeObserver: unregisters an object that is used to export volume data.
    public abstract void unRegisterAudioVolumeObserver();
  • setExternalVideoSource: specifies whether to enable an external video source.
    public abstract void setExternalVideoSource(boolean enable,boolean useTexture,
                                                AliRtcVideoTrack streamType,AliRtcRenderMode renderMode);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable an external video source. Valid values:
    • true: enables an external video source.
    • false: disables an external video source. This is the default value.
    useTexture boolean Specifies whether to use the texture mode.
    • true: uses the texture mode.
    • false: does not use the texture mode.
    type AliRtcVideoTrack The type of the video track.
    renderMode AliRtcRenderMode The rendering mode.
  • pushExternalVideoFrame: imports video data from an external video source.
    public abstract int pushExternalVideoFrame(AliRtcRawDataFrame aliRawDataFrame,AliRtcVideoTrack streameType);
    Parameter description
    Parameter Type Description
    aliRawDataFrame AliRtcRawDataFrame The information about the video data.
    streameType AliRtcVideoTrack The type of the video track.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setExternalAudioSource: specifies whether to enable an external audio source.
    public abstract  int setExternalAudioSource(boolean enable ,int sampleRate,int channels);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable an external audio source.
    • true: enables an external audio source.
    • false: disables an external audio source. This is the default value.
    sampleRate int The sampling rate.
    channelsPerFrame int The number of sound channels. Valid values: 1 and 2.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • pushExternalAudioFrameRawData: imports audio data from an external audio source.
    public abstract  int pushExternalAudioFrameRawData(byte[] samples,int samplesLength,long timestamp);
    Parameter description
    Parameter Type Description
    samples byte[] The information about the audio data. We recommend that you import audio data of up to 40 ms in length.
    samplesLength int The sampling rate.
    timestamp double The timestamp.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setExternalAudioVolume: sets the volume of an external audio source.
    public abstract  int setExternalAudioVolume(int vol);
    Parameter description
    Parameter Type Description
    vol int The volume. Valid values: 0 to 100. Default value: 50.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getExternalAudioVolume: queries the volume of the mixed audio.
    public abstract  int getExternalAudioVolume();
    Return value description

    The volume of the mixed audio is returned.

  • setMixedWithMic: specifies whether to mix an external audio source with the microphone-collected audio.
    public abstract int setMixedWithMic(boolean mixed);
    Parameter description
    Parameter Type Description
    mixed boolean Specifies whether to mix an external audio source with the microphone-collected audio. Valid values:
    • true: mixes the external audio source with the microphone-collected audio. This is the default value.
    • false: replaces the microphone-collected audio with the external audio source.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • setExteranlAudioRender: specifies whether to enable the playback of an external audio source.
    public abstract int setExteranlAudioRender(boolean enable,int sampleRate,int channelsPerFrame);
    Parameter description
    Parameter Type Description
    enable boolean Specifies whether to enable the playback of an external audio source. Valid values:
    • true: enables the playback.
    • false: disables the playback. This is the default value.
    sampleRate int The sampling rate.
    channelsPerFrame int The number of sound channels. Valid values: 1 and 2.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • pushExternalAudioRenderRawData: imports audio data from an external audio source for playback.
    public abstract int pushExternalAudioRenderRawData(byte[]audioSamples ,int sampleLength,int sampleRate,
                                                       int channelsPerFrame, long timestamp);
    Parameter description
    Parameter Type Description
    audioSamples byte[] The information about the audio data.
    sampleLength int The length of the audio data.
    sampleRate int The sampling rate.
    channelsPerFrame int The number of sound channels.
    timestamp long The timestamp.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startPublishLiveStream: starts relayed live streaming.
    public abstract int startPublishLiveStream(String streamUrl,AliRtcLiveTranscodingParam transcodingParam);
    Parameter description
    Parameter Type Description
    streamUrl String The ingest URL for relayed live streaming.
    transcodingParam AliRtcLiveTranscodingParam The parameters for relayed live streaming.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • updatePublishLiveStream: updates the parameters for relayed live streaming.
    public abstract int updatePublishLiveStream(String streamUrl,AliRtcLiveTranscodingParam transcodingParam);
    Parameter description
    Parameter Type Description
    streamUrl String The ingest URL for relayed live streaming.
    transcodingParam AliRtcLiveTranscodingParam The parameters for relayed live streaming.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopPublishLiveStream: stops relayed live streaming.
    public abstract int stopPublishLiveStream(String streamUrl);
    Parameter description
    Parameter Type Description
    streamUrl String The ingest URL for relayed live streaming.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startChannelRelay: starts co-streaming across channels.
    public abstract int startChannelRelay(AliRtcChannelRelayConfiguration configuration);
    Parameter description
    Parameter Type Description
    configuration AliRtcChannelRelayConfiguration The configuration for co-streaming across channels.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • updateChannelRelay: updates the configuration for co-streaming across channels.
    public abstract int updateChannelRelay(AliRtcChannelRelayConfiguration configuration);
    Parameter description
    Parameter Type Description
    configuration AliRtcChannelRelayConfiguration The configuration for co-streaming across channels.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopChannelRelay: stops co-streaming across channels.
    public abstract int stopChannelRelay();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • startPreview: starts a local preview.
    public abstract int startPreview();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • stopPreview: stops a local preview.
    public abstract int stopPreview();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getOnlineRemoteUsers: queries online remote users.
    public abstract String[] getOnlineRemoteUsers();
    Return value description

    A list of IDs for online remote users are returned.

  • getUserInfo: queries the information about a remote user.
    public abstract AliRtcRemoteUserInfo getUserInfo(String uid);
    Parameter description
    Parameter Type Description
    uid String The ID of the remote user. It is uniquely assigned by the AppServer.
    Return value description

    The information about the remote user is returned. For more information, see AliRtcRemoteUserInfo.

  • isUserOnline: queries whether a user is online.
    public abstract boolean isUserOnline(String uid);
    Parameter description
    Parameter Type Description
    uid String The ID of the user. It is uniquely assigned by the AppServer.
    Return value description

    A value of true indicates that the user is online. A value of false indicates that the user is offline.

  • setLogDirPath: sets the path for storing the log files of the SDK.
    public static int setLogDirPath(String logDirPath);
    Parameter description
    Parameter Type Description
    logDirPath String The absolute path for storing the log files of the SDK. By default, the log files of the SDK are stored in the /sdcard/Ali_RTC_Log directory.
    Return value description
    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.
    Note We recommend that you call this method before you call all other methods to avoid log loss. Before you call this method, make sure that the path specified by the logDirPath parameter exists and log files can be written to the path.
  • setLogLevel: sets the log level.
    public static void setLogLevel(AliRtcLogLevel logLevel);
    Parameter description
    Parameter Type Description
    logLevel AliRtcLogLevel The log level.
  • getSdkVersion: queries the version number of the SDK.
    public static String getSdkVersion();
    Return value description

    The version number of the SDK is returned.

  • getErrorDescription: queries an error code.
    public static String getErrorDescription(int errorCode);
    Parameter description
    Parameter Type Description
    errorCode int The error code.
    Return value description

    The error code in the STRING format is returned.

  • setClientRole: specifies the role of a user.
    public abstract int setClientRole(AliRTCSdkClientRole clientRole);
    Parameter description
    Parameter Type Description
    clientRole AliRTCSdkClientRole The role of the user. The default value is AliRTCSdkLive, which indicates a viewer. This parameter is takes effect only in non-communication mode.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getCurrentClientRole: queries the role of a user.
    public abstract AliRTCSdkClientRole getCurrentClientRole();
    Return value description

    The role of the user is returned.

  • startNetworkQualityProbeTest: starts network quality monitoring.
    public abstract int startNetworkQualityProbeTest();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. Call this method before you join a channel. You can invoke the onNetworkQualityProbeTest callback to obtain the monitoring result.

  • stopNetworkQualityProbeTest: stops network quality monitoring.
    public abstract int stopNetworkQualityProbeTest();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • respondMessageNotification: sends a downstream message.
    public abstract int respondMessageNotification(String tid, String contentType, String content);
    Parameter description
    Parameter Type Description
    tid String The ID of the message.
    contentType String The type of the message.
    content String The content of the message.
  • uplinkChannelMessage: sends an upstream message.
    public abstract int uplinkChannelMessage(String contentType, String content);

    The software as a service (SaaS) client sends a message to the SaaS server.

    Parameter description
    Parameter Type Description
    contentType String The type of the message.
    content String The content of the message.
  • postFeedback: gives feedback on an SDK issue.
    public abstract void postFeedback(String uid,String channelId,String description,AliRtcFeedbackType type,long timeStamp);
    Parameter description
    Parameter Type Description
    uid String The ID of the current user. You can leave this parameter empty.
    channelId String The ID of the current channel. You can leave this parameter empty.
    description String The description of the issue. You cannot leave this parameter empty.
    type AliRtcFeedbackType The type of the issue.
    timeStamp long The UNIX timestamp when the issue occurred. You can set this parameter to an approximate timestamp or 0.
  • sendMediaExtensionMsg: sends extended media information.
    public abstract int sendMediaExtensionMsg(byte[]message, int repeatCount);
    Parameter description
    Parameter Type Description
    message byte[] The extended information of the instance.
    repeatCount int The number of times that the extended information is repeatedly sent.
    Return value description
    • 0: The call is successful.
    • -1: No stream is ingested.
    • -2: A parameter is invalid.
    • -3: The extended information was sent for many times in a short period of time. Try again later.
  • startIntelligentDenoise: enables intelligent noise reduction.
    public abstract int startIntelligentDenoise();
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed. You can call this method to enable intelligent noise reduction during a voice or video call.

  • stopIntelligentDenoise: disables intelligent noise reduction.
    public abstract void stopIntelligentDenoise();
  • refreshAuthInfo: refreshes the authentication information.
    public abstract int refreshAuthInfo(AliRtcAuthInfo authInfo);
    Parameter description
    Parameter Type Description
    authInfo AliRtcAuthInfo The authentication information.
    Return value description

    A value of 0 indicates that the call is successful. A value other than 0 indicates that the call failed.

  • getCurrentConnectionStatus: queries the current status of network connection.
    public abstract AliRtcConnectionStatus getCurrentConnectionStatus();
    Return value description

    The current status of network connection is returned. For more information, see AliRtcConnectionStatus.

  • getVideoCaptureData: proactively obtains the collected data.
    public abstract boolean getVideoCaptureData(AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);
    Parameter description
    Parameter Type Description
    track AliRtcVideoTrack The type of the video track.
    videoSample AliRtcVideoSample The information about the video sample.
    Return value description

    A value of true indicates that the call is successful. A value of false indicates that the call failed.

  • getVideoPreEncoderData: proactively obtains the data that is prepared for encoding.
    public abstract boolean getVideoPreEncoderData(AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);
    Parameter description
    Parameter Type Description
    track AliRtcVideoTrack The type of the video track.
    videoSample AliRtcVideoSample The information about the video sample.
    Return value description

    A value of true indicates that the call is successful. A value of false indicates that the call failed.

  • getVideoRenderData: proactively obtains the stream pulling data.
    public abstract boolean getVideoRenderData(String userId, AliRtcEngine.AliRtcVideoTrack track, AliRtcEngine.AliRtcVideoSample videoSample);
    Parameter description
    Parameter Type Description
    userId String The ID of the remote user.
    track AliRtcVideoTrack The type of the video track.
    videoSample AliRtcVideoSample The information about the video sample.
    Return value description

    A value of true indicates that the call is successful. A value of false indicates that the call failed.

  • getPublishLiveStreamState: queries the status of relayed live streaming.
    public abstract AliRtcEngine.AliRtcLiveTranscodingState getPublishLiveStreamState(String streamUrl);
    Parameter description
    Parameter Type Description
    streamUrl String The ingest URL for relayed live streaming.
    Return value description

    The status of relayed live streaming is returned.

  • showDebugView: displays the debugging data of a user.
    public abstract void showDebugView(ViewGroup viewGroup, int showType, String userId);
    Parameter description
    Parameter Type Description
    viewGroup ViewGroup The display view, which is subject to the actual business requirements.
    showType int The display type. Valid values:
    • 0: displays no data. This is the default value.
    • 1: displays the audio data.
    • 2: displays the video data.
    • 3: displays the network data.
    • 4: displays all data.
    Note You can set this parameter to a special value to display private data.
    userId String The ID of the user.