Harmony API details

更新时间:
复制 MD 格式

This topic describes the Harmony software development kit (SDK) APIs.

API overview

Class/Protocol

API

Description

ARTCAICallEngineInterface

AI call engine interface

userId

Gets the user ID of the current call.

isOnCall

Gets the status of whether a call is in progress.

agentInfo

Gets the information of the current agent.

agentState

Gets the state of the current agent.

audioConfig

Audio configuration.

videoConfig

Video configuration.

listener

Sets and gets callback events.

call

Starts a call.

callWithConfig

Starts a call using the call configuration.

handup

Hangs up and destroys the current call engine.

setAgentViewConfig

Sets the rendering view and configuration for the agent.

setLocalViewConfig

Sets the rendering view and configuration for the local camera.

interruptSpeaking

Interrupts the agent's speech.

sendTextToAgent

Sends a text message to the agent.

sendCustomMessageToServer

Sends a custom message to the server.

updateLlmSystemPrompt

Updates the system prompt for the large language model (LLM).

updateBailianAppParams

Updates the parameters for the Model Studio application center.

updateVcrConfig

Updates the VCR configuration.

updateAsrMaxSilence

Updates the threshold for voice activity detection.

updateTtsSpeechRate

Updates the speech rate for text-to-speech (TTS).

queryCurrentAgentState

Queries the current state of the agent.

startVisionCustomCapture

For a Vision agent, starts custom frame capture.

stopVisionCustomCapture

For a Vision agent, stops custom frame capture.

enableVoiceInterrupt

Enables or disables smart interruption.

switchVoiceId

Switches the voice.

enableSpeaker

Enables or disables the speaker.

muteAgentAudioPlaying

Stops or resumes the playback of the agent's audio stream.

muteMicrophone

Mutes or unmutes the microphone.

muteLocalCamera

Disables or enables the camera.

switchCamera

Switches between the front and rear cameras.

enablePushToTalk

Enables or disables push-to-talk mode.

startPushToTalk

Starts speaking.

finishPushToTalk

Speech ended

cancelPushToTalk

Cancels the current speech.

useVoiceprint

Specifies whether to use voiceprint-based denoising for the current speech segment.

clearVoiceprint

Purges the current voiceprint data.

createRTCEngine

Creates an RTC engine.

getRTCInstance

Gets the RTC engine.

destroy

Releases resources.

parseShareAgentCall

Parses shared agent information.

generateShareAgentCall

Starts a call with a shared agent.

ARTCAICallEngineListener

AI call engine event callback

onErrorOccurs

An error occurred.

onConnectionStatusChange

The connection status changes during a call.

onCallBegin

The call starts (joins the session).

onCallEnd

The call ends (leaves the session).

onAgentStarted

The call agent has started.

onRTCEngineCreated

The RTC engine is created. Call getRTCInstance in this callback to get the RTC engine instance.

onAgentDataChannelAvailable

Callback for when the agent's message channel is available. Messages can be sent to the agent only after this callback is triggered.

onAgentVideoAvailable

Indicates whether the agent's video stream is available (stream ingest).

onAgentAudioAvailable

Indicates whether the agent's audio stream is available (stream ingest).

onAgentAvatarFirstFrameDrawn

The first frame of the agent's digital human is rendered.

onAgentStateChanged

The agent's state changes.

onNetworkStatusChanged

The network status changes.

onVoiceVolumeChanged

Notification of a volume change.

onUserSubtitleNotify

Notification of the agent's recognition result for a user's question.

onVoiceAgentSubtitleNotify

Notification of the agent's answer.

onAgentEmotionNotify

Notification of the agent's emotion.

onVoiceIdChanged

The voice of the current call has changed.

onVoiceInterrupted

Indicates whether voice interruption is enabled for the current call.

onSpeakingInterrupted

The agent's current speech is interrupted.

onPushToTalk

Indicates whether push-to-talk mode is enabled for the current call.

