获取频道拉流地址接口
更新时间:2023-11-14 14:07:19
接口URL
https://api.polyv.net/live/v3/channel/detail/get-pull-url
接口说明
1、获取频道的拉流地址
2、接口支持https协议
支持格式
JSON
请求方式
GET,POST
请求数限制
TRUE
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
| timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
| channelId | 是 | int | 频道号 |
| sign | 是 | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"flv": "https://pull-huk.videocc.net/recordf/1c6dc3c666201909261628019107.m3u8?auth_key=1584335309-0-0-c0017cb24300497adb87aee6f617fdbd",
"m3u8": "https://pull-huk.videocc.net/recordf/1c6dc3c666201909206162819107.flv?auth_key=1584335309-0-0-7e5e327553f6800c148a485b6a8fff58"
}
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
非法的操作
{
"code": 400,
"status": "error",
"message": "illegal operation.",
"data": ""
}
字段说明
| 参数名 | 说明 |
|---|---|
| code | 请求状态响应码 |
| status | 请求状态 |
| message | 错误信息 |
| data | 返回的结果 |
| data.flv | flv的拉流地址,字符串 |
| data.m3u8 | m3u8的拉流地址,字符串 |
php请求示例
<?php
//引用config.php
include 'config.php';
/接口需要的参数(非sign)赋值
$params = array(
'appId'=>$appId,
'channelId'=>$channelId,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v3/channel/detail/get-pull-url?appId=".$appId."×tamp=".$timestamp."&sign=".$sign."&channelId=".$channelId;
//输出接口请求结果
echo file_get_contents($url);
?>
