Creates a live subtitle task to transcribe an audio stream to text in real time.
Operation description
This API is currently under maintenance. We recommend using a smart workflow to implement this feature. For more information, see Configure a smart workflow.
QPS limit
The QPS (queries per second) limit for this API is 20 for each user. API calls that exceed this limit are throttled, which may disrupt your service. Call this API at a reasonable rate to prevent service disruptions.
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 ID of the region. |
cn-shanghai |
| Mode |
string |
Yes |
The stream type. Valid values: |
live |
| SDKAppID |
string |
No |
The ARTC application ID. Note
This parameter is required and takes effect only when |
appId |
| ChannelID |
string |
No |
The channel ID. Note
This parameter is required and takes effect only when |
channelId |
| RtcUserId |
string |
No |
The ID of the user publishing the audio stream. Note
This parameter is required and takes effect only when |
user1 |
| StreamURL |
string |
No |
The streaming URL. Note
This parameter is required and takes effect only when |
rtmp://xxx |
| Language |
string |
Yes |
The source language of the audio stream. Valid values:
|
cn |
| CallbackURL |
string |
Yes |
The URL to receive transcription results. |
http://xxx.com |
| AuthKey |
string |
No |
The key for generating the callback MD5 signature. Note
During callbacks, two headers are added to the request for authentication: |
abcd |
| TranslateEnabled |
boolean |
No |
Specifies whether to enable translation. |
true |
| TargetLanguages |
string |
No |
The target language for translation. Valid values:
|
en |
| AutoTerminateEnabled |
boolean |
No |
Specifies whether to automatically terminate the task if a stream interruption exceeds the |
true |
| AutoTerminateDelay |
integer |
No |
The maximum duration of a stream interruption, in seconds, before the task is automatically terminated. This parameter applies only when |
5 |
| ReportInterval |
integer |
No |
The interval for sending transcription results to your callback URL. Unit: milliseconds. Range: -1 to 500.
|
5 |
Sample callback
The service POSTs transcription results as a JSON request body to your callback URL. For details about the Content parameter and the callback process, see Interaction flow and implementation. The following is an example of a callback payload:
{
"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\":\"Meeting with you all here\",\"confidence\":0.0,\"words\":[{\"startTime\":0,\"text\":\"Meeting\",\"endTime\":510},{\"startTime\":510,\"text\":\"with\",\"endTime\":1020},{\"startTime\":1020,\"text\":\"you all\",\"endTime\":1530},{\"startTime\":1530,\"text\":\"here\",\"endTime\":2040}],\"index\":0,\"time\":2040,\"fixed_result\":\"\",\"unfixed_result\":\"\",\"status\":0}}"
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Description |
string |
|
success |
| RequestId |
string |
The request ID. |
7FF5417D-06E9-5A2C-9A70-581F6149E6C1 |
| RetCode |
integer |
|
2000 |
| TaskId |
string |
The 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.