onVoiceprint

Indicates whether voiceprint-based denoising is enabled for the current call.

onVoiceprintCleared

The voiceprint data for the current call is purged.

onAgentWillLeave

The current agent is about to leave (end the current call).

onReceivedAgentCustomMessage

A custom message is received from the current agent.

onReceivedAgentVcrResult

A VCR result is received from the current agent.

onHumanTakeoverWillStart

A human is about to take over from the current agent.

onHumanTakeoverConnected

A live agent has joined the call.

onAudioDelayInfo

Audio loopback delay.

onVisionCustomCapture

Indicates whether custom frame capture mode is enabled for the current Vision call.

onLLMReplyCompleted

The LLM has finished answering in the current call.

onAudioAccompanyStateChanged

If music accompaniment is played through the RTC instance during the current call, this playback callback is triggered.

ARTCAICallEngineFactory

Engine factory

createEngine

Creates a default AICallEngine.

API details

ARTCAICallEngineInterface details

userId

Retrieves the user ID of the current call.

readonly userId: string | undefined

Type: string | undefined

Note: Read-only property. Retrieves the user ID of the current call.

isOnCall

Indicates whether a call is in progress.

readonly isOnCall: boolean

Type: boolean

Note: Read-only property. The value is true from when the call is connected until it is hung up or an error occurs. Otherwise, the value is false.

agentInfo

Retrieves information about the current agent.

readonly agentInfo: ARTCAICallAgentInfo | undefined

Type: ARTCAICallAgentInfo | undefined

Note: Read-only property. Retrieves information about the agent in the current call.

agentState

Retrieves the state of the current agent.

readonly agentState: ARTCAICallAgentState

Type: ARTCAICallAgentState

Note: Read-only property. Retrieves the state of the current agent.

audioConfig

Audio configuration.

audioConfig: ARTCAICallAudioConfig

Type: ARTCAICallAudioConfig

Note: Audio configuration. This must be set before the call starts to take effect.

videoConfig

Video configuration.

videoConfig: ARTCAICallVideoConfig

Type: ARTCAICallVideoConfig

Note: Video configuration. For a VisionAgent or VideoAgent, this must be set before the call starts to take effect.

listener

Sets and retrieves callback events.

listener: ARTCAICallEngineListener | undefined

Type: ARTCAICallEngineListener | undefined

Note: Used to set and retrieve the callback event listener.

call

Starts a call.

call(userId: string, token: string, agentInfo: ARTCAICallAgentInfo): boolean

Parameters:

Parameter

Type

Required

Description

userId

string

Yes

The ID of the current user.

token

string

Yes

The token for the current user to join the session.

agentInfo

ARTCAICallAgentInfo

Yes

The information of the agent to join the call.

Return value: boolean

Note: Starts an AI call.

callWithConfig

Starts a call using the call configuration.

callWithConfig(config: ARTCAICallConfig): boolean

Parameters:

Parameter

Type

Required

Description

config

ARTCAICallConfig

Yes

The call configuration.

Return value: boolean

Note: Starts an AI call using the complete call configuration.

handup

Hangs up and destroys the current call engine.

handup(destroy: boolean): void

Parameters:

Parameter

Type

Required

Description

destroy

boolean

Yes

Specifies whether to destroy the current engine after hanging up. If set to true, the destroy() method is called internally after the call is completely hung up.

Return value: void

Note: Hangs up and destroys the current call engine. A message is first sent to notify the agent to stop the call. The system then waits for 100 ms before ending the call. If destroy is set to true, internal resources are also released.

setAgentViewConfig

Sets the rendering view and configuration for the agent.

setAgentViewConfig(viewConfig: ARTCAICallViewConfig | undefined): void

Parameters:

Parameter

Type

Required

Description

viewConfig

ARTCAICallViewConfig

No

The view configuration. If this is empty, no view needs to be rendered.

Return value: void

