Query Live Recording Video Information by Channel, Session, and Video ID
Updated: 2022-05-16 10:08:41
Interface URL
http://api.polyv.net/v2/video/{userid}/get-live-playback
Interface Description
Query live recording video information by live channel, session, and video ID
Supported Format
JSON
Request Method
POST, GET
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type & Scope | Description |
|---|---|---|---|
| userid | true | string | POLYV user ID |
| ptime | true | string | Current time in milliseconds (13 digits), valid for 3 minutes |
| channelId | false | int | Live channel, e.g., 100000 |
| sessionId | false | string | Live session ID |
| vid | false | string | Video-on-demand video ID. When this field is not empty, other query conditions are ignored |
| sign | true | string | Signature, a 40-character uppercase SHA1 value |
PHP Sample Code
<?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);
?>
Return Result
JSON Example
{
"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
}
]
}
Field Description
| Field | Description |
|---|---|
| code | Return code |
| status | Return status |
| message | Return message |
| vid | Video ID |
| fileSize | File size, in bytes |
| fileUrl | File download URL |
| type | Channel type, alone for standard live, ppt for three-screen |
| sessionId | Live channel session ID |
| channelId | Live channel ID |
Sign Generation Rule
channelId=parameter&ptime=parameter&sessionId=parameter secureKey encrypted with SHA-1 and then converted to uppercase
(Note: If a parameter is empty, it should not be included when generating the sign. For example, if there is no t, do not append &t=parameter)
