This topic describes the AliRtcEngine interface of the Android SDK.

Table of contents

Note ALI_RTC_INTERFACE classes are no longer available in 1.17 and later versions. ALI_RTC_INTERFACE parameters and enumeration classes of 1.17 and later versions are all migrated to the AliRtcEngine class.

Basic methods

API Description Supported in the above version
setH5CompatibleMode Set the H5 compatibility mode. 1.1
getH5CompatibleMode Check whether H5 is currently compatible. 1.1
getInstance Create an AliRTCEngine instance (only one instance will exist at the same time) and can be called only on the main thread. 1.1
getInstance Create an AliRTCEngine instance. You can specify parameters to configure special SDK features (only one instance exists at a time) and can be called only on the main thread. 1.1
setRtcEngineEventListener Specifies the listener for callback events of local user behavior. 1.1
setRtcEngineNotify Sets the listener for notification events of remote user behavior. 1.1
destroy Destroy the SDK. 1.1
uploadLog Upload logs. 1.15

Channel-related interfaces

API Description Supported in the above version
setAutoPublish Specify whether to automatically publish and subscribe. We recommend that you use setAutoPublishSubscribe interfaces instead of implementing this feature. 1.1
joinChannel Join the channel. 1.1
leaveChannel Off the channel. 1.1
isInCall Check whether you are currently in the channel. 1.1
setChannelProfile Set the channel mode. 1.15
setAutoPublishSubscribe Specify whether to publish or subscribe automatically. 1.17

Publish related interfaces

API Description Supported in the above version
isAutoPublish You can call this operation to query whether the automatic publishing mode is current. 1.1
configLocalCameraPublish Specify whether to allow the camera stream to be published. 1.1
isLocalCameraPublishEnabled Queries whether the camera stream is currently allowed to be published. 1.1
configLocalScreenPublish Specify whether to allow publishing screen streams. 1.1
isLocalScreenPublishEnabled Queries whether the current screen stream is allowed to be published. 1.1
configLocalAudioPublish Specify whether to allow the audio stream to be published. 1.1
isLocalAudioPublishEnabled Queries whether the current audio stream is allowed to be published. 1.1
configLocalSimulcast Specify whether to allow secondary video streams to be published. 1.1
isLocalSimulcastEnabled Queries whether secondary video streams are currently allowed to be published. 1.1
publish Manually publish video and audio streams. 1.1

Subscription-related interfaces

API Description Supported in the above version
isAutoSubscribe Query whether the current subscription mode is automatic. 1.1
configRemoteCameraTrack Specifies whether to subscribe to the remote camera stream. 1.1
configRemoteScreenTrack Specifies whether to subscribe to a remote screen stream. 1.1
configRemoteAudio Specifies whether to subscribe to remote audio streams. 1.1
subscribe Manually subscribe to video and audio streams. 1.1
registerTexturePreObserver Process texture data before subscription. 1.15
unRegisterTexturePreObserver Process texture data before unsubscribing. 1.15

Video-related methods

API Description Supported in the above version
setVideoProfile Set parameters for the video stream. 1.1
getVideoProfile Queries the parameters of the current video stream. 1.1
setLocalViewConfig Set the rendering window and drawing parameters for local preview. 1.1
muteLocalCamera Specify whether to stop publishing local video streams. 1.1
setRemoteViewConfig Set the rendering window and drawing parameters for the remote video. 1.1
switchCamera Switches between the front and the rear cameras. 1.1
getCurrentCameraType Gets the current camera type. 1.1
setPreCameraType The camera direction of the preset value. 1.1
getPreCameraType Gets the preset camera direction. 1.1
setCameraZoom Set camera parameters. 1.1
isCameraOn Check whether the camera is turned on. 1.1
isCameraSupportExposurePoint Whether the camera supports manual exposure. 1.14
isCameraSupportFocusPoint Whether the camera supports manual focus. 1.14
setCameraExposurePoint Sets the coordinate point for manual exposure. 1.14
setCameraFocusPoint Sets the coordinate point for manual focus. 1.14
isCameraFlash Whether the flash is turned on. 1.14
getCameraZoom Gets the zoom value of the camera. 1.14
registerPreprocessVideoObserver Registration Face Recognition preprocessing. 1.14
muteAllRemoteVideoRendering Rendering of all video tracks at the remote end of mute or unmute. 1.16.2
setBeautyEffect Set Basic Beauty. 1.17.9
registerVideoSampleObserver Registers the video data callback. 1.17
unRegisterVideoSampleObserver Unregister the video data callback. 1.17
setVideoEncoderConfiguration Set video encoding properties. 1.17.31
isCameraAutoFocus Specifies whether to enable autofocus. 1.17
registerVideoRawDataInterface Registers an external video data callback interface. 1.17
unRegisterVideoRawDataInterface Unregister the external video data callback interface. 1.17
createRenderSurfaceView Creates a SurfaceView rendering view. 1.17.39
createRenderTextureView Creates a TextureView rendering view. 1.17.39
enableLocalVideo Disable or re-enable local video collection. 1.17.39

Audio-related methods

