设置播放器暂停广告
接口描述
1、接口用于设置某频道播放器的暂停广告
2、接口URL中的{channelId}为 频道ID
3、接口支持https
接口URL
http://api.polyv.net/live/v2/channelAdvert/{channelId}/updateStop
请求方式
POST
支持格式
JSON
请求数限制
TRUE
请求参数
参数名
必选
类型
说明
appId
是
string
从API设置中获取,在直播系统登记的appId
timestamp
是
string
当前13位毫秒级时间戳,3分钟内有效
sign
是
string
签名,32位大写MD5值
enabled
否
string
Y-打开,N-关闭;设置开关时,其余设置参数无效
stopAdvertImage
否
string
图片地址,不填代表删除
stopAdvertHref
否
string
点击图片跳转Url
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": true
}
响应失败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": "channel not found.",
"data": ""
}
开关参数错误
{
"code": 400,
"status": "error",
"message": "invalid enabled value",
"data": ""
}
非法请求
{
"code": 403,
"status": "error",
"message": "operation forbidden.",
"data": ""
}
字段说明
参数名
说明
code
请求结果代码,成功为200 错误为400,签名错误为403
status
请求结果,成功时为"success"错误时为"error"
message
错误信息,请求成功时为空串,错误时错误信息
data
请求成功为true,错误为空串
php请求示例
<?php
//引用config.php
include 'config.php';
$stopAdvertImage = "http://www.image.com";
$stopAdvertHref = "http://www.href.com";
$channelId="123713";
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'stopAdvertImage' => $stopAdvertImage,
'stopAdvertHref' => $stopAdvertHref
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url="http://api.polyv.net/live/v2/channelAdvert/".$channelId."/updateStop";
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
$params["sign"] = $sign;
echo post($url, $params);
?>
签名规则(config.php文件代码查看)
Last updated
Was this helpful?