Polyv Help Center

Help Center

Get Channel Pull Stream URL API

Updated: 2023-11-14 14:07:19

API URL

https://api.polyv.net/live/v3/channel/detail/get-pull-url

API Description

1. Get the pull stream URL of a channel
2. The API supports HTTPS protocol

Supported Format

JSON

Request Method

GET, POST

Request Limit

TRUE

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system
timestamp Yes string Current 13-digit millisecond timestamp, valid for 3 minutes
channelId Yes int Channel ID
sign Yes String Signature, a 32-character uppercase MD5 value. The appSecret used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server to obtain response data. See Signature Generation Rules

Successful Response JSON Example:

{
    "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"
    }
}

Failed Response JSON Example:

No appId provided

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Illegal operation

{
    "code": 400,
    "status": "error",
    "message": "illegal operation.",
    "data": ""
}

Field Description

Parameter Description
code Request status response code
status Request status
message Error message
data Returned result
data.flv FLV pull stream URL, string
data.m3u8 M3U8 pull stream URL, string

PHP Request Example

<?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."&timestamp=".$timestamp."&sign=".$sign."&channelId=".$channelId;
//输出接口请求结果
echo file_get_contents($url);

?>
联系客服,在线咨询