Note: Set this parameter when the agent requires image rendering. This is currently valid only for AvatarAgent and VideoAgent.

setLocalViewConfig

Sets the rendering view and configuration for the local camera.

setLocalViewConfig(viewConfig: ARTCAICallViewConfig | undefined): void

Parameters:

Parameter

Type

Required

Description

viewConfig

ARTCAICallViewConfig

No

The view configuration. If this is empty, no view needs to be rendered.

Return value: void

Note: The rendering view and configuration for the local camera. This is currently valid only for VisionAgent and VideoAgent.

interruptSpeaking

Interrupts the agent's speech.

interruptSpeaking(): boolean

Return value: boolean

Note: This must be called after the call is connected. The return value indicates whether the operation was successful.

sendTextToAgent

Sends a text message to the agent.

sendTextToAgent(req: ARTCAICallSendTextToAgentRequest): boolean

Parameters:

Parameter

Type

Required

Description

req

ARTCAICallSendTextToAgentRequest

Yes

The content to send.

Return value: boolean

Note: This must be called after the call is connected. The return value indicates whether the operation was successful.

sendCustomMessageToServer

Sends a custom message to the server.

sendCustomMessageToServer(msg: string): boolean

Parameters:

Parameter

Type

Required

Description

msg

string

Yes

The content to send.

Return value: boolean

Note: This must be called after a connection is established and returns a value that indicates whether the call was successful.

updateLlmSystemPrompt

Updates the system prompt for the LLM.

updateLlmSystemPrompt(prompt: string): boolean

Parameters:

Parameter

Type

Required

Description

prompt

string

Yes

The prompt.

Return value: boolean

Note: This must be called after the call is connected. For example: "You are a friendly and helpful assistant focused on providing users with accurate information and advice." Note: This is not supported if the LLM node is a Model Studio workflow. A successful return value does not indicate that the update has taken effect.

updateBailianAppParams

Updates the parameters for the Model Studio application center.

updateBailianAppParams(params: Record<string, RecordValueType>): boolean

Parameters:

Parameter

Type

Required

Description

params

Record<string, RecordValueType>

Yes

The parameters.

Return value: boolean

Note: Updates the parameters for the Model Studio application center. The return value indicates whether the message was sent successfully, not whether the update has taken effect.

updateVcrConfig

Updates the VCR configuration.

updateVcrConfig(vcrConfig: ARTCAICallAgentVcrConfig): boolean

Parameters:

Parameter

Type

Required

Description

vcrConfig

ARTCAICallAgentVcrConfig

Yes

The VCR configuration.

Return value: boolean

Note: Updates the VCR configuration. The return value indicates whether the message was sent successfully, not whether the update has taken effect.

updateAsrMaxSilence

Updates the threshold for voice activity detection.

updateAsrMaxSilence(duration: number): boolean

Parameters:

Parameter

Type

Required

Description

duration

number

Yes

The duration in milliseconds.

Return value: boolean

Note: A period of silence longer than this threshold is considered a sentence break. The parameter range is 200 ms to 1200 ms. The return value indicates whether the message was sent successfully, not whether the update has taken effect.

updateTtsSpeechRate

Updates the TTS speech rate.

updateTtsSpeechRate(rate: number): boolean

Parameters:

Parameter

Type

Required

Description

rate

number

Yes

The speech rate.

Return value: boolean

Note: All TTS types are supported. The value ranges from 0.5 to 2.0. The return value indicates whether the message was sent successfully, not whether the update has taken effect.

queryCurrentAgentState

Queries the current state of the agent.

queryCurrentAgentState(): boolean

Return value: boolean

Note: After the query is sent successfully, the onAgentStateChanged event is triggered. The return value indicates whether the query was sent successfully.

startVisionCustomCapture

For a Vision agent, starts custom frame capture.

startVisionCustomCapture(req: ARTCAICallVisionCustomCaptureRequest): boolean

Parameters:

Parameter

Type

