Get WebSocket Drive Info
Description
Through this API, you can obtain a WebSocket connection URL. By transmitting PCM audio data to this URL, you can drive the Digital Human to speak in real-time. The WebSocket drive method allows flexible integration with third-party TTS providers to drive the Digital Human. If you have already integrated a third-party TTS provider or have a preferred provider, this method is recommended.
For the complete process of driving the Digital Human via WebSocket, please refer to Implement Interactive Chat with AI Digital Human.
When using WebSocket audio stream to drive the Digital Human, the Digital Human will interrupt the currently ongoing broadcast task and discard all queued broadcast tasks.
Request prototype
- Request method: POST
- Request body format: JSON
- Request URL: https://aigc-digitalhuman-api.zegotech.cn?Action=DriveByWsStream
- Transmission protocol: HTTPS
- QPS limit: 10 times/second
Request Parameters
The following request parameter list only includes API request parameters and some common parameters. For the complete list of common parameters, please refer to API Calling Methods - Common Request Parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| TaskId | String | Yes | Digital Human video stream task ID. Obtained from the response parameter of the Create Digital Human Video Stream Task API. |
Request Example
-
Request URL:
https://aigc-digitalhuman-api.zegotech.cn?Action=DriveByWsStream &<common-request-parameters> -
Request body:
{ "TaskId": "c54ffce5-e63c-414f-9342-b0777ae8e691" }
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| Code | Number | Return code. 0 indicates success, other values indicate failure. For error codes and response handling recommendations, please refer to Return Codes. |
| Message | String | Description of the request result. |
| RequestId | String | Request ID. |
| └DriveId | String | Digital Human video stream drive task ID. |
| └WssAddress | String | WebSocket connection URL for the Digital Human video stream task. After establishing a connection with the Digital Human API server through this URL, you can transmit PCM audio data to drive the Digital Human to speak. |
Response Example
{
"Code": 0,
"Message": "success",
"RequestId": "9f5228e2-2c90-4faa-aa7e-7ebbf28bbd83",
"Data": {
"DriveId": "9b9c09ef-281d-43d8-807f-e00e71049642",
"WssAddress": "wss://xx.xx.xx.xx:xxx/ws?Token=xxxx"
}
}