接口文档
HTTP 接口
创建云剪辑
POST /media_editor/api/create_editor
JSON 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| title | 云剪辑标题 | string | 
| media_api_url | 资源库来源 URL(可选,默认获取用户所在媒体库的视频) | string | 
| media_api_url_type | 资源库视频类型(default 或 iframe,默认为 default) | string | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
| editor_id | 云剪辑 ID | string | 
返回示例:
{
    "editor_id": "17lok52y",
    "errcode": 1000,
    "msg": "OK"
}
注:当media_api_url_type值为'iframe'时,云剪辑页面会弹出一个页面让用户选择视频资源,这个页面地址是media_api_url;当media_api_url_type为其他值或者为空时,云剪辑会通过api请求的方式请求'media_api_url'地址,然后展示给用户来选择视频;
media_api_url 作为接口地址的规范
假设 media_api_url 为 http://yourserver.com/choose_video
云剪辑进行GET分页请求 http://yourserver.com/choose_video?page=1&page_size=10,其中page为每次分页的页码, page_size为每页视频数量,现在的值是10;服务器需要返回一个json,格式如下,
其中count为视频总数量,videos为当前页码的视频列表,thumb_url为视频封面,video_name为视频名称, video_duration为视频时长(单位为毫秒),video_url为视频地址。
{
    "count": 23,
    "videos": [
        {
            "video_name": "视频名称",
            "video_url": "https://myun-hw-s3.myun.tv/d5vjn158/5z8426v5/livebroadcast/e54dxnk5-1557195190-t.flv",
            "thumb_url": "https://myun-hw-s3.myun.tv/d5vjn158/5peovgbl/1557196305805672054.jpg",
            "video_duration": 1105065
        }
    ]
}
media_api_url 作为iframe页面地址的规范
云剪辑打开iframe页面时,会以宽932px,高579px的大小打开,所以iframe页面应该尽可能的适配这个尺寸。
当用户选择完视频后,iframe页面需要进行postMessage将选择后的视频列表信息传给云剪辑页面,然后关闭当前iframe页面,例子如下:
// 用户选择完成后
// selectVideos为用户选择的视频列表
var selectVideos = [
    {
        "video_name": "视频名称",
        "video_url": "https://myun-hw-s3.myun.tv/d5vjn158/5z8426v5/livebroadcast/e54dxnk5-1557195190-t.flv",
        "thumb_url": "https://myun-hw-s3.myun.tv/d5vjn158/5peovgbl/1557196305805672054.jpg",
        "video_duration": 1105065
    }
]
window.opener.postMessage(selectVideos, '*')
window.close()
获取一页云剪辑
GET /media_editor/api/list_editors
URL 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| page | 页数,默认 1 | int | 
| page_size | 每页个数,默认 15 | int | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
| editors | 云剪辑列表 | object array | 
| editors.editor_id | 云剪辑 ID | int | 
| editors.created_at | 创建时间 | string | 
| editors.updated_at | 更新时间 | string | 
| editors.title | 云剪辑标题 | string | 
| editors.canvas_width | 画布宽 | int | 
| editors.canvas_height | 画布高 | int | 
| editors.media_api_url | 用于获取媒体库视频列表 | string | 
| editors.m3u8_url | 用于播放器播放预览视频 | string | 
| editors.duration | 当前剪辑的视频时长(毫秒) | int | 
| editors.json_config | 剪辑内容(前端单独查询时返回) | string | 
| count | 总个数 | int | 
注意:画布宽高只支持720P
返回示例:
{
    "count": 33,
    "editors": [
        {
            "editor_id": "17lok52y",
            "created_at": "2010-11-22 15:16:17",
            "updated_at": "2010-11-22 15:16:17",
            "title": "1",
            "canvas_width": 1280,
            "canvas_height": 720,
            "media_api_url": "1",
            "m3u8_url": "1",
            "duration": 1
        }
    ],
    "errcode": 1000,
    "msg": "OK"
}
分享云剪辑
POST /media_editor/api/share_editor
URL 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| editor_id | 云剪辑 ID | string | 
JSON 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| expired_at | 过期时间,Unix 时间戳(秒) | int | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
| shared_key | 分享校验 key | string | 
| shared_url | 分享的云剪辑链接 | string | 
返回示例:
{
    "errcode": 1000,
    "msg": "OK",
    "shared_key": "xxx",
    "shared_url": ""
}
删除云剪辑
POST /media_editor/api/delete_editor
URL 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| editor_id | 云剪辑 ID | string | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
返回示例:
{
    "errcode": 1000,
    "msg": "OK"
}
获取一个云剪辑
GET /media_editor/api/get_editor
URL 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| editor_id | 云剪辑 ID | string | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
| editor | 云剪辑 | object | 
| editor.editor_id | 云剪辑 ID | int | 
| editor.created_at | 创建时间 | string | 
| editor.updated_at | 更新时间 | string | 
| editor.title | 云剪辑标题 | string | 
| editor.canvas_width | 画布宽 | int | 
| editor.canvas_height | 画布高 | int | 
| editor.media_api_url | 用于获取媒体库视频列表 | string | 
| editor.m3u8_url | 用于播放器播放预览视频 | string | 
| editor.duration | 当前剪辑的视频时长(毫秒) | int | 
| editor.json_config | 剪辑内容(前端单独查询时返回) | string | 
返回示例:
{
    "editor": {
        "editor_id": "17lok52y",
        "created_at": "2010-11-22 15:16:17",
        "updated_at": "2010-11-22 15:16:17",
        "title": "1",
        "canvas_width": 1,
        "canvas_height": 1,
        "media_api_url": "1",
        "m3u8_url": "1",
        "duration": 1,
        "json_config": "1"
    },
    "errcode": 1000,
    "msg": "OK"
}
更新云剪辑
POST /media_editor/api/update_editor
URL 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| editor_id | 云剪辑 ID | string | 
JSON 参数
| 参数 | 描述 | 取值 | 
|---|---|---|
| title | 云剪辑名称 | string | 
| media_api_url | 从何处导入视频资源 | string | 
| media_api_url_type | 资源库视频类型(default 或 iframe,默认为 default) | string | 
返回字段
| 参数 | 描述 | 取值 | 
|---|---|---|
| errcode | 错误码,1000 为正常 | int | 
| msg | "OK" 或错误信息 | string | 
返回示例:
{
    "errcode": 1000,
    "msg": "OK"
}