You need to enable JavaScript to run this app.
导航

火山视频地址获取接口

最近更新时间2023.08.24 11:47:54

首次发布时间2021.08.20 16:54:35

概述

通过内容推荐接口获取到火山来源的视频内容后,通过Vid和GroupId调用接口获取可播放的资源链接,接口如下:

  • 【单个获取视频播放链接】
  • 【批量获取视频播放链接】

此外,支持无需传递Vid参数,即可获取可播放的资源链接,接口如下:

  • 【单个获取视频播放链接(入参无需vid)】
  • 【批量获取视频播放链接(入参无需vid)】

说明

  • 接口使用方式:
    - 视频播放时,调用接口获取播放链接,判断VideoStatus字段,active时为可播放,可避免下发后因内容状态变更导致的链接失效
  • 视频url有效期:
    - 火山视频内容url有效期为一个小时+视频时长,遵从防盗链合规机制,不支持更改
    - 内容创作方式引入的视频内容,视频url有效时长可在视频云配置,需大于60分钟,详见:域名配置 - 访问控制 - 时间戳防盗链
调前准备
  1. 接口鉴权
    详见:接口鉴权
  2. 调用接口
    注意参数 是否必填,并确保 ServiceName、Action、Version 等url信息正确
    详见:下方接口信息
单个获取视频播放链接

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=GetVideoByVid&Version=2021-08-18

请求header:

ServiceName: volc_content_api

url组成:

Host: https://cms.volcengineapi.com

Action: GetVideoByVid

Version: 2021-08-18

请求参数

字段名
字段类型
是否必填
说明
GroupId
number
文章ID
Vid
string
内容推荐接口中返回的视频id
Ssl
bool
是否需要https链接,true:https链接,默认为 false

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
BaseResp
BaseResp
Data
VideoData
响应数据

相关字段取值

VideoStatus
描述
wait_audit
待审核
deleted
已删除
active
可播放,仅该状态下返回视频url

请求示例

{
    "GroupId":12304,
    "Vid":"shilivid"
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "202111021706140101941000965D007307",
        "Action": "GetVideoByVid",
        "Version": "2021-08-18",
        "Service": "volc_content_api",
        "Region": "cn-north-1"
    },
    "Data": {
        "PosterUrl": "https://....",
        "VideoDuration": 312.122,
        "VideoId": "...",
        "VideoList": [
            {
                "Definition": "360p",
                "MainUrl": "....",
                "Size": 6599735,
                "Height": 360,
                "Width": 360
            }
        ],
        "RequestId": "02162938737815900000000000000000000ffff0acc1c0d448cef",
        "VideoStatus": "active"
    },
    "BaseResp": {
        "StatusMessage": "success",
        "StatusCode": 1000
    }
}

异常响应示例

{
	"ResponseMetadata": {
		"RequestId": "202202091840530102121450321703D699",
		"Action": "MGetVideoByVids",
		"Version": "2021-09-01",
		"Service": "volc_content_api",
		"Region": "cn-north-1",
		"Error": {
			"CodeN": 1001,
			"Code": "1001",
			"Message": "vid is illegal"
		}
	},
	"BaseResp": {
		"StatusMessage": "vid is illegal",
		"StatusCode": 1001
	}
}

批量获取视频播放链接

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=MGetVideoByVids&Version=2021-09-01

请求header:

ServiceName: volc_content_api

url组成:

Host: https://cms.volcengineapi.com

Action: MGetVideoByVids

Version: 2021-09-01

请求参数

字段名
字段类型
是否必填
说明
GroupVideos
list<GroupVideo>
文章与vid列表
Ssl
bool
是否需要https链接,true:https链接,默认为 false

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
BaseResp
BaseResp
Data
list<VideoData>
响应数据

相关字段取值

VideoStatus
描述
wait_audit
待审核
deleted
已删除
active
可播放,仅该状态下返回视频url

请求示例

{
    "GroupVideos": [
        {
            "GroupId": 170....,
            "Vid": "...."
        }
    ]
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20210903095110010225146063018E0B0E",
        "Action": "MGetVideoByVids",
        "Version": "2021-09-01",
        "Service": "volc_content_api",
        "Region": "cn-north-1"
    },
    "Data": [
        {
            "PosterUrl": "https://....",
            "VideoDuration": 15.318,
            "VideoId": "...",
            "RequestId": "20210903095110010225146063018E0B0E",
            "VideoStatus": "wait_audit"
        }
    ],
    "BaseResp": {
        "StatusMessage": "success",
        "StatusCode": 1000
    }
}

