发布智能字幕
更新时间:2024-08-27 11:37:46
接口描述
1、当智能字幕生成成功或者校验完成后, 发布字幕应用到视频上,或在点播后台智能字幕模块中使用。详见:[智能字幕](/vod/product/manual/manage/video_subtitle)
2、接口支持https协议
接口URL
http://api.polyv.net/vod/v4/smart-subtitle/publish
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
- URL参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 直播appId。可在"云点播" -> "设置" -> "API接口" 中查看您的直播appId和appSecret |
| timestamp | true | Long | 当前时间的毫秒级时间戳,30分钟内有效 |
| sign | true | String | 签名,32位大写MD5值【详见MD5签名生成规则】 |
- body参数(json)
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| taskId | true | Long | 字幕任务ID |
| preferenceEnabled | false | String | 字幕发布后,视频是否默认首选当前字幕。Y表示默认首选,字幕发布后会对应的视频会优先使用当前字幕,N则相反。如果不传此参数,会读取当前字幕任务预先配置的值 |
示例
https://api.polyv.net/vod/v4/smart-subtitle/publish?timestamp=1680148356376&appId=XXXXXXXXXX&sign=7E07C6293779BAC60F95DEC2FDDPB353
参数:
{
"taskId": 30,
"preferenceEnabled": "Y"
}
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| status | String | 响应状态文本信息 |
| requestId | String | 请求唯一标识,如遇接口调用失败情况,可发此id给客服辅助排查问题 |
| success | boolean | true代表接口调用成功,false代表接口调用失败 |
| data | Boolean | 成功返回true, 失败返回null, 失败描述信息请查看error字段 |
| error | Object | 接口调用失败时的描述信息,【详见error字段说明】 |
error字段说明
返回错误代码列表
| code | desc | 说明 |
|---|---|---|
| 10002 | 签名错误 | 签名错误,请检查接口sign参数是否已经正常生成 |
| 10003 | 时间戳过期 | 时间戳过期 |
| 20003 | application not found. | appId不存在,清检查appId是否正确传值 |
| 56811 | 智能字幕任务状态异常 | 仅当字幕任务状态处于待校验或者待发布状态下才支持发布 |
响应示例
成功示例
{
"code": 200,
"status": "success",
"requestId": "f813d5d2359743028b6648e54ade1bf1.55.16801596733770029",
"data": true,
"success": true
}
异常示例
时间戳过期
{
"code": 400,
"status": "error",
"error": {
"code": 10003,
"desc": "时间戳过期"
},
"success": false
}
签名错误
{
"code": 403,
"status": "error",
"error": {
"code": 10002,
"desc": "签名错误"
},
"success": false
}
字幕任务状态异常
{
"code": 400,
"status": "error",
"error": {
"code": 56811,
"desc": "智能字幕任务状态异常"
},
"success": false
}