Required

Description

req

ARTCAICallVisionCustomCaptureRequest

Yes

The custom request.

Return value: boolean

Note: After this is started, voice communication with the agent is disabled. This must be called after the call is connected. The return value indicates whether the operation was successful.

stopVisionCustomCapture

For a Vision agent, stops custom frame capture.

stopVisionCustomCapture(): boolean

Return value: boolean

Note: This must be called after the call is connected. The return value indicates whether the operation was successful.

enableVoiceInterrupt

Enables or disables smart interruption.

enableVoiceInterrupt(enable: boolean): boolean

Parameters:

Parameter

Type

Required

Meaning

enable

boolean

Yes

Specifies whether to enable the feature.

Return value: boolean

Note: This must be called after the call is connected. The return value indicates whether the operation was successful.

switchVoiceId

Switches the voice.

switchVoiceId(voiceId: string): boolean

Parameters:

Parameter

Type

Required

Meaning

voiceId

string

Yes

The voice ID.

Return value: boolean

Note: Switches the agent's voice. The return value indicates whether the operation was successful.

enableSpeaker

Enables or disables the speaker.

enableSpeaker(enable: boolean): boolean

Parameters:

Parameter

Type

Required

Description

enable

boolean

Yes

Enable

Return value: boolean

Note: Enables or disables the speaker. The return value indicates whether the operation was successful.

muteAgentAudioPlaying

Stops or resumes playback of the agent's audio stream.

muteAgentAudioPlaying(mute: boolean): boolean

Parameters:

Parameter

Type

Required

Description

mute

boolean

Yes

Specifies whether to mute the playback.

Return value: boolean

Note: Stops or resumes playback of the agent's audio stream. The return value indicates whether the operation was successful.

muteMicrophone

Mutes or unmutes the microphone.

muteMicrophone(mute: boolean): boolean

Parameters:

Parameter

Type

Required

Description

mute

boolean

Yes

Specifies whether to mute the microphone.

Return value: boolean

Note: Mutes or unmutes the microphone. The return value indicates whether the operation was successful.

muteLocalCamera

Disables or enables the camera.

muteLocalCamera(mute: boolean): boolean

Parameters:

Parameter

Type

Required

Description

mute

boolean

Yes

Do you want to shut down?

Return value: boolean

Note: This is valid for VisionAgent and VideoAgent. Disables or enables the camera. The return value indicates whether the operation was successful.

switchCamera

Switches between the front and rear cameras.

switchCamera(): boolean

Return value: boolean

Note: This is valid for VisionAgent and VideoAgent. Switches between the front and rear cameras. The return value indicates whether the operation was successful.

enablePushToTalk

Enables or disables push-to-talk mode.

enablePushToTalk(enable: boolean): boolean

Parameters:

Parameter

Type

Required

Meaning

enable

boolean

Yes

Specifies whether to enable the mode.

Return value: boolean

Note: In push-to-talk mode, the agent reports the result only after finishPushToTalk is called. The return value indicates whether the operation was successful.

startPushToTalk

Starts speaking.

startPushToTalk(): boolean

Return value: boolean

Note: Starts speaking. The return value indicates whether the operation was successful.

finishPushToTalk

Finishes speaking.

finishPushToTalk(): boolean

Return value: boolean

Note: Finishes speaking. The return value indicates whether the operation was successful.

cancelPushToTalk

Cancels the current speech.

cancelPushToTalk(): boolean

Return value: boolean

Note: Cancels the current speech. The return value indicates whether the operation was successful.

useVoiceprint

Specifies whether to use voiceprint-based denoising for the current speech segment.

useVoiceprint(isUse: boolean): boolean

Parameters:

Parameter

Type

Required

Description

isUse

boolean

Yes

Enable

Return value: boolean

Note: This feature is in invitational preview. To use it, contact the relevant personnel. The return value indicates whether the operation was successful.

clearVoiceprint

