|
@@ -472,6 +472,36 @@ class TencentIm extends Module
|
|
|
return $this->success('获取成功', $res);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取直播推流地址
|
|
|
+ * @param string $domain 您用来推流的域名
|
|
|
+ * @param string $streamName 您用来区别不同推流地址的唯一流名称
|
|
|
+ * @param $key 安全密钥
|
|
|
+ * @param $time 过期时间 sample 2016-11-12 12:00:00
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getLivePushUrl(string $domain,string $streamName,$key = null, $time = null)
|
|
|
+ {
|
|
|
+ if($key && $time){
|
|
|
+ $txTime = strtoupper(base_convert(strtotime($time),10,16));
|
|
|
+ //txSecret = MD5( KEY + streamName + txTime )
|
|
|
+ $txSecret = md5($key.$streamName.$txTime);
|
|
|
+ $ext_str = "?".http_build_query(["txSecret"=> $txSecret, "txTime"=> $txTime]);
|
|
|
+ }
|
|
|
+ return "rtmp://".$domain."/live/".$streamName . ($ext_str ?? "");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取直播播放地址
|
|
|
+ * @param string $domain 您用来推流的域名
|
|
|
+ * @param string $streamName 您用来区别不同推流地址的唯一流名称
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getLivePlayUrl(string $domain,string $streamName)
|
|
|
+ {
|
|
|
+ return "rtmp://".$domain."/live/".$streamName;
|
|
|
+ }
|
|
|
+
|
|
|
// 下载最近消息记录
|
|
|
public function get_history($MsgTime,$ChatType = 1)
|
|
|
{
|