设置频道录制文件合并

接口URL

https://api.polyv.net/live/v2/channel/recordFile/{channelId}/merge

接口说明

1、作用:合并频道的录制文件
2、接口支持https协议
3、接口URL中的{channelId}为 频道ID

请求方式

POST

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前13位毫秒级时间戳,3分钟内有效
urls string 要合并的录制文件URL
sign string 签名,为32位大写的MD5值

响应参数

参数名 说明
code 响应状态码
status 响应状态
message 异常错误信息
data code 200的时候放回合并后的文件地址,其他情况返回异常错误信息

响应成功JSON示例

{
  code: 200,
  status: "success",
  message: "",
  data: "http://xxxxx/xkx/xxx.m3u8"
}

响应异常JSON示例,签名错误

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

响应异常JSON示例,appId为空

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

响应异常JSON示例,appId不存在

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

响应异常JSON示例,校验的时间过期

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

响应异常JSON示例,签名错误

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

响应异常JSON示例,频道ID不存在

{
  code: 403,
  status: "error",
  message: "channel not found.",
  data: ""
}

响应异常JSON示例,合并的录制文件url为空

{
  code: 403,
  status: "error",
  message: "urls is required.",
  data: ""
}

PHP请求示例

<?php

//引用config.php
include 'config.php';

//接口需要的参数(非sign)赋值
$channelId = "127075";
$urls="http://xxx.xx/a.mp4,http://xxx.xx/b.mp4";

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'urls' => $urls
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

//接口请求url
$url="https://api.polyv.net/live/v2/channel/recordFile/$channelId/merge?appId=".$appId."&timestamp=".$timestamp."&urls=".$urls."&sign=".$sign;

$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;

?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...