保利威文档中心

幫助中心

取得頻道拉流位址介面

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

?>
联系客服,在线咨询