Purges the current voiceprint data.

clearVoiceprint(): boolean

Return value: boolean

Note: This feature is in invitational preview. To use it, contact the relevant personnel. The return value indicates whether the operation was successful.

createRTCEngine

Creates an RTC engine.

createRTCEngine(): void

Return value: void

Note: Call this API operation to create an RTC engine in advance if needed. Otherwise, the engine is created after the call API operation is invoked.

getRTCInstance

Retrieves the RTC engine.

getRTCInstance(): object | undefined

Return value: object | undefined

Note: Retrieves the RTC engine instance.

destroy

Releases resources.

destroy(): void

Return value: void

Note: Releases resources.

parseShareAgentCall

Parses shared agent information.

parseShareAgentCall(shareInfo: string): Promise<ARTCAICallAgentShareConfig | undefined>

Parameters:

Parameter

Type

Required

Description

shareInfo

string

Yes

The shared content generated from the console.

Return value: Promise<ARTCAICallAgentShareConfig | undefined>

Note: Parses the shared agent information. The shared agent configuration is returned.

generateShareAgentCall

Starts a call with a shared agent.

generateShareAgentCall(shareConfig: ARTCAICallAgentShareConfig, userId: string): Promise<ARTCAICallAgentShareGenerateResult | undefined>

Parameters:

Parameter

Type

Required

Description

shareConfig

ARTCAICallAgentShareConfig

Yes

The shared agent configuration.

userId

string

Yes

The ID of the current user.

Return value: Promise<ARTCAICallAgentShareGenerateResult | undefined>

Note: Starts a call with a shared agent.

ARTCAICallEngineListener details

onErrorOccurs

An error occurred.

onErrorOccurs?(code: ARTCAICallErrorCode): void

Parameters:

Parameter

Type

Required

Description

code

ARTCAICallErrorCode

Yes

The error code.

Return value: void

Note: Triggered when an error occurs.

onConnectionStatusChange

The connection status changes during a call.

onConnectionStatusChange?(status: ARTCAICallConnectionStatus, reason: number): void

Parameters:

Parameter

Type

Required

Description

status

ARTCAICallConnectionStatus

Yes

The status code.

reason

number

Yes

The reason. A value of 12 indicates a network connection interruption.

Return value: void

Note: Triggered when the connection status changes.

onCallBegin

The call starts (joins the session).

onCallBegin?(): void

Return value: void

Note: Triggered when the call starts.

onCallEnd

The call ends (leaves the session).

onCallEnd?(): void

Return value: void

Note: Triggered when the call ends.

onAgentStarted

The call agent has started.

onAgentStarted?(): void

Return value: void

Note: Triggered when the agent starts.

onRTCEngineCreated

The RTC engine is created. Call getRTCInstance in this callback to get the RTC engine instance.

onRTCEngineCreated?(): void

Return value: void

Note: Triggered when the RTC engine is created.

onAgentDataChannelAvailable

Callback for when the agent's message channel is available. Messages can be sent to the agent only after this callback is triggered.

onAgentDataChannelAvailable?(): void

Return value: void

Note: Triggered when the agent's tunnel is available. You must wait for this callback to be triggered before sending messages to the agent.

onAgentVideoAvailable

Indicates whether the agent's video stream is available (stream ingest).

onAgentVideoAvailable?(available: boolean): void

Parameters:

Parameter

Type

Required

Description

available

boolean

Yes

Specifies whether the stream is available.

Return value: void

Note: Triggered when the availability of the agent's video stream changes.

onAgentAudioAvailable

Indicates whether the agent's audio stream is available (stream ingest).

onAgentAudioAvailable?(available: boolean): void

Parameters:

Parameter

Type

Required

Description

available

boolean

Yes

Active

Return value: void

Note: Triggered when the availability of the agent's audio stream changes.

onAgentAvatarFirstFrameDrawn

The first frame of the agent's digital human is rendered.

