1. Initialization
Initialize the module with the appId and appSecret provided in your platform account and get the Play object2. Connect to Digital Human
Connect to the digital human using the conversationId provided by your platform accountonShow Digital human is ready to display
onError Exception occurred when connecting to digital human
| Parameter Name | Type | Description |
|---|---|---|
| msgType | int | Error type |
| msgSubType | int | Sub-error type |
| msg | String | Exception message |
| 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 the digital human widget to the track in this callback
| Parameter Name | Type | Description |
|---|---|---|
| track | VideoTrack | Video media channel |
onAudioSamples Local audio sampling data callback
You can implement audio visualization and other operations in this callback
onTtsSpeakStart Digital human starts playing TTS synthesized audio
onTtsSpeakText Text content of TTS played by digital human
onTtsSpeakStop TTS text playback completed
onSpeakStart Digital human starts speaking
onSpeakText Text content spoken by digital human
onSpeakStop Digital human finished speaking
onAsrResult ASR recognition content callback
3. Drive Digital Human to Speak with Audio URL
Use a WAV audio URL with 16kHz sampling rate, 16bit, mono channel to drive the digital human to speak| Parameter Name | Type | Description |
|---|---|---|
| wavUrl | String | Network address of WAV audio |
| interrupt | boolean | Whether to interrupt the current speaking state |
4. Drive Digital Human to Speak with Text
Input the text that you want the digital human to say, and the digital human will say the corresponding content according to the voice configured in the session.| Parameter Name | Type | Description |
|---|---|---|
| text | String | Text content for the digital human to say |
| interrupt | boolean | Whether to interrupt the current speaking state |
5. Digital Human Q&A
Let the digital human answer your questions.| Parameter Name | Type | Description |
|---|---|---|
| text | String | Express your question to the digital human |
| interrupt | boolean | Whether to interrupt the current speaking state |