Key Interfaces
1). Initialization
Initialize the SDK with yourappId and appSecret, then obtain a Player instance:
2) Connect to the digital human
Connect using your platformconversationId:
onShow — Digital human is ready to display
onError — Error occurred during connection
| Parameter Name | Type | Description |
|---|---|---|
| msgType | int | Error type |
| msgSubType | int | Sub-error type |
| msg | String | Exception message |
msgType values:
| Value | Description | |
|---|---|---|
| 1000 | Authorization exception | |
| 1001 | Session creation exception | |
| 1002 | Resource retrieval exception | |
| 1010 | IM connection creation failed | |
| 1011 | Rendering service returned exception | |
| 1020 | RTC status exception | |
| 1030 | Rendering service actively closed | |
| 1040 | IM connection lost | |
| 1050 | RTC connection lost |
onVideoTrack — RTC media channel created successfully
Bind your digital human view to the track in this callback
| Parameter Name | Type | Description |
|---|---|---|
| track | VideoTrack | Video media track |
onAudioSamples — Local audio sampling data callback
Use this callback for audio visualization or processing.
onTtsSpeakStart — TTS playback started
onTtsSpeakText — TTS text content
onTtsSpeakStop — TTS playback completed
onSpeakStart — Speaking started
onSpeakText — Spoken text content
onSpeakStop — Speaking completed
onAsrResult — ASR recognition result
3) Drive the digital human to speak with an audio URL
Use a WAV audio URL with 16 kHz sample rate, 16‑bit, mono channel to drive speech| Parameter Name | Type | Description |
|---|---|---|
| wavUrl | String | URL of the WAV audio file |
| interrupt | boolean | Whether to interrupt the current speaking state |
4) Drive the digital human to speak with text
Provide text input. The digital human will speak using the session’s configured voice.| Parameter Name | Type | Description |
|---|---|---|
| text | String | Text for the digital human to speak |
| interrupt | boolean | Whether to interrupt the current speaking state |
5) Q&A Interaction
Ask a question and receive a response from the digital human.| Parameter Name | Type | Description |
|---|---|---|
| text | String | Express your question to the digital human |
| interrupt | boolean | Whether to interrupt the current speaking state |