This topic describes the methods of the AliRtcEngine class provided by ApsaraVideo Real-time Communication (ARTC) SDK for HarmonyOS.
Contents
Basic methods
API | Description |
Obtains an AliRtcEngine instance. | |
Destroys an AliRTCEngine instance. | |
Queries the version number of SDK. | |
Sets the path for storing the log files of the SDK. | |
Specifies whether to enable the HTML5 compatibility mode. | |
Queries whether the HTML5 compatibility mode is enabled. | |
Sets a listener for event callbacks of the local user. |
Channel-related methods
API | Description |
Enables the audio-only mode or the audio-video mode. | |
Joins a channel. | |
Joins a channel (with a token). | |
Leaves a channel. | |
Sets the channel mode. | |
Specifies the user role in live streaming. | |
Queries the user role. | |
Refreshes the authentication information. | |
Refreshes the authentication information (with a token). | |
Sets the audio profile. | |
Checks whether you are in a channel. | |
Joins a channel with channel parameters. | |
Joins a Real-time Conversational AI channel. |
Publishing and subscription-related methods
API | Description |
Specifies whether to ingest a local camera track. | |
Configures the video encoding settings for a camera track. | |
Specifies whether to ingest a local audio track. | |
Specifies whether to ingest the audio track of a minor stream. | |
Specifies whether to ingest the video track of a minor stream. | |
Specifies the type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream. | |
Specifies the default type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream. | |
Subscribes to or stops subscribing to the audio tracks of all remote users. | |
Subscribes to or stops subscribing to the audio track of a minor stream. | |
Subscribes to or stops subscribing to the video tracks of all remote users. | |
Manually pulls an audio track. | |
Manually pulls a video track. | |
Subscribes to a remote media stream. | |
Subscribes to the media stream of a specific user in a channel. | |
Controls whether to accept the audio stream by default | |
Specifies whether to subscribe to the audio tracks of remote users by default. | |
Specifies whether to subscribe to the video tracks of remote users by default. | |
Specifies whether to use the speaker as the default audio output device. |
Methods related to audio device management
API | Description |
Specifies whether to mute the local audio. | |
Sets the local playback volume for the audio track of a specific remote user. | |
Specifies whether to stop the playback of the audio track of a specific remote user. | |
Specifies whether to stop the playback of the audio tracks of all remote users. | |
Sets the headset or speaker as the audio output device. | |
Queries whether the current audio output device is the headset or the speaker. | |
Sets the recording volume. | |
Sets the playback volume. | |
Starts audio collection. | |
Starts audio collection and keeps the collection device active. | |
Stops audio collection. |
Methods related to voice change and reverberation
API | Description |
Sets the audio pitch. | |
Sets the voice change mode. | |
Sets the reverberation mode. | |
Sets the voice beautification mode. | |
Sets the parameters of the reverberation mode. | |
Sets the equalization frequency for reverberation. |
Methods related to sound effects
API | Description |
Starts accompaniment mixing. | |
Stops accompaniment mixing. | |
Sets the accompaniment volume. | |
Sets the volume of the accompaniment for stream ingest. | |
Queries the volume of the accompaniment for stream ingest. | |
Sets the volume of the accompaniment for local playback. | |
Queries the volume of the accompaniment for local playback. | |
Pauses accompaniment mixing. | |
Resumes accompaniment mixing. | |
Queries the duration of the accompaniment file. | |
Queries the playback progress of the accompaniment file. | |
Sets the playback position of the accompaniment file. | |
Preloads a sound effect. | |
Deletes a preloaded sound effect. | |
Starts the playback of a sound effect. | |
Stops the playback of a sound effect. | |
Stops the playback of all sound effects. | |
Sets the volume of a sound effect for stream ingest. | |
Queries the volume of a sound effect for stream ingest. | |
Sets the volume of a sound effect for local playback. | |
Queries the volume of a sound effect for local playback. | |
Sets the volume of all sound effects for stream ingest. | |
Sets the volume of all sound effects for local playback. | |
Pauses the playback of a sound effect. | |
Pauses the playback of all sound effects. | |
Resumes the playback of a sound effect. | |
Resumes the playback of all sound effects. |
Methods related to video device management
API | Description |
Sets the view for local preview. | |
Starts a local preview. | |
Stops a local preview. | |
Sets the collection preferences of the camera. | |
Disables or enables local video collection. | |
Specifies whether to stop publishing local video data. | |
Sets the view for the video track of a remote user. | |
Switches between the front and rear cameras. | |
Queries the current camera type. | |
Sets the zoom factor of the camera. | |
Queries the maximum zoom factor supported by the camera. | |
Queries the zoom factor of the camera. | |
Sets the exposure level of the camera. | |
Queries the exposure level of the camera. | |
Queries the minimum exposure level supported by the camera. | |
Queries the maximum exposure level supported by the camera. | |
Specifies whether to enable the camera flash. | |
Queries whether the camera supports manual focus. | |
Queries whether an exposure point can be set for the camera. | |
Sets the manual focus point of the camera. | |
Sets an exposure point for the camera. | |
Queries whether the camera is turned on. |
Methods related to relayed live streaming
API | Description |
Updates the parameters for relayed live streaming. | |
Stops relayed live streaming. |
Callbacks
API | Description |
The callback that is invoked when a user joins a channel. | |
The callback that is invoked when a user leaves a channel. | |
The callback that is invoked when the status of stream ingest for an audio track changes. | |
The callback that is invoked when the status of stream ingest for a video track changes. | |
The callback that is invoked when the status of stream ingest for a minor stream changes. | |
The callback that is invoked when a remote user joins a channel in the communication mode or a streamer joins a channel in the interactive mode. | |
The callback that is invoked when a remote user leaves a channel in the communication mode or a streamer leaves a channel in the interactive mode. | |
The callback that is invoked when the audio and video tracks of a remote user change. | |
The callback that is invoked when the status of subscription to an audio track changes. | |
The callback that is invoked when the status of subscription to a video track changes. | |
The callback that is invoked when the type of the stream that is subscribed to changes. | |
The callback that is invoked when the user role is changed. | |
The callback that is invoked when the network quality changes. | |
The callback that is invoked when the network connection status changes. | |
Server removal or meeting end message | |
Fault Notifications | |
The callback that is invoked when the first frame from the video track of a remote user is received. | |
The callback that is invoked when the first audio packet is received. | |
The callback that is invoked when the first video packet is received. | |
The callback that is invoked when the first frame from the audio track of a remote user is decoded. | |
The callback that is invoked when the first frame from the video track of a remote user is displayed. | |
The callback that is invoked when the first frame from the local video track for preview is displayed. | |
The callback for the volume of the subscribed audio. | |
Subscribed to the current speaker | |
The callback that is invoked when a remote user is muted or unmuted. | |
The callback that is invoked when a remote user sends black frames. | |
The callback that is invoked when a remote user disables data collection for the camera track. | |
The callback that is invoked when the Open Graphics Library (OpenGL) context is created. | |
The callback that is invoked when the OpenGL texture is updated. | |
The callback that is invoked when the OpenGL context is destroyed. | |
The callback that is invoked when the local playback status of the accompaniment changes. | |
The callback that is invoked when the playback of the accompaniment starts for a remote user. | |
The callback that is invoked when the playback of the accompaniment ends for a remote user. | |
The callback that is invoked when the local playback of a sound effect ends. | |
The callback that is invoked when the user authentication information specified by AliEngineAuthInfo is about to expire. | |
The callback for expired authentication. The expiration information is returned by the server when users call a method that requires authentication. | |
The callback that is invoked to return the statistics on the current session. | |
Local video statistics information | |
Remote Video Statistics | |
Local audio statistics | |
The callback that is invoked to return the statistics on the remote audio. | |
The callback that is invoked when a supplemental enhancement information (SEI) message is received. | |
The callback that is invoked when the status of relayed live streaming changes. | |
The callback that is invoked when the status of a relayed live streaming task changes. | |
The callback that is invoked when a local device exception occurs. | |
The callback for a Data Channel message. | |
The callback for raw audio data that is collected. | |
The callback for audio data that is processed by the 3A algorithms. | |
The callback for ingested audio data. | |
The callback for played audio data. | |
The callback for audio data that is mixed from ingested audio and played audio. | |
The callback for audio data that is pulled from a remote user. | |
onAIAgentResult | The callback for AI agent processing results. |
onRemoteUserSubscribedDataChannel | The callback that is invoked when you can start sending Data Channel messages. |
Other methods
API | Description |
Sets custom parameters. | |
Queries custom parameters. | |
Sets additional parameters. | |
Sets the log level. | |
Specifies whether to upload log files. | |
Enables the audio frame observer. | |
Sets the volume callback interval and smoothing factor. | |
Registers an object that is used to monitor the OpenGL texture data of a local camera track. | |
Unregisters an object that is used to monitor the OpenGL texture data of a local camera track. | |
Enables snapshot capture for a video track. | |
Sends an SEI message. | |
Queries the video codec type. | |
Retrieving the current encoder type | |
Retrieve the time from the timeline. | |
Sends a Data Channel message. |
Details
setRtcEngineEventListener
Description: Sets a listener for event callbacks of the local user.
Obtain an interface instance:
public setRtcEngineEventListener(listener: AliRtcEngineEventListener | null) : void {}Parameters:
Parameter
Type
Description
listener
AliRtcEngineEventListener
Used to receive messages from the engine.
getInstance
Description: Obtains an AliRtcEngine instance.
Obtaining an interface instance:
public static getInstance(extras: string, context : common.Context): AliRtcEngine {}Parameters:
Parameter
Type
Description
extras
string
Specifies the additional parameters delivered in canary releases. A JSON string is used to configure a special SDK feature. This parameter can be left empty.
context
common.Context
The Android context.
destroyInstance
Description: Destroys an AliRtcEngine instance.
Obtaining the interface instance
public static destroyInstance(): void {}
getSDKVersion
Description: Queries the version number of SDK.
Obtaining the interface instance
public static getSDKVersion(): string {}
setLogDirPath
Description: Sets the path for storing the log files of the SDK.
Obtain the interface instance:
public static setLogDirPath(logDirPath: string): number {}Parameters:
Parameter
Type
Description
logDirPath
string
The absolute path for storing the log files of the SDK.
setLogLevel
Description: Sets the log level.
Obtain the interface instance:
public static setLogLevel(logLevel: AliRtcLogLevel): void {}Parameters:
Parameter
Type
Description
logLevel
AliRtcLogLevel
The log level. For more information, see the AliRtcLogLevel enumeration.
enableUploadLog
Description: Specifies whether to upload log files. By default, log files are uploaded.
Obtaining the interface instance:
public static enableUploadLog(enable: boolean): void {}Parameters:
Parameter
Type
Description
enable
boolean
A value of true specifies that log files are uploaded. A value of false specifies that log files are not uploaded.
setH5CompatibleMode
Description: Specifies whether to enable the HTML5 compatibility mode.
Obtain the interface instance:
public static setH5CompatibleMode(enable: boolean): void {}Parameters:
Parameter
Type
Description
enable
boolean
A value of true specifies that the HTML5 compatibility mode is enabled. A value of false specifies that the HTML5 compatibility mode is disabled.
getH5CompatibleMode
Description: Queries whether the HTML5 compatibility mode is enabled.
Obtaining the interface instance:
public static getH5CompatibleMode(): boolean {}
setAudioOnlyMode
Description: Enables the audio-only mode or the audio-video mode.
Obtaining the interface instance
public setAudioOnlyMode(audioOnly: boolean): number {}Parameters:
Parameter
Type
Description
audioOnly
boolean
A value of true enables the audio-only mode, in which only audio tracks are pulled and ingested. A value of false enables the audio-video mode, in which both audio and video tracks are ingested and pulled.
joinChannel
Description: Joins a channel.
Obtaining an interface instance:
public joinChannel(authInfo: AliRtcEngineAuthInfo, userName: string) : number {}Parameters:
Parameter
Type
Description
authInfo
AliRtcEngineAuthInfo
The authentication information obtained from the AppServer.
userName
string
The display name of the user. It is not the user ID.
joinChannelWithToken
Description: Joins a channel.
Obtain the interface instance:
public joinChannelWithToken(token: string, channelId: string, userId: string, userName: string): number {}Parameters:
Parameter
Type
Description
token
string
The authentication information obtained from the AppServer.
channelId
string
The ID of the channel to join. The value must be the same as the channel ID that is used to generate the token.
userId
string
The ID of the user who wants to join the channel. The value must be the same as the user ID that is used to generate the token.
userName
string
The display name of the user. It is not the user ID.
setParameter
Description: Sets custom parameters in the format of a JSON string.
Obtaining the interface instance:
public setParameter(param: string): number {}Parameters:
Parameter
Type
Description
param
string
The custom parameter.
getParameter
Description: Queries custom parameters that are in the format of a JSON string.
Obtaining the interface instance:
public getParameter(paramKey: string): string {}Parameters:
Parameter
Type
Description
paramKey
string
The custom parameter.
setExtras
Description: Sets additional parameters in the format of a JSON string.
Obtaining the interface instance:
public setExtras(extras: string): number {}Parameters:
Parameter
Type
Description
extras
string
The additional parameter.
leaveChannel
Description: Leaves a channel. This hangs up or stops the call.
Obtaining an interface instance:
public leaveChannel(): number {}
setChannelProfile
Description: Sets the channel mode.
Obtaining the interface instance
public setChannelProfile(channelProfile: AliRtcChannelProfile): number {}Parameters:
Parameter
Type
Description
channelProfile
AliRtcChannelProfile
The channel mode. For more information, see AliRtcChannelProfile.
setClientRole
Description: Specifies the user role using AliRtcClientRole.
Obtaining the interface instance:
public setClientRole(clientRole: AliRtcClientRole): number {}Parameters:
Parameter
Type
Description
clientRole
AliRtcClientRole
The user role. For more information, see AliRtcClientRole.
getCurrentClientRole
Description: Queries the user role.
Obtaining an interface instance:
public getCurrentClientRole(): AliRtcClientRole {}
refreshAuthInfo
Description: Refreshes the authentication information.
Obtain the interface instance:
public refreshAuthInfo(authInfo: AliRtcEngineAuthInfo): number {}Parameters:
Parameter
Type
Description
authInfo
AliRtcEngineAuthInfo
The authentication information.
refreshAuthInfoWithToken
Description: Refreshes the authentication information.
Obtain an interface instance:
public refreshAuthInfoWithToken(token: string): number {}Parameters:
Parameter
Type
Description
token
string
The authentication information, including the token. The channel ID and user ID must be the same as those used to generate the token.
setLocalViewConfig
Description: Sets the view for local preview.
Obtain the interface instance:
public setLocalViewConfig(canvas: AliRtcVideoCanvas, xComponentController: AliRtcXComponentController | null, track: AliRtcVideoTrack): number {}Parameters:
Parameter
Type
Description
canvas
AliRtcVideoCanvas
The display properties for the local video.
xComponentController
AliRtcXComponentController
The controller bound to the XComponent view.
track
AliRtcVideoTrack
AliRtcVideoTrack
startPreview
Description: Starts a local preview.
Obtain the interface instance:
public startPreview(): number {}
stopPreview
Description: Stops a local preview.
Obtaining the interface instance:
public stopPreview(): number {}
setCameraCaptureConfiguration
Description: Sets the collection preferences of the camera.
Obtain an interface instance:
public setCameraCaptureConfiguration(cameraCaptureConfiguration: AliRtcCameraCaptureConfiguration): number {}Parameters:
Parameter
Type
Description
cameraCaptureConfiguration
AliRtcCameraCaptureConfiguration
The collection preferences.
enableLocalVideo
Description: Disables or enables local video collection.
Obtaining the interface instance:
public enableLocalVideo(enabled: boolean): number {}Parameters:
Parameter
Type
Description
enabled
boolean
A value of true enables local video collection. A value of false disables local video collection.
muteLocalCamera
Description: Specifies whether to stop publishing local video data.
Obtaining the interface instance:
public muteLocalCamera(mute: boolean, track: AliRtcVideoTrack): number {}Parameters:
Parameter
Type
Description
mute
boolean
A value of true specifies that the publishing of the video data is stopped by sending black frames. A value of false specifies that the video data is published.
track
AliRtcVideoTrack
The source of the video data. Only AliEngineVideoTrackCamera is supported.
publishLocalVideoStream
Description: Specifies whether to ingest a local camera track.
Obtain the interface instance:
public publishLocalVideoStream(enabled: boolean): number {}Parameters:
Parameter
Type
Description
enabled
boolean
A value of true enables the ingest of a video track. A value of false disables the ingest of a video track.
setVideoEncoderConfiguration
Description: Configures the video encoding settings for a camera track.
Obtaining an interface instance:
public setVideoEncoderConfiguration(config: AliRtcVideoEncoderConfiguration): void {}Parameters:
Parameter
Type
Description
config
AliRtcVideoEncoderConfiguration
The predefined encoding properties.
muteLocalMic
Description: Specifies whether to mute the local audio.
Obtain the interface instance:
public muteLocalMic(mute: boolean, mode: AliRtcMuteLocalAudioMode): number {}Parameters:
Parameter
Type
Description
mute
boolean
A value of true mutes the local audio by sending mute frames. A value of false unmutes the local audio.
mode
AliRtcMuteLocalAudioMode
The mute mode.
publishLocalAudioStream
Description: Specifies whether to ingest a local audio track.
Obtaining the interface instance:
public publishLocalAudioStream(enabled: boolean): number {}Parameters:
Parameter
Type
Description
enabled
boolean
A value of true enables the ingest of an audio track. A value of false disables the ingest of an audio track.
publishLocalDualAudioStream
Description: Specifies whether to ingest the audio track of a minor stream.
Obtaining the interface instance:
public publishLocalDualAudioStream(enabled: boolean): number {}Parameters:
Parameter
Type
Description
enabled
boolean
A value of true enables the ingest of the audio track of a minor stream. A value of false disables the ingest of an audio track of a minor stream.
setRemoteViewConfig
Description: Sets the view for the video track of a remote user.
Obtain the interface instance:
public setRemoteViewConfig(canvas: AliRtcVideoCanvas, xComponentController: AliRtcXComponentController | null, uid: string, track: AliRtcVideoTrack): number {}Parameters:
Parameter
Type
Description
canvas
AliRtcVideoCanvas
The display properties for the local video.
xComponentController
AliRtcXComponentController
The controller bound to the XComponent view.
uid
string
The unique user ID that is assigned by the AppServer.
track
AliRtcVideoTrack
The source of the video track. AliEngineVideoTrackCamera and AliEngineVideoTrackScreen are supported.
setRemoteAudioVolume
Description: Sets the local playback volume for the audio track of a specific remote user.
Obtaining an interface instance:
public setRemoteAudioVolume(uid: string, volume: number): number {}Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
volume
number
The playback volume. Valid values: [0,100]. A value of 0 indicates mute. A value of 100 indicates the original volume.
muteRemoteAudioPlaying
Description: Specifies whether to stop the playback of the audio track of a specific remote user.
Obtaining the interface instance
public muteRemoteAudioPlaying(uid: string, mute: boolean): number {}Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
mute
boolean
A value of true stops the playback. A value of false resumes the playback.
muteAllRemoteAudioPlaying
Description: Specifies whether to stop the playback of the audio tracks of all remote users.
Obtaining an interface instance:
public muteAllRemoteAudioPlaying(mute: boolean): number {}Parameters:
Parameter
Type
Description
mute
boolean
A value of true stops the playback. A value of false resumes the playback.
publishLocalDualStream
Description: Specifies whether to ingest the video track of a minor stream.
Obtaining the interface instance:
public publishLocalDualStream(enable: boolean): number {}Parameters:
Parameter
Type
Description
enable
boolean
A value of true enables the ingest of the video track of a minor stream. A value of false disables the ingest of the video track of a minor stream.
setRemoteVideoStreamType
Description: Specifies the type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream.
Obtain the interface instance:
public setRemoteVideoStreamType(uid: string, streamType: AliRtcVideoStreamType): number {}Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
streamType
AliRtcVideoStreamType
The type of the stream.
setRemoteDefaultVideoStreamType
Description: Specifies the default type of the stream to be pulled for a camera track. The stream can be a major stream or a minor stream.
Obtaining the interface instance
public setRemoteDefaultVideoStreamType(streamType: AliRtcVideoStreamType): number {}Parameters:
Parameter
Type
Description
streamType
AliRtcVideoStreamType
The type of the stream.
subscribeAllRemoteAudioStreams
Description: Subscribes to or stops subscribing to the audio tracks of all remote users.
Obtaining the interface instance
public subscribeAllRemoteAudioStreams(sub: boolean): number {}Parameters:
Parameter
Type
Description
sub
boolean
A value of true subscribes to the audio tracks of all remote users. A value of false stops subscribing to the audio tracks of all remote users.
subscribeAllRemoteDualAudioStreams
Description: Subscribes to or stops subscribing to the audio track of a minor stream.
Obtaining the interface instance:
public subscribeAllRemoteDualAudioStreams(sub: boolean): numberParameters
Parameter
Type
Description
sub
boolean
A value of true subscribes to the audio track of a minor stream.
A value of false stops subscribing to the audio track of a minor stream.
subscribeAllRemoteVideoStreams
Description: Subscribes to or stops subscribing to the video tracks of all remote users.
Obtaining the interface instance
public subscribeAllRemoteVideoStreams(sub: boolean): numberParameters
Parameter
Type
Description
sub
boolean
A value of true subscribes to the video tracks of all remote users. A value of false stops subscribing to the video tracks of all remote users.
subscribeRemoteAudioStream
Description: Manually pulls an audio track.
Obtain the interface instance:
public subscribeRemoteAudioStream(uid: string, sub: boolean): number {}Parameters:
Parameter
Type
Description
uid
string
uid
sub
boolean
A value of true subscribes to the audio track of the specified user. A value of false stops subscribing to the audio track of the specified user.
subscribeRemoteVideoStream
Description: Manually pulls a video track.
Obtain the interface instance
public subscribeRemoteVideoStream(uid: string, track: AliRtcVideoTrack, sub: boolean): number {}Parameters:
Parameter
Type
Description
uid
string
uid
track
AliRtcVideoTrack
Video Stream Type
sub
boolean
A value of true subscribes to the video track of the specified user. A value of false stops subscribing to the video track of the specified user.
subscribeRemoteMediaStream
Description: Subscribes to a remote media stream.
Obtaining an interface instance:
public subscribeRemoteMediaStream(uid: string, videoTrack: AliRtcVideoTrack, subVideo: boolean, subAudio: boolean): number {}Parameters:
Parameter
Type
Description
uid
string
uid
videoTrack
AliRtcVideoTrack
Video Stream Type
subVideo
boolean
Specifies whether to subscribe to the video.
subAudio
boolean
Specifies whether to subscribe to the audio.
subscribeRemoteDestChannelStream
Description: Subscribes to the media stream of a specific user in a channel.
Obtaining an interface instance:
public subscribeRemoteDestChannelStream(channelId: string, uid: string, track: AliRtcVideoTrack, sub_audio: boolean, sub: boolean): number {}Parameters:
Parameter
Type
Description
channelId
string
The channel ID.
uid
string
The unique user ID that is assigned by the AppServer.
track
AliRtcVideoTrack
Incoming video stream type
sub_audio
boolean
Specifies whether to subscribe to the audio track of the remote user.
sub
boolean
Specifies whether to subscribe to the stream of the remote user.
subscribeRemoteDestChannelStreamWithTrack
Description: Subscribes to the audio and video tracks of a specific user in a channel.
Obtaining the interface instance:
public subscribeRemoteDestChannelStreamWithTrack(channelId: string, uid: string, videoTrack: AliRtcVideoTrack, audioTrack: AliRtcAudioTrack, sub: boolean): number {}Parameters:
Parameter
Type
Description
channelId
string
The channel ID.
uid
string
The unique user ID that is assigned by the AppServer.
videoTrack
AliRtcVideoTrack
The source of the video track.
audioTrack
AliRtcAudioTrack
The source of the audio track.
sub
boolean
Specifies whether to subscribe to the stream of the remote user.
setDefaultSubscribeAllRemoteAudioStreams
Description: Specifies whether to subscribe to the audio tracks of remote users by default.
Obtaining the interface instance:
public setDefaultSubscribeAllRemoteAudioStreams(sub: boolean): number {}Parameters:
Parameter
Type
Description
sub
boolean
A value of true subscribes to the audio tracks of remote users by default. A value of false stops subscribing to the audio tracks of remote users by default.
setDefaultSubscribeAllRemoteVideoStreams
Description: Specifies whether to subscribe to the video tracks of remote users by default.
Obtain an interface instance:
public setDefaultSubscribeAllRemoteVideoStreams(sub: boolean): number {}Parameters:
Parameter
Type
Description
sub
boolean
A value of true subscribes to the video tracks of remote users by default. A value of false stops subscribing to the video tracks of remote users by default. The default value is true.
setDefaultAudioRouteToSpeakerphone
Description: Specifies whether to use the speaker as the default audio output device.
Obtaining the interface instance
public setDefaultAudioRouteToSpeakerphone(defaultToSpeakerphone: boolean): number {}Parameters:
Parameter
Type
Description
defaultToSpeakerphone
boolean
A value of true specifies the speaker as the default audio output device. A value of false specifies the headset as the default audio output device. The default value is true.
enableSpeakerphone
Description: Sets the headset or speaker as the audio output device.
Obtain an interface instance:
public enableSpeakerphone(enable: boolean): number {}Parameters:
Parameter
Type
Description
enable
boolean
A value of true sets the speaker as the audio output device. A value of false sets the headset as the audio output device. The default value is false.
isSpeakerOn
Description: Queries whether the current audio output device is the headset or the speaker.
Obtain the interface instance:
public isSpeakerOn(): boolean {}
setRecordingVolume
Description: Sets the recording volume.
Obtaining the interface instance:
public setRecordingVolume(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The recording volume. Valid values: [0,400]. A value of 0 indicates mute. A value greater than 100 indicates a volume increase. A value less than 100 indicates a volume decrease.
setPlayOutVolume
Description: Sets the playback volume.
Obtain an interface instance:
public setPlayOutVolume(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The playback volume. Valid values: [0,400]. A value of 0 indicates mute. A value greater than 100 indicates a volume increase. A value less than 100 indicates a volume decrease.
setAudioProfile
Description: Sets the audio profile.
Obtaining the interface instance:
public setAudioProfile(profile: AliRtcAudioProfile, scenario: AliRtcAudioScenario): number {}Parameters:
Parameter
Type
Description
profile
AliRtcAudioProfile
The audio collection or encoding mode.
scenario
AliRtcAudioScenario
The mode for the audio scenario.
switchCamera
Description: Switches between the front and rear cameras.
Obtaining the interface instance
public switchCamera(): number {}
getCurrentCameraDirection
Description: Queries the current camera type.
Obtaining the interface instance
getCurrentCameraDirection(): AliRtcCameraDirection {}
setCameraZoom
Description: Sets the zoom factor of the camera.
Obtaining the interface instance:
public setCameraZoom(zoom: number): number {}Parameters:
Parameter
Type
Description
zoom
number
The zoom factor.
getCameraMaxZoomFactor
Description: Queries the maximum zoom factor supported by the camera.
Obtaining the interface instance:
public getCameraMaxZoomFactor(): number {}
getCurrentZoom
Description: Queries the zoom factor of the camera.
Obtain the interface instance:
public getCurrentZoom(): number {}
setExposure
Description: Sets the exposure level of the camera.
Obtaining the interface instance
public setExposure(exposure: number): number {}Parameters:
Parameter
Type
Description
exposure
number
The exposure level.
getCurrentExposure
Description: Queries the exposure level of the camera.
Obtaining an interface instance:
public getCurrentExposure(): number {}
getMinExposure
Description: Queries the minimum exposure level supported by the camera.
Obtaining an interface instance:
public getMinExposure(): number {}
getMaxExposure
Description: Queries the maximum exposure level supported by the camera.
Obtaining an interface instance:
public getMaxExposure(): number {}
setCameraFlash
Description: Specifies whether to enable the camera flash.
Obtain an interface instance:
public setCameraFlash(flash: boolean): number {}Parameters:
Parameter
Type
Description
flash
boolean
Specifies whether to enable the flash.
isCameraFocusPointSupported
Description: Queries whether the camera supports manual focus.
Obtain the interface instance:
public isCameraFocusPointSupported(): boolean {}
isCameraExposurePointSupported
Description: Queries whether an exposure point can be set for the camera.
Get the interface instance:
public isCameraExposurePointSupported(): boolean {}
setCameraFocusPoint
Description: Sets the manual focus point of the camera.
Obtaining the interface instance:
public setCameraFocusPoint(x: number, y: number): number {}Parameters:
Parameter
Type
Description
x
number
The x-coordinate of the exposure point.
y
number
The y-coordinate of the exposure point.
setCameraExposurePoint
Description: Sets an exposure point for the camera.
Obtaining the interface instance:
public setCameraExposurePoint(x: number, y: number): number {}Parameters:
Parameter
Type
Description
x
number
The x-coordinate of the exposure point.
y
number
The y-coordinate of the exposure point.
startAudioCapture
Description: Starts audio collection.
Obtaining an interface instance:
public startAudioCapture(): number {}
startAudioCaptureAndKeepAlive
Description: Starts audio collection and keeps the collection device active.
Obtain the interface instance:
public startAudioCaptureAndKeepAlive(keepAlive: boolean): number {}Parameters:
Parameter
Type
Description
keepAlive
boolean
Specifies whether to keep the collection device active after you leave a channel.
stopAudioCapture
Description: Stops audio collection.
Obtaining the interface instance:
public stopAudioCapture(): number {}
startAudioPlayer
Description: Starts the audio player.
Obtaining the interface instance:
public startAudioPlayer(): number {}
stopAudioPlayer
Description: Stops the audio player.
Obtaining the interface instance:
public stopAudioPlayer(): number {}
isCameraOn
Description: Queries whether the camera is turned on.
Obtaining an interface instance:
public isCameraOn(): boolean {}
isInCall
Description: Checks whether you are in a channel.
Obtain an interface instance:
public isInCall(): boolean {}
joinChannelWithChannelParam
Description: Joins a channel using channel parameters.
Obtaining the interface instance:
public joinChannelWithChannelParam(token: string, channelParam: AliRtcSDKChannelParam) : numberParameters:
Parameter
Type
Description
token
string
The authentication information. Obtain this from your app server.
channelParam
The parameters for joining the channel.
joinAIChannel
API Description: Enables the audio frame observer
Obtaining the interface instance:
public joinAIChannel(token: string, channelParam: AliRtcSDKChannelParam, agentParam: AliRtcSDKAIAgentParam) : numberParameters:
Parameter
Type
Description
token
string
The authentication information. Obtain this from your app server.
channelParam
The parameters for joining the channel.
agentParam
The parameters for the AI to join the channel.
enableAudioFrameObserver
Description: Enables the audio frame observer.
Obtaining the interface instance:
public enableAudioFrameObserver(enable: boolean, audioSource: AliRtcAudioSource, config: AliRtcAudioFrameObserverConfig): number {}Parameters:
Parameter
Type
Description
enable
boolean
Enabled
audioSource
AliRtcAudioSource
The audio source.
config
AliRtcAudioFrameObserverConfig
The settings of the audio frame observer.
enableAudioVolumeIndication
Description: Sets the volume callback interval and smoothing factor.
Obtaining an interface instance:
public enableAudioVolumeIndication(interval: number, smooth: number, reportVad: number): number {}Parameters:
Parameter
Type
Description
interval
number
The interval at which volume detection is performed. Unit: milliseconds.
smooth
number
The smoothing factor.
reportVad
number
The switch used to detect the person who speaks. A value of 1 turns on the switch. A value of 0 turns off the switch.
registerLocalVideoTexture
Description: Registers an object that is used to monitor the OpenGL texture data of a local camera track.
Obtain the interface instance:
public registerLocalVideoTexture(observer: AliRtcEngineVideoTextureListener): void {}Parameters:
Parameter
Type
Description
observer
AliRtcEngineVideoTextureListener
The object used to monitor the OpenGL texture data.
unregisterLocalVideoTexture
Description: Unregisters an object that is used to monitor the OpenGL texture data of a local camera track.
Obtaining the interface instance
public unregisterLocalVideoTexture(observer: AliRtcEngineVideoTextureListener): void {}Parameters:
Parameter
Type
Description
observer
AliRtcEngineVideoTextureListener
The object used to monitor the OpenGL texture data.
pauseAudioEffect
Description: Pauses the playback of a sound effect.
Obtaining an interface instance:
public pauseAudioEffect(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
pauseAllAudioEffects
Description: Pauses the playback of all sound effects.
Obtain an interface instance:
public pauseAllAudioEffects(): number {}
resumeAudioEffect
Description: Resumes the playback of a sound effect.
Obtain the interface instance:
public resumeAudioEffect(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
resumeAllAudioEffects
Description: Resumes the playback of all sound effects.
Obtain the interface instance:
public resumeAllAudioEffects(): number {}
setAudioEffectPitchValue
Description: Sets the audio pitch.
Obtaining the interface instance:
public setAudioEffectPitchValue(value: number): number {}Parameters:
Parameter
Type
Description
value
number
The pitch value. Valid values: 0.5 to 2.0. A value of 1.0 indicates that the pitch remains the same.
setAudioEffectVoiceChangerMode
Description: Sets the voice change mode.
Obtaining the interface instance:
public setAudioEffectVoiceChangerMode(mode: AliRtcAudioEffectVoiceChangerMode): number {}Parameters:
Parameter
Type
Description
mode
AliRtcAudioEffectVoiceChangerMode
The voice change mode. For more information, see AliRtcAudioEffectVoiceChangerMode.
setAudioEffectReverbMode
Description: Sets the reverberation mode.
Obtaining the interface instance:
public setAudioEffectReverbMode(mode: AliRtcAudioEffectReverbMode): number {}Parameters:
Parameter
Type
Description
mode
AliRtcAudioEffectReverbMode
The reverberation mode. For more information, see AliRtcAudioEffectReverbMode.
setAudioEffectBeautifyMode
Description: Sets the voice beautification mode.
Obtain an interface instance:
public setAudioEffectBeautifyMode(mode: AliRtcAudioEffectBeautifyMode): number {}Parameters:
Parameter
Type
Description
mode
AliRtcAudioEffectBeautifyMode
The voice beautification mode. For more information, see AliRtcAudioEffectBeautifyMode.
setAudioEffectReverbParamType
Description: Sets the parameters of the reverberation mode.
Obtaining an interface instance:
public setAudioEffectReverbParamType(type: AliRtcAudioEffectReverbParamType, value: number): number {}Parameters:
Parameter
Type
Description
type
AliRtcAudioEffectReverbParamType
The sound effect parameter. For more information, see AliRtcAudioEffectReverbParamType.
value
number
The value of the sound effect parameter. For information about the valid values of different sound effect parameters, see AliRtcAudioEffectReverbParamType.
setAudioEffectEqualizationParam
Description: Sets the equalization frequency for reverberation.
Obtaining an interface instance:
public setAudioEffectEqualizationParam(bandIndex: AliRtcAudioEffectEqualizationBandFrequency, gain: number): number {}Parameters:
Parameter
Type
Description
bandIndex
AliRtcAudioEffectEqualizationBandFrequency
The frequency band of the equalizer. Valid values: [0,9]. Based on the band, the center frequency can be 31 Hz, 62 Hz, 125 Hz, 250 Hz, 500 Hz, 1,000 Hz, 2,000 Hz, 4,000 Hz, 8,000 Hz, and 16,000 Hz.
gain
number
The equalizer gain. Valid values: [-15,15]. Default value: 0. Unit: dB.
startAudioAccompany
Description: Starts accompaniment mixing.
Obtain an interface instance:
public startAudioAccompany(fileName: string, config: AliRtcAudioAccompanyConfig): number {}Parameters:
Parameter
Type
Description
fileName
string
The name of the accompaniment file.
config
AliRtcAudioAccompanyConfig
The playback settings of the accompaniment.
stopAudioAccompany
Description: Stops accompaniment mixing.
Obtaining the interface instance:
public stopAudioAccompany(): number {}
setAudioAccompanyVolume
Description: Sets the accompaniment volume.
Obtain the interface instance:
public setAudioAccompanyVolume(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The accompaniment volume. Valid values: [0,100].
setAudioAccompanyPublishVolume
Description: Sets the volume of the accompaniment for stream ingest.
Obtaining an interface instance:
public setAudioAccompanyPublishVolume(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The volume of the accompaniment for stream ingest. Valid values: [0,100].
getAudioAccompanyPublishVolume
Description: Queries the volume of the accompaniment for stream ingest.
Obtaining the interface instance
public getAudioAccompanyPublishVolume(): number {}
setAudioAccompanyPlayOutVolume
Description: Sets the volume of the accompaniment for local playback.
Obtain the interface instance:
public setAudioAccompanyPlayOutVolume(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The local playback volume. Valid values: [0,100].
getAudioAccompanyPlayOutVolume
Description: Queries the volume of the accompaniment for local playback.
Obtaining the interface instance:
public getAudioAccompanyPlayOutVolume(): number {}
pauseAudioAccompany
Description: Pauses accompaniment mixing.
Obtaining the interface instance:
public pauseAudioAccompany(): number {}
resumeAudioAccompany
Description: Resumes accompaniment mixing.
Obtain an interface instance:
public resumeAudioAccompany(): number {}
getAudioAccompanyDuration
Description: Queries the duration of the accompaniment file, in milliseconds.
Obtaining the interface instance:
public getAudioAccompanyDuration(): number {}
getAudioAccompanyCurrentPosition
Description: Queries the playback progress of the accompaniment file, in milliseconds.
Obtaining the interface instance:
public getAudioAccompanyCurrentPosition(): number {}
setAudioAccompanyPosition
Description: Sets the playback position of the accompaniment file.
Obtaining the interface instance:
public setAudioAccompanyPosition(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The position of the progress bar. Unit: milliseconds.
preloadAudioEffect
Description: Preloads a sound effect.
Obtaining the interface instance:
public preloadAudioEffect(soundId: number, filePath: string): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
filePath
string
The path of the sound effect. Local files and URLs are supported.
unloadAudioEffect
Description: Deletes a preloaded sound effect.
Obtaining the interface instance:
public unloadAudioEffect(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The ID that is assigned by the user to the sound effect.
playAudioEffect
Description: Starts the playback of a sound effect.
Obtain an interface instance:
public playAudioEffect(soundId: number, filePath: string, config: AliRtcAudioEffectConfig): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
filePath
string
The path of the sound effect. Local files and URLs are supported.
config
AliRtcAudioEffectConfig
The playback settings of the sound effect.
stopAudioEffect
Description: Stops the playback of a sound effect.
Obtaining an interface instance:
public stopAudioEffect(volume: number): number {}Parameters:
Parameter
Type
Description
volume
number
The ID that is assigned by the user to the sound effect.
stopAllAudioEffects
Description: Stops the playback of all sound effects.
Obtaining an interface instance
public stopAllAudioEffects(): number {}
setAudioEffectPublishVolume
Description: Sets the volume of a sound effect for stream ingest.
Obtaining the interface instance:
public setAudioEffectPublishVolume(soundId: number, volume: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
volume
number
The volume of the mixed audio for stream ingest. Valid values: [0,100]. Default value: 50.
getAudioEffectPublishVolume
Description: Queries the volume of a sound effect for stream ingest.
Obtain the interface instance:
public getAudioEffectPublishVolume(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
setAudioEffectPlayOutVolume
Description: Sets the volume of a sound effect for local playback.
Obtain the interface instance:
public setAudioEffectPlayOutVolume(soundId: number, volume: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
volume
number
The local playback volume. Valid values: [0,100]. Default value: 50.
getAudioEffectPlayoutVolume
Description: Queries the volume of a sound effect for local playback.
Obtaining an interface instance:
public getAudioEffectPlayoutVolume(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
setAllAudioEffectsPublishVolume
Description: Sets the volume of all sound effects for stream ingest.
Obtaining the interface instance:
public setAllAudioEffectsPublishVolume(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
setAllAudioEffectsPlayoutVolume
Description: Sets the volume of all sound effects for local playback.
Obtain an interface instance:
public setAllAudioEffectsPlayoutVolume(soundId: number): number {}Parameters:
Parameter
Type
Description
soundId
number
The ID that is assigned by the user to the sound effect.
snapshotVideo
Description: Enables snapshot capture for a video track.
Obtain the interface instance:
public snapshotVideo(userId: string, trackType: AliRtcVideoTrack): number {}Parameters:
Parameter
Type
Description
userId
string
The user ID. A value of "" indicates the local user.
trackType
AliRtcVideoTrack
The source of the video track. AliEngineVideoTrackCamera and AliEngineVideoTrackScreen are supported.
sendMediaExtensionMsg
Description: Sends an SEI message.
Obtain an interface instance:
public sendMediaExtensionMsg(message: Uint8Array, repeatCount: number, delay: number, isKeyFrame: boolean): number {}Parameters:
Parameter
Type
Description
message
Uint8Array
The content of the message. It can be up to 4 KB in length.
repeatCount
number
The number of retries, which indicates the level of redundancy. This parameter can be used to prevent message loss caused by packet loss.
delay
number
The delay. Unit: milliseconds. This parameter indicates the number of elapsed milliseconds before the message is sent.
isKeyFrame
boolean
Specifies whether to insert SEI into only key frames.
updatePublishLiveStreamWithTaskId
Description: Updates the parameters for relayed live streaming.
Obtaining the interface instance:
public updatePublishLiveStreamWithTaskId(taskId: string, transcoding: AliRtcLiveTranscodingParam): number {}Parameters:
Parameter
Type
Description
taskId
string
The task ID.
transcoding
AliRtcLiveTranscodingParam
The parameters required for stream ingest.
stopPublishLiveStreamWithTaskId
Description: Stops relayed live streaming.
Obtaining the interface instance:
public stopPublishLiveStreamWithTaskId(taskId: string): number {}Parameters:
Parameter
Type
Description
taskId
string
The task ID.
getVideoCodecType
Description: Queries the video codec type.
Obtaining an interface instance:
public getVideoCodecType(codecKind: AliRtcVideoCodecKindType): AliRtcVideoFormat {}Parameters:
Parameter
Type
Description
codecKind
AliRtcVideoCodecKindType
The video codec type, which can be encoder or decoder.
getCurrentEncoderManufacturer
Description: Queries the codec manufacturer. If stream ingest is not started, null is returned.
Obtaining the interface instance:
public getCurrentEncoderManufacturer(track: AliRtcVideoTrack): AliRtcVideoCodecManufacturer {}Parameters:
Parameter
Type
Description
track
AliRtcVideoTrack
AliRtcVideoTrack
getNetworkTime
Description: Queries the network time.
Obtaining the interface instance:
public getNetworkTime(): number {}
sendDataChannelMsg
Description: Sends a Data Channel message.
Obtaining the interface instance:
public sendDataChannelMsg(controlMsg: AliRtcDataChannelMsg): number {}Parameters:
Parameter
Type
Description
controlMsg
AliRtcDataChannelMsg
The content of the message.
onRemoteUserOnline
Description: The callback that is invoked when a remote user joins a channel in the communication mode or a streamer joins a channel in the interactive mode.
Calling:
onRemoteUserOnline : (func : OnRemoteUserOnLineNotify) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
online
boolean
Indicates whether the user is online.
onRemoteUserOffline
Description: The callback that is invoked when a remote user leaves a channel in the communication mode or a streamer leaves a channel in the interactive mode.
Obtain the interface instance:
onRemoteUserOffline : (func : OnRemoteUserOffLineNotify) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
reason
number
The reason why the user goes offline.
onJoinChannel
Description: The callback that is invoked when a user joins a channel.
Obtaining an interface instance
onJoinChannel : ( func : OnJoinChannelCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
result
number
The result of the request to join the channel. A value of 0 indicates that the request is successful. A value other than 0 indicates that the request fails.
channel
string
Joining a channel by name
userId
string
The user ID.
elapsed
number
The amount of time consumed for joining the channel.
onLeaveChannel
Description: The callback that is invoked when a user leaves a channel.
Obtain an interface instance:
onLeaveChannel : ( func : OnLeaveChannelCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
result
number
The result of the request to leave the channel. A value of 0 indicates that the request is successful. A value other than 0 indicates the request fails.
stats
object
The statistics on the session in the channel.
onAudioPublishStateChanged
Description: The callback that is invoked when the status of stream ingest for an audio track changes.
Obtain the interface instance:
onAudioPublishStateChanged: ( func : OnAudioPublishStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
audioTrack
string
Stream identity
oldState
number
The previous stream ingest state.
newState
number
The current stream ingest state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onVideoPublishStateChanged
Description: The callback that is invoked when the status of stream ingest for a video track changes.
Obtain the interface instance:
onVideoPublishStateChanged: ( func : OnVideoPublishStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
oldState
number
The previous stream ingest state.
newState
number
The current stream ingest state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onDualStreamPublishStateChanged
Description: The callback that is invoked when the status of stream ingest for a minor stream changes.
Calling:
onDualStreamPublishStateChanged: ( func : OnDualStreamPublishStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
oldState
number
The previous stream ingest state.
newState
number
The current stream ingest state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onRemoteTrackAvailableNotify
Description: The callback that is invoked when the audio and video tracks of a remote user change.
Obtaining an interface instance:
onRemoteTrackAvailableNotify: ( func : OnRemoteTrackAvailableNotifyCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
audioTrack
AliRtcAudioTrack
The source of the audio track.
videoTrack
AliRtcVideoTrack
Video stream type
onAudioSubscribeStateChanged
Description: The callback that is invoked when the status of subscription to an audio track changes.
Obtaining an interface instance:
onAudioSubscribeStateChanged: ( func : OnAudioSubscribeStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The user ID.
oldState
number
The previous subscription state.
newState
number
The current subscription state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onVideoSubscribeStateChanged
Description: The callback that is invoked when the status of subscription to a video track changes.
Obtaining the interface instance:
onVideoSubscribeStateChanged: ( func : OnVideoSubscribeStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The user ID.
oldState
number
The previous subscription state.
newState
number
The current subscription state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onSubscribeStreamTypeChanged
Description: The callback that is invoked when the type of the stream that is subscribed to changes.
Obtaining an interface instance:
onSubscribeStreamTypeChanged: ( func : OnSubscribeStreamTypeChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The user ID.
oldStreamType
AliRtcVideoStreamType
The previous subscription state.
newStreamType
AliRtcVideoStreamType
The current subscription state.
elapseSinceLastState
number
The time elapsed for the change. Unit: milliseconds.
channel
string
The channel ID.
onNetworkQualityChanged
Description: The callback that is invoked when the network quality changes.
Obtaining the interface instance:
onNetworkQualityChanged: ( func : OnNetworkQualityChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The user ID. An empty value for this parameter indicates the local user.
upQuality
AliRtcNetworkQuality
The upstream network status.
downQuality
AliRtcNetworkQuality
The downstream network status.
onBye
Description: The callback that is invoked when a user is forced to leave a channel.
Obtaining the interface instance:
onBye: ( func : OnByeCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
code
number
The reason.
onOccurWarning
Description: The callback that is invoked when a warning is reported.
Obtaining the interface instance:
onOccurWarning: ( func : OnOccurWarningCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
warn
number
The warning type.
message
string
The warning message.
onOccurError
Description: The callback that is invoked when an error occurs.
Obtaining an interface instance:
onOccurError: ( func : OnOccurErrorCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
error
number
The error type.
msg
string
The error message.
onFirstRemoteVideoFrameDrawn
Description: The callback that is invoked when the first frame from the video track of a remote user is displayed.
Obtaining the interface instance:
onFirstRemoteVideoFrameDrawn: ( func : OnFirstRemoteVideoFrameDrawnCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
videoTrack
AliRtcVideoTrack
The source of the video track. It can be a screen track or camera track.
width
number
The video width.
height
number
The video height.
elapsed
number
The time elapsed from the point in time at which the local user joins the channel to the point in time at which the callback is invoked. Unit: milliseconds.
onFirstLocalVideoFrameDrawn
Description: The callback that is invoked when the first frame from the local video track for preview is displayed.
Obtaining the interface instance
onFirstLocalVideoFrameDrawn: ( func : OnFirstLocalVideoFrameDrawnCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
width
number
The video width for local preview.
height
number
The video height for local preview.
elapsed
number
The time elapsed from the point in time at which the local user joins the channel to the point in time at which the callback is invoked. Unit: milliseconds.
onFirstAudioPacketSend
Description: The callback that is invoked when the first audio packet is sent.
Obtain the interface instance:
onFirstAudioPacketSend: (func: OnFirstAudioPacketSendCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
audioTrack
AliRtcAudioTrack
The source of the audio track.
timeCost
number
The time elapsed from the point in time at which the user joins the channel to the point in time at which the first audio packet is sent.
onFirstAudioPacketReceived
Description: The callback that is invoked when the first audio packet is received.
Obtain an interface instance:
onFirstAudioPacketReceived: ( func : OnFirstAudioPacketReceivedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user, which is a unique ID assigned by the AppServer.
track
AliRtcAudioTrack
The source of the audio track.
timeCost
number
The time elapsed from the point in time at which the user joins the channel to the point in time at which the first audio packet is received.
onFirstRemoteAudioDecoded
Description: The callback that is invoked when the first frame from the audio track of a remote user is decoded.
Obtaining the interface instance:
onFirstRemoteAudioDecoded: ( func : OnFirstRemoteAudioDecodedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user, which is a unique ID assigned by the AppServer.
track
AliRtcAudioTrack
The source of the audio track.
elapsed
number
The time elapsed from the point in time at which the local user joins the channel to the point in time at which the callback is invoked. Unit: milliseconds.
onFirstVideoPacketSend
Description: The callback that is invoked when the first video packet is sent.
Obtaining the interface instance:
onFirstVideoPacketSend: ( func : OnFirstVideoPacketSendCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
videoTrack
AliRtcVideoTrack
The source of the video track.
timeCost
number
The time elapsed from the point in time at which the user joins the channel to the point in time at which the first video packet is sent.
onFirstVideoPacketReceived
Description: The callback that is invoked when the first video packet is received.
Obtaining the interface instance:
onFirstVideoPacketReceived: ( func : OnFirstVideoPacketReceivedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user, which is a unique ID assigned by the AppServer.
videoTrack
AliRtcVideoTrack
The source of the video track.
timeCost
number
The time elapsed. Unit: milliseconds.
onFirstVideoFrameReceived
Description: The callback that is invoked when the first frame from the video track of a remote user is received.
Obtaining an interface instance:
onFirstVideoFrameReceived: ( func : OnFirstVideoFrameReceivedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The unique user ID that is assigned by the AppServer.
videoTrack
AliRtcVideoTrack
The source of the video track.
timeCost
number
The time elapsed. Unit: milliseconds.
onConnectionStatusChange
Description: The callback that is invoked when the network connection status changes.
Obtaining the interface instance:
onConnectionStatusChange: ( func : OnConnectionStatusChangeCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
status
number
The connection status.
reason
number
The reason for the change.
onUserAudioMuted
Description: The callback that is invoked when a remote user is muted or unmuted.
Obtaining the interface instance:
onUserAudioMuted: ( func : OnUserAudioMutedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user.
isMute
boolean
Indicates whether the user is muted. Valid values: true and false.
onUserVideoMuted
Description: The callback that is invoked when a remote user sends black frames.
Obtaining the interface instance:
onUserVideoMuted: ( func : OnUserVideoMutedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the user who calls the muteVideo method.
isMute
boolean
A value of true indicates that black frames are sent for the video track. A value of false indicates that the video track is normally published.
onUserVideoEnabled
Description: The callback that is invoked when a remote user disables data collection for the camera track.
Obtaining the interface instance:
onUserVideoEnabled: ( func : OnUserVideoEnabledCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the user who calls the EnableLocalVideo method.
isEnable
boolean
A value of true indicates that camera track capturing is enabled. A value of false indicates that camera track capturing is disabled.
onRemoteAudioAccompanyStarted
Description: The callback that is invoked when the playback of the accompaniment starts for a remote user.
Obtaining an interface instance:
onRemoteAudioAccompanyStarted: ( func : OnRemoteAudioAccompanyStartedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user, which is a unique ID assigned by the AppServer.
onRemoteAudioAccompanyFinished
Description: The callback that is invoked when the playback of the accompaniment ends for a remote user.
Obtaining the interface instance:
onRemoteAudioAccompanyFinished: ( func : OnRemoteAudioAccompanyFinishedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the remote user, which is a unique ID assigned by the AppServer.
onUpdateRoleNotify
Description: The callback that is invoked when the user role is changed.
Obtain the interface instance:
onUpdateRoleNotify: ( func : OnUpdateRoleNotifyCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
oldRole
AliRtcClientRole
The user role before the change.
newRole
AliRtcClientRole
The user role after the change.
onAudioVolumeCallback
Description: The callback for the volume of the subscribed audio.
Obtaining an interface instance:
onAudioVolumeCallback: ( func : OnAudioVolumeCallbackCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
volumeInfo
AliRtcVolumeInfo[]
The volume information of the user speaking.
volumeInfoCount
number
The number of users returned.
totalVolume
number
The volume of the mixed audio. Valid values: [0,255].
onActiveSpeaker
Description: The callback that is invoked when an active user is detected speaking. The ID of the user who is most possibly speaking is returned.
Obtaining an interface instance:
onActiveSpeaker: ( func : OnActiveSpeakerCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the user speaking.
onAudioAccompanyStateChanged
Description: The callback that is invoked when the local playback status of the accompaniment changes.
Obtaining an interface instance:
onAudioAccompanyStateChanged: ( func : OnAudioAccompanyStateChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
type
number
The current playback status.
errorCode
number
The playback error code.
onAudioEffectFinished
Description: The callback that is invoked when the local playback of a sound effect ends.
Obtain an interface instance:
onAudioEffectFinished: ( func : OnAudioEffectFinishedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
soundId
number
The unique ID that is assigned by the user to the sound effect.
onStats
Description: The callback that is invoked to return the statistics on the current session.
Obtain the interface instance:
onStats: ( func : OnStatsCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
stats
AliRtcStats
The statistics on the session.
onLocalVideoStats
Description: The callback that is invoked to return the statistics on the local video.
Obtaining the interface instance:
onLocalVideoStats: ( func : OnLocalVideoStatsCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
localVideoStats
AliRtcLocalVideoStats
The statistics on the local video.
onRemoteVideoStats
Description: The callback that is invoked to return the statistics on the remote video.
Obtaining the interface instance:
onRemoteVideoStats: ( func : OnRemoteVideoStatsCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
remoteVideoStats
AliRtcRemoteVideoStats[]
The statistics on the remote video.
onLocalAudioStats
Description: The callback that is invoked to return the statistics on the local audio.
Obtain an interface instance:
onLocalAudioStats: ( func : OnLocalAudioStatsCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
localAudioStats
AliRtcLocalAudioStats
The statistics on the local audio.
onRemoteAudioStats
Description: The callback that is invoked to return the statistics on the remote audio.
Obtain an interface instance:
onRemoteAudioStats: ( func : OnRemoteAudioStatsCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
remoteAudioStats
AliRtcRemoteAudioStats[]
The statistics on the remote audio.
onMediaExtensionMsgReceived
Description: The callback that is invoked when an SEI message is received.
Obtaining the interface instance:
onMediaExtensionMsgReceived: ( func : OnMediaExtensionMsgReceivedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The ID of the user who sends the message.
message
Uint8Array
The content of the message.
size
number
The length of the message.
onPublishLiveStreamStateChangedWithTaskId
Description: The callback that is invoked when the status of relayed live streaming changes.
Obtaining the interface instance
onPublishLiveStreamStateChangedWithTaskId: ( func : OnPublishLiveStreamStateChangedWithTaskIdCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
taskId
string
The task ID.
state
number
The stream ingest status.
errCode
number
The error code.
onPublishTaskStateChangedWithTaskId
Description: The callback that is invoked when the status of a relayed live streaming task changes.
Obtaining the interface instance:
onPublishTaskStateChangedWithTaskId: ( func : OnPublishTaskStateChangedWithTaskIdCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
taskId
string
The task ID.
state
number
The task status.
onAuthInfoWillExpire
Description: The callback that is invoked when the user authentication information specified by AliEngineAuthInfo is about to expire in 30 seconds.
Obtain an interface instance:
onAuthInfoWillExpire: ( func : OnAuthInfoWillExpireCallback) => AliRtcEngineEventListener;
onAuthInfoExpired
Description: The callback for expired authentication. The expiration information is returned by the server when users call a method that requires authentication.
Obtaining an interface instance:
onAuthInfoExpired: ( func: OnAuthInfoExpiredCallback) => AliRtcEngineEventListener;
onLocalDeviceException
Description: The callback that is invoked when a local device exception occurs.
Obtain an interface instance
onLocalDeviceException: ( func : OnLocalDeviceExceptionCallback) => AliRtcEngineEventListener;Parameters
Parameter
Type
Description
deviceType
AliRtcDeviceType
The device type.
exceptionType
AliRtcDeviceExceptionType
The type of the device exception.
msg
string
The information carried in the exception.
onDataChannelMessage
Description: The callback for a Data Channel message.
Obtaining the interface instance
onDataChannelMessage: ( func : OnDataChannelMessageCallback) => AliRtcEngineEventListener;Parameters
Parameter
Type
Description
uid
string
The user ID.
msg
string
The message.
onVideoResolutionChanged
Description: The callback that is invoked when the resolution changes.
Obtaining an interface instance:
onVideoResolutionChanged: (func: OnVideoResolutionChangedCallback) => AliRtcEngineEventListener;Parameters:
Parameter
Type
Description
uid
string
The user ID.
track
AliRtcVideoTrack
Changing the video track
width
number
The current video width.
height
number
The current video height.
onVideoTextureCreate
Description: The callback that is invoked when the OpenGL context is created.
Obtain an interface instance:
onVideoTextureCreate : (func : OnVideoTextureCreateFunc) => AliRtcEngineVideoTextureListener;Parameters:
Parameter
Type
Description
context
object
The OpenGL context.
onVideoTextureUpdate
Description: The callback that is invoked when the OpenGL texture is updated.
Obtaining an interface instance:
onVideoTextureUpdate : (func : OnVideoTextureUpdateFunc) => AliRtcEngineVideoTextureListener;Parameters:
Parameter
Type
Description
textureId
number
The ID of the OpenGL texture.
width
number
The height of the OpenGL texture.
height
number
The width of the OpenGL texture.
videoRawData
AliEngineVideoRawData
The video frame data. For more information, see AliEngineVideoRawData.
onVideoTextureDestroy
Description: The callback that is invoked when the OpenGL context is destroyed.
Obtaining the interface instance:
onVideoTextureDestroy : (func : OnVideoTextureDestroyFunc) => AliRtcEngineVideoTextureListener;Parameters:
Parameter
Type
Description
onCapturedAudioFrame
Description: The callback for raw audio data that is collected.
Obtain the interface instance:
onCapturedAudioFrame : (func : OnAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
audioRawData
AliRtcAudioRawData
The audio data.
onProcessCapturedAudioFrame
Description: The callback for audio data that is processed by the 3A algorithms.
Obtaining the interface instance:
onProcessCapturedAudioFrame : (func : OnAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
audioRawData
AliRtcAudioRawData
The audio data.
onPublishAudioFrame
Description: The callback for ingested audio data.
Obtaining the interface instance:
onPublishAudioFrame : (func : OnAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
audioRawData
AliRtcAudioRawData
The audio data.
onPlaybackAudioFrame
Description: The callback for played audio data.
Obtaining the interface instance:
onPlaybackAudioFrame : (func : OnAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
audioRawData
AliRtcAudioRawData
The audio data.
onMixedAllAudioFrame
Description: The callback for audio data that is mixed from ingested audio and played audio.
Retrieve the interface instance:
onMixedAllAudioFrame : (func : OnAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
audioRawData
AliRtcAudioRawData
The audio data.
onRemoteUserAudioFrame
Description: The callback for audio data that is pulled from a remote user.
Obtaining an interface instance:
onRemoteUserAudioFrame : (func : OnRemoteUserAudioFrameFunc) => AliRtcEngineAudioFrameListener;Parameters:
Parameter
Type
Description
uid
string
The user ID.
audioRawData
AliRtcAudioRawData
The audio data.
onAIAgentResult
Interface description: The processing results of the AI agent.
Obtaining the interface instance:
onAIAgentResult: (func: OnAIAgentResultCallback) => AliRtcEngineEventListener;Parameters:
Parameter name
Parameter type
Description
code
string
The return code.
action
string
The action associated with the result.
result
String
Result
onRemoteUserSubscribedDataChannel
Description: Enables sending callbacks for data channel messages.
Obtaining an interface instance:
onRemoteUserSubscribedDataChannel: (func: OnRemoteUserSubscribedDataChannelCallback) => AliRtcEngineEventListener;Parameters:
Parameter name
Parameter type
Parameter description
uid
string
User ID