CreateRtcAsrTask
Creates a real-time subtitle task to transcribe an audio stream into text in real time.
Operation description
This operation is currently in maintenance mode. Use intelligent workflows to implement this capability. For more information, see Intelligent workflow configuration.
QPS limit
The single-user QPS limit for this operation is 20 calls per second. If this limit is exceeded, API calls are throttled, which may affect your business. Call this operation appropriately.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
live:CreateRtcAsrTask |
create |
*Domain
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID. |
cn-shanghai |
| Mode |
string |
Yes |
The stream mode. Valid values: live and rtc. The value live indicates a standard live stream such as RTMP. Valid values:
|
live |
| SDKAppID |
string |
No |
The ApsaraVideo Real-time Communication application ID. Note
This parameter is required when Mode is set to rtc. Otherwise, this parameter does not take effect. |
appId |
| ChannelID |
string |
No |
The channel ID. Note
This parameter is required when Mode is set to rtc. Otherwise, this parameter does not take effect. |
channelId |
| RtcUserId |
string |
No |
The stream ingest user ID. Note
This parameter is required when Mode is set to rtc. Only one value can be specified. Otherwise, this parameter does not take effect. |
user1 |
| StreamURL |
string |
No |
The streaming URL. Note
This parameter is required when Mode is set to live. Otherwise, this parameter does not take effect. |
rtmp://xxx |
| Language |
string |
Yes |
The language of the source audio. Valid values:
|
cn |
| CallbackURL |
string |
Yes |
The callback URL. |
http://xxx.com |
| AuthKey |
string |
No |
The authentication key used to generate the MD5 signature for callback information. Note
Two authentication fields are added to the request header during callback: "SIG-TIME" indicates the current timestamp, and "ASR-SIG" indicates the MD5 authentication field. The "ASR-SIG" field is generated by the rule md5( |
abcd |
| TranslateEnabled |
boolean |
No |
Specifies whether to enable translation. |
true |
| TargetLanguages |
string |
No |
The target translation language. Valid values:
|
en |
| AutoTerminateEnabled |
boolean |
No |
Specifies whether to automatically close the task when the stream disconnection exceeds the maximum delay. Default value: false. |
true |
| AutoTerminateDelay |
integer |
No |
The automatic stream disconnection delay, in seconds. Valid values: 1 to 10. |
5 |
| ReportInterval |
integer |
No |
The callback reporting interval, in milliseconds. Valid values: -1 to 500.
|
5 |
Callback example
The JSON-formatted data is placed in the request body and sent as an HTTP POST request to the specified CallbackUrl. For more information about the callback parameter Content and the callback process, see Interaction process and implementation. Example:
{
"task_id": "asr-cf8c70d7-3b8d-496c-98f8-4785******",
"sdk_app_id": "",
"channel_id": "",
"rtc_user_id": "",
"callback_time_stamp": 1723433155645,
"language": "cn",
"content": "{\"header\":{\"nls_task_id\":\"af95c5cc332549f689f3153bc9******\",\"task_key\":\"tl_2977564_17234*****\",\"namespace\":\"SpeechTranscriber\",\"name\":\"TranscriptionResultChanged\",\"task_id\":\"413937911b874146b5796******\",\"message_id\":\"abfc9e9994e748a38499e1******\",\"status_text\":\"Success.\",\"status\":20000000},\"payload\":{\"result\":\"在这里与各位相聚\",\"confidence\":0.0,\"words\":[{\"startTime\":0,\"text\":\"在这\",\"endTime\":510},{\"startTime\":510,\"text\":\"里与\",\"endTime\":1020},{\"startTime\":1020,\"text\":\"各位\",\"endTime\":1530},{\"startTime\":1530,\"text\":\"相聚\",\"endTime\":2040}],\"index\":0,\"time\":2040,\"fixed_result\":\"\",\"unfixed_result\":\"\",\"status\":0}}"
}
```.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Description |
string |
The result description. The value success indicates a successful operation. An error message is returned if a fault occurs. |
success |
| RequestId |
string |
The gateway request ID. |
7FF5417D-06E9-5A2C-9A70-581F6149E6C1 |
| RetCode |
integer |
The status code. A value of 2000 indicates success. Other values indicate exceptions. |
2000 |
| TaskId |
string |
The generated task ID. |
asr-a6ac15e0-9118-4b4c-9e64-306163a0**** |
Examples
Success response
JSON format
{
"Description": "success",
"RequestId": "7FF5417D-06E9-5A2C-9A70-581F6149E6C1",
"RetCode": 2000,
"TaskId": "asr-a6ac15e0-9118-4b4c-9e64-306163a0****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.