API Description Supported in the above version
setAudioOnlyMode Set whether to audio-only mode or audio-video mode. 1.1
isAudioOnly Query whether the current audio-only mode is displayed. 1.1
muteRemoteAudioPlaying Specifies whether to stop playing remote audio streams. 1.1
enableSpeakerphone Toggle the handset, speaker output. 1.1
isSpeakerOn Queries whether the speaker is enabled. 1.1
startAudioCapture Enable audio collection. 1.11
stopAudioCapture Disable audio collection. 1.11
startAudioPlayer Enable audio playback. 1.11
stopAudioPlayer Disables audio playback. 1.11
enableEarBack Enables in-ear monitoring. 1.15
startAudioAccompany Start playing the accompaniment. 1.15
pauseAudioAccompany Pause to play the accompaniment. 1.15
resumeAudioAccompany Resume playing the accompaniment. 1.15
stopAudioAccompany End play accompaniment. 1.15
setAudioAccompanyPublishVolume Set the volume of the accompaniment stream. 1.15
setAudioAccompanyPlayoutVolume Set the local volume of the accompaniment. 1.15
getAudioAccompanyPublishVolume Gets the volume of the accompaniment stream. 1.15
getAudioAccompanyPlayoutVolume Gets the local volume of the accompaniment. 1.15
setAudioAccompanyVolume Set the accompaniment stream and local volume. 1.15
preloadAudioEffect Preload sound effects. 1.15
unloadAudioEffect Clears preloaded sound effects. 1.15
playAudioEffect Start playing sound effects. 1.15
setAudioEffectPublishVolume Set the audio ingest volume. 1.15
getAudioEffectPublishVolume Gets the volume of the audio ingest. 1.15
setAudioEffectPlayoutVolume Set the local volume of the sound effect. 1.15
getAudioEffectPlayoutVolume Gets the local volume of the sound effect. 1.15
pauseAudioEffect Pause playback of sound effects. 1.15
resumeAudioEffect Resumes playing sound effects. 1.15
stopAudioEffect Stop playing sound effects. 1.15
setEarBackVolume The headset volume when in-ear monitoring is enabled. 1.15
setRecordingVolume Sets the recording volume. 1.16
setPlayoutVolume Sets the playback volume. 1.16
muteAllRemoteAudioPlaying Stop the playback of all audio streams at the far end. 1.16.2
registerAudioVolumeObserver Registers the volume callback. 1.16.2
unRegisterAudioVolumeObserver Unregister the volume callback. 1.16.2
startRecord Start recording files. 1.17
stopRecord Stop recording files. 1.17
setAudioEffectReverbMode Set the reverb sound mode. 1.17
setAudioEffectReverbParamType Specifies the reverb sound effect type. 1.17
setVolumeCallbackIntervalMs Set the volume callback frequency and smoothing factor. 1.17
setExternalAudioSource Specifies whether to use external audio data as the input source for streaming. 1.17.9
pushExternalAudioFrameRawData Input audio data. 1.17.9
setExternalAudioVolume Set the external audio input volume. 1.17.9
getExternalAudioVolume Gets the external audio input volume. 1.17.9
setMixedWithMic Specifies whether the external audio input is mixed with the microphone to collect audio. 1.17.9
setExteranlAudioRender Specifies whether to enable external input audio playback. 1.17.9
pushExternalAudioRenderRawData Input audio playback data. 1.17.9
getCurrentClientRole Gets the current role. 1.17.9
setSubscribeAudioNumChannel Specifies the number of callback audio channels. 1.17.13
setSubscribeAudioSampleRate Specifies the callback audio sample rate. 1.17.13
requestAudioFocus Request audio focus. 1.17.19
abandonAudioFocus Lost audio focus. 1.17.19
registerAudioObserver Registers audio data callbacks. 1.17
muteLocalMic Local audio collection. 1.17.30
getAudioAccompanyDuration Gets the duration of the accompaniment file. 1.17.30
getAudioAccompanyCurrentPosition Gets the music file playback progress. 1.17.30
setAudioAccompanyPosition Sets the playback position of background music. 1.17.30
stopAllAudioEffects Stop playing all sound effects. 1.17.30
setAllAudioEffectsPublishVolume Set the streaming volume of all sound effects. 1.17.30
setAllAudioEffectsPlayoutVolume Set the local playback volume for all sound effects. 1.17.30
pauseAllAudioEffects Pause all sound effects. 1.17.30
resumeAllAudioEffects Start playing all sound effects again. 1.17.30
unRegisterAudioObserver Unregister the audio data callback. 1.17

Preview Port

API Description Supported in the above version
startPreview Start local preview. 1.1
stopPreview Stop local preview. 1.1
enableHighDefinitionPreview Specifies whether to enable high-definition preview. 1.16

Remote user query interface

API Description Supported in the above version
getOnlineRemoteUsers Obtains the list of remote online users. 1.1
getUserInfo Queries remote user information. 1.1
isUserOnline Queries whether a user is online. 1.1
getMediaInfoWithUserId Gets the media stream information. 1.9

Other operations

API Description Supported in the above version
setLogLevel Configures the log level. 1.1
getSdkVersion Obtain the SDK version number. 1.1
setClientRole Specify a user role. 1.16
setLogDirPath Sets the path for storing the log files of AliLive SDK. 1.16.2
setDeviceOrientationMode Set the horizontal and vertical screen direction of the device. 1.16.2
startNetworkQualityProbeTest Start network quality detection. 1.16.2
stopNetworkQualityProbeTest Stop network quality detection. 1.16.2
postFeedback SDK problem feedback. 1.17.13
sendMediaExtensionMsg Send media extension information. 1.17.1
respondMessageNotification The message status webhook is used to receive notifications 1.17
refreshAuthInfo Refresh the token. 1.17.41

