http://api.polyv.net/v2/video/{userid}/get-live-playback
根据直播频道及场次和视频ID查询直播转存视频相关信息
<?php
$userid="9f1e0689e1";//必选
$channelId=100000;
$ptime=time()*1000;//必选
$sessionId="xxxfjkddk9";
$vid="b0f7041324572aa5df1e91a971d3ec15_b"
$secretkey="secretkey";
$post_data = array (
"channelId" => $channelId,
"ptime" => $ptime,
"vid" => $vid,
"sessionId" => $sessionId
);
$str="";
foreach ($post_data as $key => $value){
if (!empty($value)) {
$str.=$key."=".$value."&";
}else{
unset($post_data[$key]);
}
}
$str=substr($str, 0,strlen($str)-1);
$str.=$secretkey;
// echo $str;
// die();
$hash=strtoupper(sha1($str));
$post_data["sign"] = $hash;
// var_dump($post_data);
// exit();
$url="http://api.polyv.net/v2/video/{$userid}/get-live-playback";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>
{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"vid": "b0f7041324bdb24f8948d44c84364d1b_b",
"fileSize": 91413940,
"fileUrl": "http://dl.videocc.net/b0f7041324/none_b0f7041324bdb24f8948d44c84364d1b_b_1.mp4",
"sessionId": "f5868alc4s",
"type": "alone",
"channelId": 206204
}
]
}
channelId=参数&ptime=参数&sessionId=参数secureKey经过SHA-1加密再经过大写化 (注意:参数为空时,则在生成sign的时候不需要添加此字段。例如如果这里没有t,则不需要拼接&t=参数)