onAgentAvatarFirstFrameDrawn?(): void

Return value: void

Note: Triggered after the first frame of the agent's digital human is rendered.

onAgentStateChanged

The agent's state changes.

onAgentStateChanged?(state: ARTCAICallAgentState): void

Parameters:

Parameter

Type

Required

Description

state

ARTCAICallAgentState

Yes

The current state of the agent.

Return value: void

Note: Triggered when the agent's state changes.

onNetworkStatusChanged

The network status changes.

onNetworkStatusChanged?(uid: string, quality: ARTCAICallNetworkQuality): void

Parameters:

Parameter

Type

Required

Description

uid

string

Yes

The ID of the current speaker.

quality

ARTCAICallNetworkQuality

Yes

The network quality.

Return value: void

Note: Triggered when the network status changes.

onVoiceVolumeChanged

Notification of a volume change.

onVoiceVolumeChanged?(uid: string, volume: number): void

Parameters:

Parameter

Type

Required

Description

uid

string

Yes

The UID of the current speaker.

volume

number

Yes

The volume. The value ranges from 0 to 255.

Return value: void

Note: Triggered when the volume changes.

onUserSubtitleNotify

Notification of the agent's recognition result for a user's question.

onUserSubtitleNotify?(data: ARTCAICallUserSubtitleResult): void

Parameters:

Parameter

Type

Required

Description

data

ARTCAICallUserSubtitleResult

Yes

The user caption notification data.

Return value: void

Note: Triggered when the agent recognizes a user's question.

onVoiceAgentSubtitleNotify

Notification of the agent's answer.

onVoiceAgentSubtitleNotify?(data: ARTCAICallAgentSubtitleResult): void

Parameters:

Parameter

Type

Required

Description

data

ARTCAICallAgentSubtitleResult

Yes

The agent caption notification data.

Return value: void

Note: Triggered when the agent's answer is reported.

onAgentEmotionNotify

Notification of the agent's emotion.

onAgentEmotionNotify?(emotion: string, userAsrSentenceId: number): void

Parameters:

Parameter

Type

Required

Description

emotion

string

Yes

The emotion label, such as neutral, happy, angry, or sad.

userAsrSentenceId

number

Yes

The ID of the sentence that answers the user's question.

Return value: void

Note: Triggered when the agent's emotion is reported.

onVoiceIdChanged

The voice of the current call has changed.

onVoiceIdChanged?(voiceId: string): void

Parameters:

Parameter

Type

Required

Description

voiceId

string

Yes

The ID of the current voice.

Return value: void

Note: Triggered when the call's voice changes.

onVoiceInterrupted

Indicates whether voice interruption is enabled for the current call.

onVoiceInterrupted?(enable: boolean): void

Parameters:

Parameter

Type

Required

Description

enable

boolean

Yes

Specifies whether the feature is enabled.

Return value: void

Note: Triggered when the voice interruption status changes.

onSpeakingInterrupted

The agent's current speech is interrupted.

onSpeakingInterrupted?(reason: ARTCAICallSpeakingInterruptedReason): void

Parameters:

Parameter

Type

Required

Description

reason

ARTCAICallSpeakingInterruptedReason

Yes

The reason.

Return value: void

Note: Triggered when the agent's speech is interrupted.

onPushToTalk

Indicates whether push-to-talk mode is enabled for the current call.

onPushToTalk?(enable: boolean): void

Parameters:

Parameter

Type

Required

Description

enable

boolean

Yes

Enable

Return value: void

Note: Triggered when the push-to-talk mode status changes.

onVoiceprint

Indicates whether voiceprint-based denoising is enabled for the current call.

onVoiceprint?(enable: boolean): void

Parameters:

Parameter

Type

Required

Description

enable

boolean

Yes

Specifies whether the feature is enabled.

Return value: void

Note: Triggered when the status of the voiceprint-based denoising feature changes (invitational preview).

onVoiceprintCleared