异常响应示例

{
		"ResponseMetadata": {
		"RequestId": "202202091840530102121450321703D699",
		"Action": "MGetVideoByVids",
		"Version": "2021-09-01",
		"Service": "volc_content_api",
		"Region": "cn-north-1",
		"Error": {
			"CodeN": 1001,
			"Code": "1001",
			"Message": "vid is illegal"
		}
	},
	"BaseResp": {
		"StatusMessage": "vid is illegal",
		"StatusCode": 1001
	}
}

单个获取视频播放链接(入参无需vid)

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=GetVideoByGid&Version=2021-01-01

请求header:

ServiceName: volc_content_api

url组成:

Host: https://cms.volcengineapi.com

Action: GetVideoByGid

Version: 2021-01-01

请求参数

字段名

字段类型

是否必填

说明

GroupId

number

文章ID

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
BaseResp
BaseResp
Data
VideoData
响应数据

请求示例

{
    "GroupId":12304
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "02162938737815900000000000000000000ffff0acc1c0d448cef",
        "Action": "GetVideoByGid",
        "Version": "2021-01-01",
        "Service": "volc_content_api",
        "Region": "cn-north-1"
    },
    "Data": {
        "PosterUrl": "...",
        "VideoDuration": 242.5,
        "VideoId": "shilivid",
        "VideoList": [
            {
                "Definition": "360p",
                "MainUrl": "...",
                "Size": 5405063,
                "Height": 360,
                "Width": 640
            },
            
        ],
        "RequestId": "02162938737815900000000000000000000ffff0acc1c0d448cef",
        "VideoStatus": "active",
        "GroupId": 12304
    },
    "BaseResp": {
        "StatusMessage": "success",
        "StatusCode": 1000
    }
}

异常响应示例

{
    "ResponseMetadata": {
        "RequestId": "02162938737815900000000000000000000ffff0acc1c0d448cef",
        "Action": "GetVideoByGid",
        "Version": "2021-01-01",
        "Service": "volc_content_api",
        "Region": "cn-north-1",
        "Error": {
            "CodeN": 1001,
            "Code": "1001",
            "Message": "gid not exist"
        }
    },
    "Data": null,
    "BaseResp": {
        "StatusMessage": "gid not exist",
        "StatusCode": 1001
    }
}

批量获取视频播放链接(入参无需vid)

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=MGetVideoByGids&Version=2021-01-01

请求header:

ServiceName: volc_content_api

url组成:

Host: https://cms.volcengineapi.com

Action: MGetVideoByGids

Version: 2021-01-01

请求参数

字段名

字段类型

是否必填

说明

GroupIds

list

内容GroupId列表

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
BaseResp
BaseResp
Data
MGetVideoByGidResult
响应数据

请求示例

{
    "GroupIds": [
         170....,
         170....,
    ]
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20210903095110010225146063018E0B0E",
        "Action": "MGetVideoByVids",
        "Version": "2021-09-01",
        "Service": "volc_content_api",
        "Region": "cn-north-1"
    },
    "Data": {
        "Videos":[
            {
                "PosterUrl": "https://....",
                "VideoDuration": 15.318,
                "VideoId": "...",
                "RequestId": "20210903095110010225146063018E0B0E",
                "VideoStatus": "wait_audit"
            }
        ],
        "MissReasons":[
            {
                "GroupId": 1773026091,
                "Reason": "gid_not_exist_or_delete"
            }
        ]
    }
    "BaseResp": {
        "StatusMessage": "success",
        "StatusCode": 1000
    }
}

异常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20230823121200640A4DE69403873CC313",
        "Action": "MGetVideoByGids",
        "Version": "2021-01-01",
        "Service": "volc_content_api",
        "Region": "cn-north-1",
        "Error": {
            "CodeN": 1001,
            "Code": "1001",
            "Message": "gid not exist"
        }
    },
    "Data": null,
    "BaseResp": {
        "StatusMessage": "gid not exist",
        "StatusCode": 1001
    }
}
错误代码

详见:错误代码表 - volc_content_api

注意

若需排查日志,请提供 RequestId