API operation details

  • setH5CompatibleMode: specifies whether to enable H5 compatibility.

    AliRtcEngine.setH5CompatibleMode(int enable)           
    Parameter description
    Parameter Type Description
    enable int 0 indicates that it is not compatible with H5, and 1 indicates that it is compatible with H5. Incompatible with H5 by default.
    Notice You can call this operation only before you create an AliRtcEngine instance.
  • getH5CompatibleMode: checks whether the system is compatible with H5.

    public static int getH5CompatibleMode()

    Return result

    1 indicates compatible, and 0 indicates incompatible.

    Notice You can call this operation only after you create an AliRtcEngine instance.
  • getInstance: creates an AliRTCEngine instance.

    public static AliRtcEngineImpl getInstance(Context context)          
    Parameter description
    Parameter Type Description
    context Context The context of Android (Android Activity).
    Notice Only one instance will exist at the same time and can only be called on the main thread.
  • getInstance: creates an AliRTCEngine instance. Supports configuring SDK special features by passing in parameters.

    public static AliRtcEngineImpl getInstance(Context context, String extras)
    Parameter description
    Parameter Type Description
    context Context The context of Android (Android Activity).
    extras String For more information about the special features of the SDK, see Extras.
    Notice Only one instance will exist at the same time and can only be called on the main thread.
  • setRtcEngineEventListener: specifies the listener for callback events of local user behavior.

    public abstract void setRtcEngineEventListener(AliRtcEngineEventListener listener)                    
    Parameter description
    Parameter Type Description
    listener AliRtcEngineEventListener The listener that receives the callback event.
  • setRtcEngineNotify: specifies the listener for notification events of remote user behaviors.

    public abstract void setRtcEngineNotify(AliRtcEngineNotify engineNotify)               
    Parameter description
    Parameter Type Description
    engineNotify AliRtcEngineNotify The listener that receives notifications.
  • destroy: destroys the SDK.

    1.15 or later: Destroy the SDK only by using the destroy method.

    1.15 the following version: When you leave a channel, the AliRtcEngine instance is destroyed. To continue to join a channel, you must call the getInstance operation again to initialize the AliRtcEngine instance.

    public abstract void destroy();                  
    Notice This interface can only be called on the main thread.
  • uploadLog: uploads logs.

    AliRtcEngine.uploadLog();
    Notice 1.17 and later versions are changed to static methods. For 1.17 and later versions, use: public abstract void uploadLog();.
  • setAutoPublish: specifies whether to automatically publish and subscribe.

    public int setAutoPublish(boolean autoPub, boolean autoSub);
    Parameter description
    Parameter Type Description
    autoPub boolean true indicates automatic publishing. false indicates manual publishing. Automatic publishing by default.
    autoSub boolean true indicates automatic subscription. false indicates manual subscription. Automatic subscription by default.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Notice This port must be set before joining the channel.
  • joinChannel: joins a channel.

    After you join a channel, you must call the leaveChannel operation to leave the channel. If you fail to join a channel, you do not need to call the leaveChannel operation.

    public abstract void joinChannel(AliRtcAuthInfo authInfo, String userName)                    
    Parameter description
    Parameter Type Description
    authInfo AliRtcAuthInfo The authentication information.
    userName String The display name of the user (not the user ID).
  • leaveChannel: leaves the channel.

    public abstract void leaveChannel()                          

    1.15 or later: The instance is not destroyed when you call the leaveChannel operation.

    If the version is later than 1.15, the AliRtcEngine instance is destroyed when you leave the channel. If you want to continue to join the channel, you must call getInstance again to initialize the AliRtcEngine instance.

    • For SDKs whose version number is greater than 1.7, call the following operation.
      public abstract void leaveChannel()                          
    • For SDKs whose version number is less than or equal to 1.7, add the timeout parameter. We generally recommend that you set this parameter to 1000, which indicates that the call timeout period for this operation is 1 second.
      public abstract void leaveChannel(long timeout)                          
  • isInCall: checks whether it is currently in the channel.

    public abstract boolean isInCall()                  

    Return result

    Returns true to indicate that it is in the channel, and false to indicate that it is not in the channel.

  • setChannelProfile: Set the channel mode.

    public abstract int setChannelProfile(AliRTCSDK_Channel_Profile profile);
    Parameter description
    Parameter Type Description
    profile AliRTCSDK_Channel_Profile The type of the channel mode. The default communication mode.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Notice You can call this operation only before joinChannel. You cannot reset this operation during communication. You can reset this operation after you call LeaveChannel.
  • setAutoPublishSubscribe: specifies whether to automatically publish or automatically subscribe.

    public abstract int setAutoPublishSubscribe(boolean autoPub, boolean autoSub);
    Parameter description
    Parameter Type Description
    autoPub boolean true indicates automatic publishing. false indicates manual publishing. Automatic publishing by default.
    autoSub boolean true indicates automatic subscription. false indicates manual subscription. Automatic subscription by default.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Note This port must be set before joining the channel.
  • isAutoPublish: queries whether the automatic publishing mode is displayed.

    public abstract boolean isAutoPublish()                  

    Return result

    true indicates automatic publishing. false indicates manual publishing.

  • configLocalCameraPublish: specifies whether to allow the camera stream to be published.

    public abstract void configLocalCameraPublish(boolean enable)                
    Parameter description
    Parameter Type Description
    enable boolean true indicates that the camera stream is allowed to be published. false indicates that the camera stream is not allowed. The default is to allow the camera stream to be published.
    Notice If you manually publish a file, you must call Publish to take effect.
  • isLocalCameraPublishEnabled: queries whether the camera stream is currently allowed to be published.

    public abstract boolean isLocalCameraPublishEnabled()                   

    Return result

    true indicates allowed. false indicates not allowed.

  • configLocalScreenPublish: specifies whether to allow the release of screen streams.

    public abstract void configLocalScreenPublish(boolean enable)                  
    Parameter description
    Parameter Type Description
    enable boolean true indicates that the screen stream is allowed to be published. false indicates that the screen stream is not allowed. The default is not allowed to publish screen streams.
    Notice If you manually publish a file, you must call Publish to take effect.
  • isLocalScreenPublishEnabled: queries whether the screen stream is currently allowed to be published.

    public abstract boolean isLocalScreenPublishEnabled()                   

    Return result

    true indicates that the screen stream is allowed to be published. false indicates that the screen stream is not allowed to be published.

  • configLocalAudioPublish: specifies whether to allow audio streams to be published.

    public abstract void configLocalAudioPublish(boolean enable)          
    Parameter description
    Parameter Type Description
    enable boolean true indicates allowed. false indicates not allowed. The default is to allow audio streams to be published.
    Notice If you manually publish a file, you must call Publish to take effect.
  • isLocalAudioPublishEnabled: queries whether the current audio stream is allowed to be published.

    public abstract boolean isLocalAudioPublishEnabled()                
    Return result

    true indicates that the audio stream is allowed to be published. false indicates that the audio stream is not allowed to be published.

  • configLocalSimulcast: specifies whether to allow secondary video streams to be published.

    public abstract int configLocalSimulcast(boolean enable, AliRtcVideoTrack track)        
    Parameter description
    Parameter Type Description
    enable boolean true indicates that secondary streams are allowed to be published. false indicates that secondary streams are not allowed. The default is to allow secondary video streams to be published.
    track AliRtcVideoTrack The type of the streams to query. Currently, only AliVideoTrackCamera (camera stream) is supported.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Notice If you manually publish a file, you must call Publish to take effect.
  • isLocalSimulcastEnabled: queries whether secondary video streams are allowed to be published.

    public abstract boolean isLocalSimulcastEnabled()                  

    Return result

    true indicates that secondary video streams are allowed to be published. false indicates that secondary video streams are not allowed to be published.

  • publish: Manually publish video and audio streams.

    public abstract void publish()                  
    • The actual performance of the call publish must be determined by combining the configLocalCameraPublish, configLocalScreenPublish, configLocalAudioPublish, and configLocalSimulcast interfaces.
    • Configure the parameters of the preceding four interfaces based on your specific business requirements to publish the corresponding video and audio streams.
    • Publish and stop publishing are both calls to publish.
    • If you want to stop publishing, you need to set the parameters of the preceding four configuration interfaces to false, and then call publish.
    • You need to call this operation after the channel is successfully added.
  • isAutoSubscribe: queries whether the subscription mode is automatic.

    public abstract boolean isAutoSubscribe()                 

    Return result

    true indicates automatic subscription. false indicates manual subscription.

  • configRemoteCameraTrack: specifies whether to subscribe to remote camera streams.

    public abstract void configRemoteCameraTrack(String uid, boolean master, boolean enable)                  
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    master boolean true indicates that a large stream is subscribed first. false indicates that a small stream is subscribed to. The default value is to subscribe to a large stream.
    enable boolean No subscription by default. true to subscribe to the remote camera stream. false to stop subscribing to the remote camera stream.
    Notice When you need to perform operations on streams (such as manual subscription or disabling subscription), you must call subscribe to take effect.
  • configRemoteScreenTrack: specifies whether to subscribe to the remote screen stream.

    public abstract void configRemoteScreenTrack(String uid, boolean enable)                  
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    enable boolean true to subscribe to the remote screen stream. false to stop subscribing to the remote screen stream. The default is to not subscribe to remote screen streams.
    Notice When you need to perform operations on streams (such as manual subscription or disabling subscription), you must call subscribe to take effect.
  • configRemoteAudio: specifies whether to subscribe to remote audio streams.

    public abstract void configRemoteAudio(String uid, boolean enable)                  
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    enable boolean true to subscribe to the remote audio stream. false to stop subscribing to the remote audio stream. The default is to subscribe to remote audio streams.
    Notice When you need to perform operations on streams (such as manual subscription or disabling subscription), you must call subscribe to take effect.
  • subscribe: manually subscribes to video and audio streams.

    public abstract int subscribe(String uid)                 
    • The actual performance of the call to subscribe must be determined by combining interfaces such as configRemoteCameraTrack, configRemoteScreenTrack, and configRemoteAudio.
    • Configure the parameters of the preceding three interfaces based on your specific business requirements to subscribe to the corresponding video and audio streams.
    • Subscribe and Stop Subscribe are both calls to subscribe.
    • To stop the subscription, you must set the parameters of the preceding three configuration interfaces to false, and then call Subscribe.
    Parameter description
    Parameter Type Description
    uid String The ID of the user.

    Return result

    0 indicates that the interface is running normally. Whether the subscription is successful depends on the subscription callback result. If it is not 0, the execution of the interface is interrupted and the subscription fails.

  • registerTexturePreObserver: processes texture data before subscription.
    public abstract void registerTexturePreObserver(String userId, AliRtcEngine.AliTextureObserver observer);
    Parameter description
    Parameter Type Description
    userId String The ID of the subscribed user. Generally, local beautification is required. You can enter an empty string ("") or local uid.
    observer AliTextureObserver Video stream callback interface.
  • unRegisterTexturePreObserver: Unprocess texture data before ordering.
    public abstract void unRegisterTexturePreObserver(String userId);
    Parameter description
    Parameter Type Description
    userId String The ID of the subscribed user. Generally, local beautification is required. You can enter an empty string ("") or local uid.
  • setVideoProfile: Set parameters for the video stream.

    public abstract void setVideoProfile(AliRtcVideoProfile profile, AliRtcVideoTrack track)                   
    Parameter description
    Parameter Type Description
    profile AliRtcVideoProfile The video stream parameters. A camera stream with a default resolution of 480*640 and a frame rate of 15.
    track AliRtcVideoTrack The type of the video stream to be set. The default camera stream.
  • getVideoProfile: queries the parameters of the current video stream.

    public abstract AliRtcVideoProfile getVideoProfile(AliRtcVideoTrack track)                    
    Parameter description
    Parameter Type Description
    track AliRtcVideoTrack The type of the video stream to be queried.

    Return result

    This operation returns the AliRtcVideoProfile (video stream specification data type).

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

    public abstract int setLocalViewConfig(AliVideoCanvas viewConfig, AliRtcVideoTrack track)                   
    • Supports switching windows before and after joining a channel. If viewConfig is NULL or its member rendering view is NULL, rendering is stopped.
    • If you need to reset the rendering mode during playback, keep other member variables in viewConfig unchanged and modify only renderMode.
    • The default rendering mode in viewConfig is AliRtcRenderModeAuto.
    Parameter description
    Parameter Type Description
    viewConfig AliVideoCanvas Rendering parameters, including the rendering window and rendering mode.
    track AliRtcVideoTrack The Preview Video Track type allows only AliVideoTrackCamera (Camera Stream).
  • muteLocalCamera: specifies whether to stop publishing local video streams.

    public abstract int muteLocalCamera(boolean mute, AliRtcVideoTrack track)                   
    Parameter description
    Parameter Type Description
    mute boolean true indicates that the video stream is stopped. false indicates that the video stream is resumed. Resume publishing by default.
    track AliRtcVideoTrack The type of the video track that needs to change the publishing status. The default camera stream.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

    Notice This interface does not change the collection status of the current video stream.
  • setRemoteViewConfig: Set the rendering window and drawing parameters for the remote video.

    public abstract int setRemoteViewConfig(AliVideoCanvas canvas, String uid, AliRtcVideoTrack track)                    
    • Supports switching windows before and after joining a channel. If canvas is NULL or its member rendering view is NULL, the corresponding stream is stopped.
    • If you need to reset the rendering mode during playback, keep other member variables in canvas unchanged and modify only renderMode.
    • The default rendering mode in canvas is AliRtcRenderModeAuto.
    • We recommend that you call this operation after the callback for subscription results.
    Parameter description
    Parameter Type Description
    canvas AliVideoCanvas Rendering parameters, including the rendering window and rendering mode.
    uid String The ID of the user.
    track AliRtcVideoTrack The type of the video track to be set.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • switchCamera: switches the front and rear cameras.

    public abstract int switchCamera()                  

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • getCurrentCameraType: obtains the current camera type.

    Returns the camera type AliRTCCameraType.

    public abstract AliRTCCameraType getCurrentCameraType()                   
  • setPreCameraType: preset camera direction.

    public abstract void setPreCameraType(int faceTo)                    
    Parameter description
    Parameter Type Description
    faceTo int 0 indicates the rear position, and 1 indicates the front position (the default value is 1).
  • getPreCameraType: obtains the preset camera direction.

    public abstract int getPreCameraType()                  

    Return result

    0 indicates the rear camera, and 1 indicates the front camera.

  • setCameraZoom: sets camera parameters.

    public abstract int setCameraZoom(float zoom, boolean flash, boolean autoFocus)                  
    Parameter description
    Parameter Type Description
    zoom float The zoom level (default value: 1.0).
    flash boolean true indicates that the flash is turned on. false indicates that the flash is not turned on. The flash is not turned on by default.
    autoFocus boolean true indicates that autofocus is turned on. false indicates that autofocus is not turned on. Auto focus is not turned on by default.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

  • isCameraOn: Check whether the camera is turned on.

    public abstract boolean isCameraOn()                   

    Return result

    true indicates that the camera is turned on. false indicates that the camera is not turned on.

  • isCameraSupportExposurePoint: Whether the camera supports manual exposure.

    public abstract boolean isCameraSupportExposurePoint();

    Return result

    The value true indicates that the alert group can subscribe to weekly reports. The value false indicates that the alert group cannot subscribe to weekly reports.

  • isCameraSupportFocusPoint: Whether the camera supports manual focus.

    public abstract boolean isCameraSupportFocusPoint();

    Return result

    The value true indicates that the alert group can subscribe to weekly reports. The value false indicates that the alert group cannot subscribe to weekly reports.

  • setCameraExposurePoint: Sets the coordinate point for manual exposure.

    public abstract int setCameraExposurePoint(float x, float y);
    Parameter description
    Parameter Type Description
    x float The x coordinate.
    y float y coordinate.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

  • setCameraFocusPoint: Sets the coordinate point for manual focus.

    public abstract int setCameraFocusPoint(float x, float y);
    Parameter description
    Parameter Type Description
    x float The x coordinate.
    y float y coordinate.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

  • isCameraFlash: Check whether the camera flash is on.

    public abstract boolean isCameraFlash();

    Return result

    true indicates that it is enabled. false indicates that it is not enabled.

  • getCameraZoom: Gets the camera zoom value.

    public abstract float getCameraZoom();

    Return result

    Return value range: 0.0 to 1.0. 0 indicates the minimum value supported by the camera, and 1 indicates the maximum value supported by the camera.

  • registerPreprocessVideoObserver: registration Face Recognition preprocessing.

    public abstract void registerPreprocessVideoObserver(AliDetectObserver observer);
    Parameter description
    Parameter Type Description
    observer AliDetectObserver Face Recognition preprocessing.
  • muteAllRemoteAudioPlaying: Stops playback of all audio streams at the remote end.

    public abstract int muteAllRemoteAudioPlaying(boolean mute);
    Parameter description
    Parameter Type Description
    mute boolean true indicates that playback is stopped. false indicates that playback is resumed. By default, playback is resumed.

    Return result

    0 indicates success. Other error codes are returned.

    Notice Subscription and decoding are not affected and support settings before or after joining a channel.
  • setAudioOnlyMode: Set this parameter to audio-only mode or audio-video mode.

    public abstract int setAudioOnlyMode(boolean audioOnly)                  
    Parameter description
    Parameter Type Description
    audioOnly boolean true indicates that only audio is published and subscribed. false indicates that both audio and video are supported. The default is audio and video mode.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

    Note By default, this interface is set to audio and video mode (non-pure audio), which must be set before you call joinChannel.
  • isAudioOnly: queries whether the current audio-only mode is displayed.

    public abstract boolean isAudioOnly()                 

    Return result

    true indicates pure audio. false indicates audio and video.

  • muteRemoteAudioPlaying: specifies whether to stop playing the remote audio stream.

    public abstract int muteRemoteAudioPlaying(String uid, boolean mute)                   
    Parameter description
    Parameter Type Description
    uid String The ID of the user.
    mute boolean true indicates that playback is stopped. false indicates that playback is resumed. By default, playback is resumed.

    Return result

    0 indicates that the setting is successful. -1 indicates that the setting fails.

  • enableSpeakerphone: Toggle the earpiece and speaker output.

    public abstract int enableSpeakerphone(boolean enable)  
    Parameter description
    Parameter Type Description
    enable boolean true for speaker mode and false for handset mode. Default speaker mode.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Notice This interface can only be called on the main thread.
  • isSpeakerOn: queries whether the speaker is enabled.

    public abstract boolean isSpeakerOn()                  

    Return result

    true indicates that the speaker is turned on. false indicates that the speaker is not turned on.

  • startAudioCapture: enables audio collection.

    You can enable audio collection in advance. If you do not set this parameter, the SDK enables audio collection when stream ingest starts.

    public int startAudioCapture();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • stopAudioCapture: Disables audio collection.

    You can control to disable audio collection.

    public int stopAudioCapture();
  • startAudioPlayer: enables audio playback.

    You can enable audio playback in advance. If you do not set this parameter, the SDK enables audio playback when the subscription succeeds.

    public int startAudioPlayer();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • stopAudioPlayer: Disables audio playback.

    public int stopAudioPlayer();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

    Notice This operation is called before joining.
  • enableEarBack: enables ear return.

    public abstract int enableEarBack(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean true indicates that ear return is enabled. false indicates that ear return is disabled. By default, ear return is disabled.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • startAudioAccompany: Start playing the accompaniment.

    public abstract int startAudioAccompany(String fileName, boolean onlyLocalPlay, boolean replaceMic, int loopCycles);
    Parameter description
    Parameter Type Description
    fileName String The path of the accompaniment file, which supports local files and network URLs.
    onlyLocalPlay boolean Specifies whether to play locally only. true indicates that the stream is played locally only. false indicates that the stream is played locally and pushed to the remote end.
    replaceMic boolean Specifies whether to replace the mic audio stream. true indicates that the accompaniment audio stream replaces the local mic audio stream. false indicates that the accompaniment audio stream and the mic audio stream are pushed at the same time.
    loopCycles int The number of times that the loop is played. -1 indicates that the loop has been played.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • pauseAudioAccompany: Pause the accompaniment.

    public abstract int pauseAudioAccompany();

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • resumeAudioAccompany: resume playing accompaniment.

    public abstract int resumeAudioAccompany();

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • stopAudioAccompany: End playing accompaniment.

    public abstract int stopAudioAccompany();

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setAudioAccompanyPublishVolume: Set the volume of the accompaniment stream.

    public abstract int setAudioAccompanyPublishVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Accompaniment streaming volume. The default value is 50.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setAudioAccompanyPlayoutVolume: Set the local volume of the accompaniment.

    public abstract int setAudioAccompanyPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Accompaniment local play volume. The default value is 50.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • getAudioAccompanyPublishVolume: obtains the volume of the accompaniment stream.

    public abstract int getAudioAccompanyPublishVolume();

    Return result

    Valid values of the returned accompaniment ingest volume: 0 to 100. A return of -1 indicates that the ingest fails.

  • getAudioAccompanyPlayoutVolume: obtains the local volume of the accompaniment.

    public abstract int getAudioAccompanyPlayoutVolume();

    Return result

    Valid values of the returned accompaniment ingest volume: 0 to 100. A return of -1 indicates that the ingest fails.

  • setAudioAccompanyVolume: Set the accompaniment stream and local volume.

    public abstract int setAudioAccompanyVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Accompaniment local play volume. The default value is 50.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • preloadAudioEffect: preloads sound effects.

    public abstract int preloadAudioEffect(int soundId, String filePath);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect (this ID is generated by the caller).
    filePath String The path of the sound effect file.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • unloadAudioEffect: clears preloaded sound effects.

    public abstract int unloadAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int Sound effect ID (this ID should be the same as the ID passed in during preload).

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • playAudioEffect: starts playing the sound effect.

    public abstract int playAudioEffect(int soundId, String filePath, int cycles, boolean publish);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.
    filePath String The path of the audio file. Local files and network URLs are supported.
    cycles int The number of loop playback times. -1 indicates a loop all the time.
    publish boolean Specifies whether to push the audio stream to the far end.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setAudioEffectPublishVolume: Set the audio ingest volume.

    public abstract int setAudioEffectPublishVolume(int soundId, int volume);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.
    volume int The volume of the audio ingest. Valid values: 0 to 100.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • getAudioEffectPublishVolume: obtains the volume of audio ingest.

    Returns 0 to 100 sound effect ingest volume. A return of -1 indicates that the ingest volume failed.

    public abstract int getAudioEffectPublishVolume(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.

    Return result

    Valid values of the returned audio ingest volume: 0 to 100. If -1 is returned, the ingest volume fails to be obtained.

  • setAudioEffectPlayoutVolume: Set the local volume of the sound effect.

    public abstract int setAudioEffectPlayoutVolume(int soundId, int volume);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.
    volume int The local playback volume of the sound effect. Valid values: 0 to 100. The default value is 50.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • getAudioEffectPlayoutVolume: obtains the local volume of the sound effect.

    public abstract int getAudioEffectPlayoutVolume(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.

    Return result

    Valid values for the local playback volume of the returned sound effects: 0 to 100. -1 indicates that the playback failed.

  • pauseAudioEffect: Pause the playback of sound effects.

    public abstract int pauseAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • resumeAudioEffect: The playback effect is resumed.

    public abstract int resumeAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • stopAudioEffect: stops playing the sound effect.

    public abstract int stopAudioEffect(int soundId);
    Parameter description
    Parameter Type Description
    soundId int The ID of the sound effect.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setEarBackVolume: Set the ear return volume.

    public abstract int setEarBackVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Ear return volume. Valid values: 0 to 100. The volume can be set only when ear return is enabled. Otherwise, this method returns an error. The default value is 100.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setRecordingVolume: Set the recording volume.

    public abstract int setRecordingVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Volume. Valid values: 0 to 400.0 indicates mute. Default value: 100.
    • When the setting is greater than 100: enlarge the volume.
    • When the setting is less than 100: Reduce the volume.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

    Notice Recording volume adjustment: This operation can be called when the physical key of the peer user is increased to the maximum and still feels that the sound is played when the sound is small. The recommended value is 100 to 200. If the value exceeds the 200, the sound quality may be affected.
  • setPlayoutVolume: Set the playback volume.

    public abstract int setPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int Volume. Valid values: 0 to 400.0 indicates mute. Default value: 100.
    • When the setting is greater than 100: enlarge the volume.
    • When the setting is less than 100: Reduce the volume.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

    Notice Playback volume adjustment: This operation can be called when the local physical key is turned up to the maximum and the sound is still played when the sound is small. The recommended value is 100 to 200. If the value exceeds the 200, the sound quality may be affected.
  • muteAllRemoteVideoRendering: the rendering of all video tracks at the remote end of mute or unmute.

    public abstract int muteAllRemoteVideoRendering(boolean mute);
    Parameter description
    Parameter Type Description
    mute boolean true indicates that rendering is stopped. false indicates that rendering is resumed. Resume rendering by default.

    Return result

    0 indicates success. Other error codes are returned.

    Notice Subscription and decoding are not affected and support settings before or after joining a channel.
  • setBeautyEffect: Set Basic Beauty.

    public abstract int setBeautyEffect(boolean enable, AliRtcEngine.AliRtcBeautyConfig config);
    Parameter description
    Parameter Type Description
    enable boolean true indicates enabled. false indicates disabled. Default value: disabled.
    config AliRtcBeautyConfig The basic beauty parameters.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

    Notice Currently, only whitening and skin grinding are supported.
  • registerVideoSampleObserver: Register the video data callback.

    public abstract void registerVideoSampleObserver(AliRtcEngine.AliVideoObserver aliVideoObserver);
    Parameter description
    Parameter Type Description
    aliVideoObserver AliVideoObserver Video data callback interface.
  • unRegisterVideoSampleObserver: unregisters the video data callback.
    public abstract void unRegisterVideoSampleObserver();
  • setVideoEncoderConfiguration: Set video encoding properties.
    public abstract void setVideoEncoderConfiguration(AliRtcEngine.AliRtcVideoEncoderConfiguration config);
    Parameter description
    Parameter Type Description
    config AliRtcVideoEncoderConfiguration Predefined video encoding properties.
  • isCameraAutoFocus: specifies whether to enable autofocus.
    public abstract boolean isCameraAutoFocus();

    Return result

    true indicates that autofocus is enabled. false indicates that autofocus is not enabled.

  • registerVideoRawDataInterface: Register an external video data callback interface.
    public abstract VideoRawDataInterface registerVideoRawDataInterface(AliRawDataStreamType streamType, AliRtcRenderMode renderMode);
    Parameter description
    Parameter Type Description
    streamType AliRawDataStreamType The type of the video stream.
    renderMode AliRtcRenderMode The rendering mode.

    Return result

    Returns a VideoRawDataInterface stream processing object.

  • unRegisterVideoRawDataInterface: the callback to unregister the external video interface.
    public abstract void unRegisterVideoRawDataInterface(AliRawDataStreamType streamType);
    Parameter description
    Parameter Type Description
    streamType AliRawDataStreamType The type of the video stream.
  • createRenderSurfaceView: creates a SurfaceView rendering view.
    public abstract SophonSurfaceView createRenderSurfaceView(Context context);

    Parameter description

    Parameter Type Description
    context Context The context of Android (Android Activity).
  • createRenderTextureView: Creates a TextureView rendering view.
    public abstract SophonTextureView createRenderTextureView(Context context);

    Parameter description

    Parameter Type Description
    context Context The context of Android (Android Activity).
  • enableLocalVideo: Disable or re-enable local video collection.
    public abstract int enableLocalVideo(boolean enabled);

    Parameter description

    Parameter Type Description
    enabled boolean Disable or re-enable local video collection. Valid values:
    • YES: enabled.
    • NO: disabled.

    Return result

    0 indicates that the method call was successful. Others indicate that the call failed.

  • registerAudioVolumeObserver: registers the volume callback.

    public abstract void registerAudioVolumeObserver(AliRtcEngine.AliRtcAudioVolumeObserver observer);
    Parameter description
    Parameter Type Description
    observer AliRtcAudioVolumeObserver The volume port.
  • unRegisterAudioVolumeObserver: unregisters the volume callback.
    public abstract void unRegisterAudioVolumeObserver();
  • startRecord: starts recording files.

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

    Recorded audio includes external input PCM data, locally collected audio, and remote pull-stream audio data.

    Parameter description
    Parameter Type Description
    recordType AliRtcRecordType The recording file type.
    recordFormat AliRtcRecordFormat The format of the recording file.
    path String The storage path of the recording file.
    audioConfig AliRtcRecordAudioConfig Recording audio attribute configuration.

    Return result

    true indicates that the method call was successful. false indicates that the method call failed.

  • stopRecord: stops recording.

    public abstract void stopRecord();

    Used with startRecord, the method automatically stops recording after the leaveChannel is called.

  • setAudioEffectReverbMode: sets the reverb mode.

    public abstract int setAudioEffectReverbMode(AliRtcEngine.AliRTCSDK_AudioEffect_Reverb_Mode mode);
    Parameter description
    Parameter Type Description
    mode AliRTCSDK_AudioEffect_Reverb_Mode The type of the reverb mode. By default, this switch is turned off.

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

  • setAudioEffectReverbParamType: Set the reverb effect type.

     public abstract int setAudioEffectReverbParamType(AliRtcEngine.AliRTCSDK_AudioEffect_Reverb_Param_Type type, float value);
    Parameter description
    Parameter Type Description
    type AliRTCSDK_AudioEffect_Reverb_Param_Type The type of reverb sound effect.
    value float The value of the corresponding reverb sound effect type.

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

  • setVolumeCallbackIntervalMs: Set the volume callback frequency and smoothing factor.

    public abstract int setVolumeCallbackIntervalMs(int interval, int smooth, int reportVad);
    Parameter description
    Parameter Type Description
    interval int The time interval. Unit: ms. The minimum value must not be less than 10ms. The default value is 160ms.
    smooth int The smoothing coefficient. The larger the value, the higher the degree of smoothness, and vice versa, the lower the value, the better the real-time performance. Valid values: 0 to 9. Default value: 3.
    reportVad int The local voice detection switch. Default value: 1. Valid values:
    • 1: enables callback through the onAudioVolumeCallback interface.
    • 0: disables the trace flag.

    Return result

    0 indicates success,-1 indicates that the interval setting is less than 10, and -2 indicates that the smoothing coefficient is out of range.

  • setExternalAudioSource: specifies whether to use external audio data as the input source for streaming.

    public abstract int setExternalAudioSource(boolean enable, int sampleRate, int channelsPerFrame);
    Parameter description
    Parameter Type Description
    enable boolean true indicates that external audio data is enabled as the input source for streaming. false indicates that it is stopped.
    sampleRate int External audio data sample rate.
    channelsPerFrame int Number of external audio data channels (currently supports mono and dual channels).

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • pushExternalAudioFrameRawData: Input audio data.

    public abstract int pushExternalAudioFrameRawData(byte[] data, int samples, long timestamp);
    Parameter description
    Parameter Type Description
    data byte[] Audio data. We recommend that you do not use more than 40ms of data.
    samples int The sampling rate.
    timestamp long The timestamp. Currently, 0 is required.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • setExternalAudioVolume: Set the external audio input volume.

    public abstract int setExternalAudioVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The volume. Valid values: 0 to 100. The default value is 50.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • getExternalAudioVolume: obtains the external audio input volume.

    public abstract int getExternalAudioVolume();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • setMixedWithMic: Specify whether the external audio input is mixed with the microphone to collect audio.

    public abstract int setMixedWithMic(boolean mixed);
    Parameter description
    Parameter Type Description
    mixed boolean true indicates that the audio is mixed, and false indicates that the microphone is completely replaced to collect data. The default value is Remix.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • setExteranlAudioRender: specifies whether to enable external input audio playback.

    public abstract int setExteranlAudioRender(boolean enable, int sampleRate, int channelsPerFrame);
    Parameter description
    Parameter Type Description
    enable boolean true indicates that external audio is enabled as the input source for local playback. false indicates that it is stopped.
    sampleRate int External audio data sample rate.
    channelsPerFrame int Number of external audio data channels (currently supports mono and dual channels).

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • pushExternalAudioRenderRawData: Enter audio playback data.

    public abstract int pushExternalAudioRenderRawData(byte[] audioSamples, int sampleLength, int sampleRate, int channelsPerFrame, long timestamp);
    Parameter description
    Parameter Type Description
    audioSamples byte[] The audio data.
    sampleLength int The length of the audio data.
    sampleRate int The audio sample rate.
    channelsPerFrame int The number of audio channels.
    timestamp long The timestamp. Currently, 0 is required.

    Return result

    0 indicates that the operation is successful. A non -0 indicates that the operation fails.

  • getCurrentClientRole: obtains the current role.

    public abstract AliRtcEngine.AliRTCSDK_Client_Role getCurrentClientRole();

    Return result

    Returns the current user role.

  • setSubscribeAudioNumChannel: Set the number of callback audio channels.

    public abstract void setSubscribeAudioNumChannel(AliRtcAudioNumChannel numChannel);
    Parameter description
    Parameter Type Description
    numChannel AliRtcAudioNumChannel The audio number channel. The default mono audio.
  • setSubscribeAudioSampleRate: sets the callback audio sample rate.

    public abstract void setSubscribeAudioSampleRate(AliRtcAudioSampleRate sampleRate);
    Parameter description
    Parameter Type Description
    sampleRate AliRtcAudioSampleRate The audio sample rate. The default value is 16K.
  • requestAudioFocus: Request audio focus.
    public abstract int requestAudioFocus()

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • abandonAudioFocus: Lost audio focus.
    public abstract int abandonAudioFocus()

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • registerAudioObserver: registers audio data callbacks.
    public abstract void registerAudioObserver(AliRtcEngine.AliAudioType audioType, AliRtcEngine.AliAudioObserver audioObserver);
    Parameter description
    Parameter Type Description
    audioType AliAudioType The type of the callback audio data.
    audioObserver AliAudioObserver Audio data callback interface.
  • muteLocalMic: local audio collection.

    public abstract int muteLocalMic(boolean mute, AliRtcEngine.AliRtcMuteLocalAudioMode var2);
    Parameter description
    Parameter Type Description
    mute boolean YES indicates that the local audio collects empty frames. NO indicates that the local audio does not collect empty frames.
    mode AliRtcMuteLocalAudioMode The local mute mode.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • getAudioAccompanyDuration: the duration of obtaining the accompaniment file. Unit: milliseconds.

    public int getAudioAccompanyDuration();
  • getAudioAccompanyCurrentPosition: obtains the music file playback progress. Unit: milliseconds.

    public int getAudioAccompanyCurrentPosition();
  • setAudioAccompanyPosition: specifies the playback position of the audio file.

    public int setAudioAccompanyPosition(int posMs);
    Parameter description
    Parameter Type Description
    posMs AliRtcMuteLocalAudioMode The local mute mode.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • stopAllAudioEffects: stops playing all sound effects.

    public abstract int stopAllAudioEffects();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • setAllAudioEffectsPublishVolume: Set the streaming volume of all sound effects.

    public abstract int setAllAudioEffectsPublishVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The mixing volume. Valid values: 0 to 100. The default value is 50.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • setAllAudioEffectsPlayoutVolume: Set the local playback volume for all sound effects.

    public abstract int setAllAudioEffectsPlayoutVolume(int volume);
    Parameter description
    Parameter Type Description
    volume int The mixing volume. Valid values: 0 to 100. The default value is 50.

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • pauseAllAudioEffects: Pause all sound effects.

    public abstract int pauseAllAudioEffects();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • resumeAllAudioEffects: Restart all sound effects.

    public abstract int resumeAllAudioEffects();

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • unRegisterAudioObserver: unregisters the audio data callback.

    public abstract void unRegisterAudioObserver(AliAudioType type);
    Parameter description
    Parameter Type Description
    type AliAudioType The type of the callback audio data.
  • startPreview: starts a local preview.

    public abstract int startPreview()

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

    Notice You can start a local preview before you join the channel. You need to call the setLocalViewConfig before you start the preview.
  • stopPreview: stops local preview.

    public abstract int stopPreview()                   

    Return result

    0 indicates that the method call is successful. Others indicate that the method call failed.

  • enableHighDefinitionPreview: Enable HD preview.

    0 is returned, and -1 is returned, indicating that the operation failed.

    public abstract int enableHighDefinitionPreview(boolean enable);
    Parameter description
    Parameter Type Description
    enable boolean The value true indicates that the alert group subscribes to weekly reports. The value false indicates that the alert group does not subscribe to weekly reports. By default, HD preview is enabled.

    Return result

    0 indicates that the operation is successful. -1 indicates that the operation failed.

  • getOnlineRemoteUsers: Obtains the list of remote online users.

    public abstract String[] getOnlineRemoteUsers()                

    Return result

    Returns a list of user IDs.

    Notice This method has a delay when calling a channel. We recommend that you call this interface after calling the onRemoteUserOnLineNotify or maintain a remote user list yourself.
  • getUserInfo: queries remote user information.

    public abstract AliRtcRemoteUserInfo getUserInfo(String uid)                  
    Parameter description
    Parameter Type Description
    uid String The ID of the user.

    Return result

    Returns the remote user information 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.

    Return result

    true indicates online. false indicates not online.

  • getMediaInfoWithUserId: obtains media stream information.

    public String getMediaInfoWithUserId(String userId, AliRtcVideoTrack track, String[] keys);
    Parameter description
    Parameter Type Description
    userId String The ID of the user who obtained the media stream information.
    track AliRtcVideoTrack The type of the media stream to query.
    keys String[] Query an array of key values.
  • setLogLevel: specifies the log level.

    public abstract void setLogLevel(AliRtcLogLevel logLevel)         
    Parameter description
    Parameter Type Description
    logLevel AliRtcLogLevel The level of the log entry. The default value is AliRtcLogLevelInfo.
  • getSdkVersion: obtains the SDK version number.

    public abstract String getSdkVersion()                   
  • setClientRole: specifies a user role.

    public abstract int setClientRole(AliRTCSDK_Client_Role role);
    Parameter description
    Parameter Type Description
    role AliRTCSDK_Client_Role The type of the user role. The default value is the watch role.

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

    Notice You can call only when the channel mode is InteractiveLive. You can set this parameter before or during a meeting. If the setting is successful, you will receive a onUpdateRoleNotify. To convert from Interactive to Live, you need to stop streaming first. Otherwise, a failure is returned.
  • setLogDirPath: specifies the path where the SDK log files are saved.

    public static int setLogDirPath(String logDirPath)
    Parameter description
    Parameter Type Description
    logDirPath String The absolute path where the log file is saved.

    Return result

    0 indicates success. Other error codes are returned.

    Notice To call this operation, you must configure the settings before calling all SDK operations to avoid log loss. At the same time, the App must ensure that the specified directory already exists and can be written to.
  • setDeviceOrientationMode: Set the horizontal and vertical screen direction of the device.

    public abstract void setDeviceOrientationMode(AliRtcEngine.AliRtcOrientationMode mode);
    Parameter description
    Parameter Type Description
    mode AliRtcOrientationMode The device orientation. Valid values:
    • AliRtcOrientationModePortrait (default): Fixed vertical screen mode.
    • AliRtcOrientationModeLandscapeLeft: Fixed Left Horizontal Screen Mode.
    • AliRtcOrientationModeLandscapeRight: Fixed right horizontal screen mode.
    • AliRtcOrientationModeAuto: adaptive mode.

    Return result

    0 indicates success. Other error codes are returned.

    Notice Currently, only the fixed horizontal and vertical screen mode is supported. Only settings are allowed before publishing and preview.
  • startNetworkQualityProbeTest: starts network quality detection.

    public abstract int startNetworkQualityProbeTest();

    Return result

    0 indicates success. Other error codes are returned.

    Notice You need to call before joining the channel, and it will automatically stop after joining the channel. The detection result is called back in the onNetworkQualityProbeTest.
  • stopNetworkQualityProbeTest: stops network quality detection.

    public abstract int stopNetworkQualityProbeTest();

    Return result

    0 indicates success. Other error codes are returned.

  • postFeedback: feedback on SDK issues.
    public abstract void postFeedback(String uid, String channelId, String description, AliRtcFeedbackType type, long timeStamp);
    Parameter description
    Parameter Type Description
    uid String The current uid.
    channelId String The ID of the current channel.
    description String Problem description (both Chinese and English are supported).
    type AliRtcFeedbackType Question types (see AliRtcFeedbackType notes).
    timeStamp long The time when the problem occurred (Unix timestamp, approximate time, without special precision, can be 0).
  • sendMediaExtensionMsg: sends media extension information.
    public abstract int sendMediaExtensionMsg(byte[]message, int repeatCount);
    Parameter description
    Parameter Type Description
    message String The custom message data. Currently, the length is limited to 8 bytes.
    repeatCount int The number of times a message was sent.

    Return result

    • 0: The message is sent.
    • -1: You cannot send custom messages because they are not in the ingest state.
    • -2: The parameter is set incorrectly. The length of the custom message exceeds 8 bytes, or repeatCount<=0.
    • -3: The sending frequency is too frequent. We recommend that you reduce the sending frequency.
    Notice To use audio and video tunnel to send custom messages to other users in the room, two prerequisites need to be met:
    • You join the club normally and are in the stream.
    • Other users in the room need to subscribe to their own audio and video streams. After successful transmission, they can receive the results in the onMediaExtensionMsgReceived callback.
  • respondMessageNotification: sends a message notification.
    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 message content type.
    content String The content of the message.

    Return result

    0 indicates that the call was successful. Others indicate that the call failed.

  • refreshAuthInfo: Refresh the token.
    public abstract int refreshAuthInfo(AliRtcAuthInfo auth_info);
    Parameter description
    Parameter Type Description
    auth_info AliRtcAuthInfo User authentication information.

    Return result

    0 indicates that the token is successfully refreshed. Others indicate that the token fails to be refreshed.