转码服务接口
接口目录
创建并开始转码任务
POST /transcoding/api/create-transcode
JSON 参数
| 参数 | 描述 | 取值 |
|---|---|---|
| origin_url | 转码源文件URL | string |
| task_config_temp_id | (可选,默认原片)转码目标清晰度(1: 360p, 2: 480p, 3: 720p, 4: 1080p, 5: 原片) | int |
| format | (可选,默认 m3u8)转码文件格式 | string |
返回字段
| 参数 | 描述 | 取值 |
|---|---|---|
| errcode | 错误码,1000 为正常 | int |
| msg | "OK" 或错误信息 | string |
| id | 转码任务 ID | string |
返回示例:
{
"id": "17lok52y",
"errcode": 1000
}
获取转码任务列表
GET /transcoding/api/get-transcodes
status 取值如下:
| 值 | 描述 |
|---|---|
| -1 | 默认值 |
| 0 | 等待转码 |
| 1 | 正在转码 |
| 2 | 转码成功(最终状态) |
| 3 | 转码失败 |
| 4 | 已删除 |
URL 参数
| 参数 | 描述 | 取值 |
|---|---|---|
| page | 页数,默认 1 | int |
| limit | 每页个数,默认 15 | int |
返回字段
| 参数 | 描述 | 取值 |
|---|---|---|
| errcode | 错误码,1000 为正常 | int |
| msg | "OK" 或错误信息 | string |
| results | 转码任务列表 | object array |
| results.id | 转码任务 ID | string |
| results.created_at | 创建时间 | string |
| results.updated_at | 修改时间 | string |
| results.task_config_temp_id | 转码清晰度配置1:360, 2:480 3:720 4:1080 5:原片 | int |
| results.origin_url | 转码源文件 URL | string |
| results.target_url | 转码结果文件 URL | string |
| results.format | 转码文件格式 | string |
| results.status | 转码状态 | int |
| results.progress | 转码进度(0.0-1.0) | float |
| results.error_code | 转码错误码 | int |
| results.error_info | 转码错误信息 | string |
| count | 转码任务总个数 | int |
返回示例:
{
"results": [
{
"id": "17lok52y",
"created_at": "2010-11-22T15:16:17+08:00",
"updated_at": "2010-11-22T15:16:17+08:00",
"task_config_temp_id": 1,
"origin_url": "1",
"target_url": "1",
"format": "1",
"status": 1,
"progress": 1,
"error_code": 1,
"error_info": "1"
}
],
"errcode": 1000,
"count": 33
}
获取转码任务信息
GET /transcoding/api/get-transcode
URL 参数
| 参数 | 描述 | 取值 |
|---|---|---|
| id | 转码任务 ID | string |
返回字段
| 参数 | 描述 | 取值 |
|---|---|---|
| errcode | 错误码,1000 为正常 | int |
| msg | "OK" 或错误信息 | string |
| transcoding | 转码任务 | object |
| transcoding.id | 转码任务 ID | string |
| transcoding.created_at | 创建时间 | string |
| transcoding.updated_at | 修改时间 | string |
| transcoding.task_config_temp_id | 转码清晰度配置1:360, 2:480 3:720 4:1080 5:原片 | int |
| transcoding.origin_url | 转码源文件 URL | string |
| transcoding.target_url | 转码结果文件 URL | string |
| transcoding.format | 转码文件格式 | string |
| transcoding.status | 转码状态 | int |
| transcoding.progress | 转码进度(0.0-1.0) | float |
| transcoding.error_code | 转码错误码 | int |
| transcoding.error_info | 转码错误信息 | string |
返回示例:
{
"transcoding": {
"id": "17lok52y",
"created_at": "2010-11-22T15:16:17+08:00",
"updated_at": "2010-11-22T15:16:17+08:00",
"task_config_temp_id": 1,
"origin_url": "1",
"target_url": "1",
"format": "1",
"status": 1,
"progress": 1,
"error_code": 1,
"error_info": "1"
},
"errcode": 1000
}
删除转码任务
POST /transcoding/api/delete-transcode
JSON 参数
| 参数 | 描述 | 取值 |
|---|---|---|
| id | 转码任务 ID | string |
返回字段
| 参数 | 描述 | 取值 |
|---|---|---|
| errcode | 错误码,1000 为正常 | int |
| msg | "OK" 或错误信息 | string |
返回示例:
{
"errcode": 1000
}
批量删除转码任务
POST /transcoding/api/delete-transcodes
JSON 参数
| 参数 | 描述 | 取值 |
|---|---|---|
| ids | 转码任务 ID(用 , 隔开) | string |
返回字段
| 参数 | 描述 | 取值 |
|---|---|---|
| errcode | 错误码,1000 为正常 | int |
| msg | "OK" 或错误信息 | string |
返回示例:
{
"errcode": 1000
}