Polyv Help Center

Help Center

Update Smart Subtitle Content

Updated: 2023-06-02 00:25:04

API Description

1、更新智能字幕生成的字幕内容(需先创建字幕任务)
2、接口支持https协议

API URL

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

Request Method

POST

API Constraints

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

Request Parameters

  • URL Parameters
Parameter Required Type Description
appId true String Live streaming appId. You can view your live streaming appId and appSecret in "Cloud VOD" -> "Settings" -> "API Interface"
timestamp true Long Current time in milliseconds, valid for 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 String Subtitle task ID, returned when creating a subtitle task
autoApplyEnabled false String Whether to automatically publish the subtitle after modifying its content. Y means auto-publish, N means not. If not passed, the preconfigured value of the current subtitle task will be used
subtitleName false String Subtitle title, limited to 20 characters. If not passed, the preconfigured value of the current subtitle task will be used
preferenceEnabled false String Whether the video defaults to the current subtitle after publishing. Y means default preference, the corresponding video will prioritize the current subtitle after publishing, N means not. If not passed, the preconfigured value of the current subtitle task will be used
subtitles true List See data field description
Subtitle Content Field Description
Parameter Type Description
start Long Start time of a single subtitle relative to video playback, in milliseconds
end Long End time of a single subtitle relative to video playback, in milliseconds
content String Content of a single subtitle

Example

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

Parameters:

{
    "taskId": 1000,
    "autoApplyEnabled": "Y",
    "subtitleName": "智能字幕",
    "preferenceEnabled": "Y",
    "subtitles": [
        {
            "start": 0,
            "end": 1130,
            "content": "今天,"
        },
        {
            "start": 1210,
            "end": 4340,
            "content": "当我们想在生活中学习一些新知识的时候,"
        },
        {
            "start": 4630,
            "end": 8270,
            "content": "大部分人想到的是去搜索对应的视频教程,"
        },
        {
            "start": 8980,
            "end": 13700,
            "content": "同时越来越多的企业也正在尝试使用视频进行培训。"
        }
    ]
}

Response Parameters

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for 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 successful API call, false indicates failure
data boolean true indicates successful API call, false indicates failure
error Object Description information when the API call fails 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. Check if the sign parameter is correctly generated
10003 Timestamp expired Timestamp expired
20003 application not found. appId does not exist. Check if the appId is passed correctly
56806 File upload failed Failed to save the subtitle file on the server
56810 Subtitle task not found or deleted Subtitle task does not exist or has been deleted
56811 Smart subtitle task status abnormal Common when updating subtitles before the initial parsing is complete, or updating a subtitle task that was created abnormally

Response Example

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "f813d5d2359743028b6648e54ade1bf1.61.16801654871580495",
    "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 Not Found or Deleted

{
    "code": 400,
    "status": "error",
    "requestId": "f813d5d2359743028b6648e54ade1bf1.58.16801655508460503",
    "error": {
        "code": 56810,
        "desc": "字幕任务不存在或已删除"
    },
    "data": null,
    "success": false
}
联系客服,在线咨询
在线咨询