The voiceprint data for the current call is purged.

onVoiceprintCleared?(): void

Return value: void

Note: Triggered when the voiceprint data is purged (invitational preview).

onAgentWillLeave

The current agent is about to leave (end the current call).

onAgentWillLeave?(reason: number, message: string): void

Parameters:

Parameter

Type

Required

Description

reason

number

Yes

The reason. 2001: left due to inactivity. 2002: ended due to human takeover. 0: other.

message

string

Yes

A description of the reason.

Return value: void

Note: Triggered when the agent is about to leave.

onReceivedAgentCustomMessage

A custom message is received from the current agent.

onReceivedAgentCustomMessage?(data: Record<string, RecordValueType> | undefined): void

Parameters:

Parameter

Type

Required

Definition

data

Record<string, RecordValueType>

No

The message content.

Return value: void

Note: Triggered when a custom message is received from the agent.

onReceivedAgentVcrResult

A VCR result is received from the current agent.

onReceivedAgentVcrResult?(result: ARTCAICallAgentVcrResult): void

Parameters:

Parameter

Type

Required

Description

result

ARTCAICallAgentVcrResult

Yes

The VCR result.

Return value: void

Note: Triggered when a VCR result is received from the agent.

onHumanTakeoverWillStart

A human is about to take over from the current agent.

onHumanTakeoverWillStart?(takeoverUid: string, takeoverMode: number): void

Parameters:

Parameter

Type

Required

Description

takeoverUid

string

Yes

The UID of the human.

takeoverMode

number

Yes

1: The human's voice is used for output. 0: The agent's voice is used for output.

Return value: void

Note: Triggered when a human is about to take over from the agent.

onHumanTakeoverConnected

The human takeover is connected.

onHumanTakeoverConnected?(takeoverUid: string): void

Parameters:

Parameter

Type

Required

Description

takeoverUid

string

Yes

The UID of the human.

Return value: void

Note: Triggered when the human takeover is successfully connected.

onAudioDelayInfo

Audio loopback delay.

onAudioDelayInfo?(sentenceId: number, delayMs: number): void

Parameters:

Parameter

Type

Required

Description

sentenceId

number

Yes

The sentence ID.

delayMs

number

Yes

The delay in milliseconds.

Return value: void

Note: Triggered when there is information about audio loopback delay.

onVisionCustomCapture

Indicates whether custom frame capture mode is enabled for the current Vision call.

onVisionCustomCapture?(enable: boolean): void

Parameters:

Parameter

Type

Required

Description

enable

boolean

Yes

Enable

Return value: void

Note: Triggered when the status of the custom frame capture mode for a Vision call changes.

onLLMReplyCompleted

The LLM has finished answering in the current call.

onLLMReplyCompleted?(text: string, userAsrSentenceId: number): void

Parameters:

Parameter

Type

Required

Description

text

string

Yes

The text output by the LLM.

userAsrSentenceId

number

Yes

The ID of the sentence that answers the user's question.

Return value: void

Note: Triggered when the LLM finishes answering.

onAudioAccompanyStateChanged

If music accompaniment is played through the RTC instance during the current call, this playback callback is triggered.

onAudioAccompanyStateChanged?(state: ARTCAICallAudioAccompanyState, errorCode: ARTCAICallAudioAccompanyErrorCode): void

Parameters:

Parameter

Type

Required

Description

state

ARTCAICallAudioAccompanyState

Yes

The playback state.

errorCode

ARTCAICallAudioAccompanyErrorCode

Yes

The playback error.

Return value: void

Note: Triggered when the audio accompaniment state changes.

ARTCAICallEngineFactory details

createEngine

Creates a default AICallEngine.

public static createEngine(context : common.Context): ARTCAICallEngineInterface

Parameters:

Parameter

Type

Required

Description

context

common.Context

Yes

The application context.

Return value: ARTCAICallEngineInterface

Note: Creates and returns an AI call engine instance.