查询智能字幕内容
接口描述
1、通过字幕任务id,查询视频字幕的链接和字幕内容(需先创建字幕任务)
2、接口支持https协议
接口URL
http://api.polyv.net/vod/v4/smart-subtitle/get
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
URL参数
参数名
必选
类型
说明
appId
true
String
直播appId。可在"云点播" -> "设置" -> "API接口" 中查看您的直播appId和appSecret
timestamp
true
Long
当前时间的毫秒级时间戳,30分钟内有效
taskId
true
Long
字幕任务id,创建字幕任务时会返回此id
示例
https://api.polyv.net/vod/v4/smart-subtitle/get
响应参数描述
data字段说明
参数名
类型
说明
taskId
Long
字幕任务id
link
String
字幕链接
autoApplyEnabled
String
是否在字幕生成后自动应用字幕到对应的视频上, Y表示自动应用字幕, N表示不自动应用字幕
subtitleName
String
字幕标题
preferenceEnabled
String
是否是默认首选的视频字幕, Y代表默认首选, N则相反
字幕内容字段说明
参数名
类型
说明
start
Long
单条字幕相对视频播放的开始时间,单位是毫秒
end
Long
单条字幕相对视频播放的结束时间,单位是毫秒
content
String
单条字幕的内容
error字段说明
返回错误代码列表
code
desc
说明
10002
签名错误
签名错误,请检查接口sign参数是否已经正常生成
10003
时间戳过期
时间戳过期
20003
application not found.
appId不存在,清检查appId是否正确传值
56810
字幕任务不存在或已删除
字幕任务不存在或者字幕任务已经被删除
56812
字幕正在生成中, 清稍后再试
解析视频的字幕任务未完成
响应示例
成功示例
{
"code": 200,
"status": "success",
"requestId": "f813d5d2359743028b6648e54ade1bf1.60.16801640807450383",
"data": {
"taskId": 1120,
"link": "https://img.videocc.net/usrt/8/833584471d/srt/55016df7-2381-41b7-b594-bf3e5f058561.srt",
"autoApplyEnabled": "N",
"subtitleName": "智能字幕",
"preferenceEnabled": "Y",
"subtitles": [
{
"start": 0,
"end": 1130,
"content": "今天,"
},
{
"start": 1210,
"end": 4340,
"content": "当我们想在生活中学习一些新知识的时候,"
},
{
"start": 4630,
"end": 8270,
"content": "大部分人想到的是去搜索对应的视频教程,"
},
{
"start": 8980,
"end": 13700,
"content": "同时越来越多的企业也正在尝试使用视频进行培训。"
}
]
},
"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",
"requestId": "f813d5d2359743028b6648e54ade1bf1.53.16801641320540391",
"error": {
"code": 56810,
"desc": "字幕任务不存在或已删除"
},
"data": null,
"success": false
}
Last updated
Was this helpful?