CreateRtcAsrTask

Updated at:
Copy as MD

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

live:CreateRtcAsrTask

create

*Domain

acs:live:*:{#accountId}:domain/{#DomainName}

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:

  • rtc :

    rtc mode.

  • live :

    live mode.

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:

  • ja: Japanese.

  • yue: Cantonese.

  • fspk: Chinese-English free speech.

  • en: English.

  • cn: Chinese.

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(${SIG-TIME}/${callbackurl}/${authKey}).

abcd

TranslateEnabled

boolean

No

Specifies whether to enable translation.

true

TargetLanguages

string

No

The target translation language. Valid values:

  • cn: Chinese.

  • en: English.

  • ja: Japanese.

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.

  • -1: Does not accept intermediate results. Only full-sentence callbacks are accepted.

  • 0 or not set: Reports callback results in real time.

  • <=500 milliseconds: Reports callback results at periodic intervals.

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.