音视频媒资接口
更新时间:2021-03-22
处理媒资接口
接口描述
根据mediaId或者sourceBucket/sourceKey对已经存在于BOS上的媒资按照指定的workflow进行处理。
处理媒资接口内部实现包括两部分功能:
- 创建媒资:提供sourceBucket、sourceKey、title以及description,如果该路径对应的媒资在videoworks中不存在,则创建媒资,生成meidiaId,否则返回已有mediaId,不允许重复创建;
- 处理媒资:使用指定的workflow对媒资进行处理,返回处理对应的实例instanceId。
说明:
1、处理媒资前提:sourceBucket、sourceKey对应的文件在BOS中必须存在;
2、同一个媒资mediaId使用相同的workflowName只允许成功处理一次,如果重复提交,直接返回instanceId;
3、sourceBucket/sourceKey和mediaId两者必选其一,如果都指定,以mediaId为准,会忽略sourceBucket、sourceKey、title和description。
请求(Request)
- 请求语法:
POST /v{version}/media?process HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:
字段名称 | 字段类型 | 必要性 | 字段描述 |
---|---|---|---|
mediaId | String | 可选 | 媒资ID,sourceBucket/sourceKey和mediaId两者必选其一,如果都指定,以mediaId为准,会忽略sourceBucket、sourceKey |
sourceBucket | String | 可选 | 媒资源文件的BOS Bucket,最大长度64字符 |
sourceKey | String | 可选 | 媒资源文件的BOS Key,最大长度1024字符 |
title | String | 必选 | 媒资标题,最大长度256字符 |
description | String | 可选 | 媒资描述,最大长度1024字符 |
workflowName | String | 必选 | 媒资处理对应的工作流名称 |
dynamicParams | String | 可选 | 媒资处理对应工作流的的动态参数,支持覆盖所有静态参数 |
- 请求示例:
POST /v1/media?process HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"sourceBucket":"source bucket",
"sourceKey":"source key",
"title":"media title",
"description":"media description",
"workflowName":"workflow name",
"dynamicParams":"dynamic params"
}
或者
{
"mediaId":"media id",
"workflowName":"workflow name",
"dynamicParams":"dynamic params"
}
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
mediaId | String | 媒资ID |
instanceId | String | 工作流处理实例ID |
- 响应示例:
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 2015 13:34:07 GMT
Content-Type: application/json;charset=UTF-8
{
"mediaId":"mda-gaefib8idcyi36q8",
"instanceId":"ins-jfhgd6wv6atg0x1n"
}
删除媒资接口
接口描述
根据mediaId删除指定媒资,包括媒资经过工作流workflow处理后产出的媒资结果集合。
请求(Request)
- 请求语法
DELETE /v{version}/media/{mediaId} HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
DELETE /v1/media/{mediaId} HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:无
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
批量删除媒资接口
接口描述
根据mediaIds删除媒资,包括媒资经过工作流workflow处理后产出的媒资结果集合。
请求(Request)
- 请求语法
DELETE /v{version}/media?mediaIds={mediaIds} HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
字段名称 | 字段类型 | 必要性 | 字段描述 |
---|---|---|---|
mediaIds | String | 必选 | mediaId列表,逗号分隔 |
DELETE /v1/media?mediaIds=mda-jgmhbbu95yj55xka,mda-jgig3yh0tgumy3yd HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:无
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
更新媒资信息
接口描述
根据mediaId更新指定媒资的描述信息,包括媒资标题和媒资描述。
请求(Request)
- 请求语法
PUT /v{version}/media/{mediaId} HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:
字段名称 | 字段类型 | 必要性 | 字段描述 |
---|---|---|---|
title | String | 可选 | 媒资标题,最大长度256字符,title和description不可同时为空 |
description | String | 可选 | 媒资描述,最大长度1024字符 |
- 请求示例:
PUT /v1/media/{mediaId} HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"title":"media new title",
"description":"media new description"
}
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:无
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
查询媒资接口
接口描述
根据mediaId查询指定媒资信息。
请求(Request)
- 请求语法
GET /v{version}/media/{mediaId} HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
GET /v1/media/{mediaId} HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
mediaId | String | 系统生成的媒资ID |
title | String | 媒资标题 |
description | String | 媒资描述 |
sourceBucket | String | 媒资源文件BOS bucket |
sourceKey | String | 媒资源文件BOS key |
status | Object | 媒资状态,NOMAL/BANNED |
latestInstance | Object | 媒资最近运行实例 |
+ instanceId | String | 系统生成的实例ID |
+ status | Object | 实例状态,READY/RUNNING/SUCCESS/FAILED |
+ workflowId | String | 运行实例关联的工作流ID |
+ mediaId | String | 运行实例关联的媒资ID |
+ sourceBucket | String | 运行实例关联的媒资源文件BOS bucket |
+ sourceKey | String | 运行实例关联的媒资源文件BOS key |
+ createTime | String | 实例创建时间 |
+ updateTime | String | 实例更新时间 |
createTime | String | 媒资创建时间 |
updateTime | String | 媒资更新时间 |
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
{
"mediaId": "mda-jg1c1wkr0swsedak",
"title": "test movie",
"description": "videoworks unit test",
"sourceBucket": "videoworks-source",
"sourceKey": "movie1564107201093.mp4",
"status": "BANNED",
"latestInstance": {
"instanceId": "ins-jg1cr90pv3xzr456",
"status": "SUCCESS",
"workflowId": "wfs-jg1cjwvyeun9zag9",
"mediaId": "mda-jg1c1wkr0swsedak",
"sourceBucket": "videoworks-source",
"sourceKey": "movie1564107201093.mp4",
"createTime": "2019-07-26T02:13:23Z",
"updateTime": "2019-07-26T02:13:33Z"
},
"createTime": "2019-07-26T02:13:23Z",
"updateTime": "2019-07-30T06:21:16Z"
}
查询媒资实例列表
接口描述
根据mediaId查询指定媒资的运行实例列表。
请求(Request)
- 请求语法
GET /v{version}/media/{mediaId}?queryMediaInstanceList HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
GET /v1/media/mda-jghh8q4dtumh3t0k?queryMediaInstanceList HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
instances | MediaInstance[] | 实例列表 |
+ instanceId | String | 实例ID |
+ status | Object | 实例运行状态 |
+ workflowId | String | 实例对应的工作流ID |
+ workflowName | String | 实例对应的工作流名称 |
+ mediaId | String | 媒资ID |
+ sourceBucket | String | 媒资对应的源bucket |
+ sourceKey | String | 媒资对应的源key |
+ createTime | Date | 实例创建时间 |
+ updateTime | Date | 实例更新时间 |
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
{
"instances": [
{
"instanceId": "ins-jg0prijhh1m5emqn",
"status": "RUNNING",
"workflowId": "wfs-jg0mg3dtpnefsfux",
"workflowName": "test_20190725",
"mediaId": "mda-jg0pjpri9w9wjq5a",
"sourceBucket": "videoworks-source",
"sourceKey": "movie1564059914384.mp4",
"createTime": "2019-07-25T13:05:16Z",
"updateTime": "2019-07-25T13:05:16Z"
}
]
}
查询媒资列表(分页机制)
接口描述
根据mediaId查询媒资列表信息。
请求(Request)
- 请求语法
GET /v{version}/media?pageNo={pageNo}&pageSize={pageSize}&status={status}&mediaId={mediaId}&title={title}&beginTime={beginTime}&endTime={endTime}&order={order}&orderBy={orderBy} HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:
字段名称 | 字段类型 | 必要性 | 字段描述 |
---|---|---|---|
pageNo | Integer | 必选 | 第几页,默认第一页 |
pageSize | Integer | 必选 | 每页多少条,最大1000 |
status | String | 可选 | 媒资状态,状态值:NOMAL/BANNED |
mediaId | String | 可选 | 媒资ID |
title | String | 可选 | 媒资title |
beginTime | Date | 可选 | 创建时间下限 |
endTime | Date | 可选 | 创建时间上限 |
order | String | 可选 | 排序方式,ASC或DESC,多个以英文逗号,分隔 |
orderBy | String | 可选 | 排序属性,数量和order一致,多个以英文逗号,分隔 |
- 请求示例:
GET /v1/media?pageNo=3&pageSize=2&status=PUBLISHED&beginTime=2016-04-11T12:18:30Z&endTime=2016-04-13T12:18:30Z HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
data | Media[] | media列表 |
+ mediaId | String | 媒资Id |
+ title | String | 媒资title |
+ status | String | 媒资状态,状态值:NOMAL/BANNED |
+ latestInstanceId | String | 最近的媒资运行实例ID |
+ latestWorkflowId | String | 最近的媒资运行实例对应的工作流ID |
+ latestWorkflowName | String | 最近的媒资运行实例对应的工作流名称 |
+ instanceStatus | String | 最近的媒资运行实例状态 |
+ sourceBucket | String | 媒资源Bucket |
+ sourceKey | String | 媒资源Key |
+ createTime | String | 创建时间 |
+ updateTime | String | 更新时间 |
pageNo | Integer | 第几页 |
pageSize | Integer | 每页多少条 |
totalCount | Integer | 结果总条数 |
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
{
"data":[
{
"mediaId": "mda-jg0p4dtec9n7mahy",
"title": "test movie",
"status": "NORMAL",
"latestInstanceId": "ins-jg0prs9p1zcbx73f",
"latestWorkflowId": "wfs-jg0mg3dtpnefsfux",
"latestWorkflowName": "test_20190725",
"instanceStatus": "SUCCESS",
"sourceBucket": "videoworks-source",
"sourceKey": "movie1564060139853.mp4",
"createTime": "2019-07-25T13:09:01Z",
"updateTime": "2019-07-26T04:29:02Z"
},
{
"mediaId": "mda-jg0pjpri9w9wjq5a",
"title": "测试媒资update",
"status": "NORMAL",
"latestInstanceId": "ins-jg0prijhh1m5emqn",
"latestWorkflowId": "wfs-jg0mg3dtpnefsfux",
"latestWorkflowName": "test_20190725",
"instanceStatus": "RUNNING",
"sourceBucket": "videoworks-source",
"sourceKey": "movie1564059914384.mp4",
"createTime": "2019-07-25T13:05:16Z",
"updateTime": "2019-07-26T04:17:04Z"
}
],
"pageNo":3,
"pageSize":2,
"totalCount":5
}
封禁媒资接口
接口描述
根据mediaId封禁媒资。
请求(Request)
- 请求语法:
PUT /v{version}/media/{mediaId}?ban HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
PUT /v1/media/{mediaId}?ban HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:无
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
解禁媒资接口
接口描述
根据mediaId解禁媒资。
请求(Request)
- 请求语法:
PUT /v{version}/media/{mediaId}?unban HTTP/1.1
x-bce-date: {utc-date-string}
host: bvw.bj.baidubce.com
content-type: application/json
authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
- 请求示例:
PUT /v1/media/{mediaId}?unban HTTP/1.1
x-bce-date: 2015-07-03T09:28:13Z
host: bvw.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Response)
- 响应头域:无特殊Header参数
- 响应参数:无
- 响应示例:
HTTP/1.1 200 OK
x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
Date: Tue, 24 Mar 2015 13:06:02 GMT
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache