Polyv Help Center

Help Center

Publish Smart Subtitles

Updated: 2024-08-27 11:37:46

API Description

1、当智能字幕生成成功或者校验完成后, 发布字幕应用到视频上,或在点播后台智能字幕模块中使用。详见:[智能字幕](__PLV_KEEP_0__)
2、接口支持https协议

API URL

http://api.polyv.net/vod/v4/smart-subtitle/publish

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have a frequency limit. See details

Request Parameter Description

  • URL Parameters
Parameter Required Type Description
appId true String Live streaming appId. You can view your live streaming appId and appSecret in "Cloud Video" -> "Settings" -> "API Interface".
timestamp true Long Current time in milliseconds, valid within 30 minutes.
sign true String Signature, 32-character uppercase MD5 value. See MD5 signature generation rules
  • Body Parameters (JSON)
Parameter Required Type Description
taskId true Long Subtitle task ID.
preferenceEnabled false String Whether the video defaults to the current subtitle after publishing. Y means default, the video will prioritize this subtitle; N means the opposite. If not passed, the pre-configured value of the current subtitle task will be used.

Example

https://api.polyv.net/vod/v4/smart-subtitle/publish?timestamp=1680148356376&appId=XXXXXXXXXX&sign=7E07C6293779BAC60F95DEC2FDDPB353

Parameters:

{
    "taskId": 30,
    "preferenceEnabled": "Y"
}

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See global error description
status String Response status text.
requestId String Unique request identifier. If the API call fails, provide this ID to customer service for troubleshooting.
success boolean true indicates the API call succeeded, false indicates failure.
data Boolean Returns true on success, null on failure. Failure details can be found in the error field.
error Object Description of the API call failure. See error field description

Error Field Description

Parameter Type Description
code Integer Error code. See return error code list
desc String Error description. See return error code list

Return Error Code List

code desc Description
10002 Signature error Signature error. Please check if the interface sign parameter is correctly generated.
10003 Timestamp expired Timestamp has expired.
20003 application not found. appId does not exist. Please check if the appId is passed correctly.
56811 Smart subtitle task status abnormal Publishing is only supported when the subtitle task status is pending verification or pending publishing.

Response Example

Success Example

{
  "code": 200,
  "status": "success",
  "requestId": "f813d5d2359743028b6648e54ade1bf1.55.16801596733770029",
  "data": true,
  "success": true
}

Error Example

Timestamp Expired

{
  "code": 400,
  "status": "error",
  "error": {
    "code": 10003,
    "desc": "时间戳过期"
  },
  "success": false
}

Signature Error

{
  "code": 403,
  "status": "error",
  "error": {
    "code": 10002,
    "desc": "签名错误"
  },
  "success": false
}

Subtitle Task Status Abnormal

{
  "code": 400,
  "status": "error",
  "error": {
    "code": 56811,
    "desc": "智能字幕任务状态异常"
  },
  "success": false
}
联系客服,在线咨询
在线咨询