public function testPublishUrl() { $_SERVER['override_qiniu_auth_time'] = true; $a = \Qiniu\Pili\RTMPPublishURL("publish-rtmp.test.com", "thub", "tkey", 3600, "123", "abc"); $this->assertEquals($a, "rtmp://publish-rtmp.test.com/thub/tkey?e=1234571490&token=123:qXis9DxDwd1ZUej6Fh6f47goib4="); unset($_SERVER['override_qiniu_auth_time']); }
try { //保存直播数据 echo "================Save stream:\n"; $fname = $stream->save(1463217523, 1463303923); print_r($fname); } catch (\Exception $e) { echo "Error:", $e, "\n"; } try { //查询推流历史 echo "================Get stream history record:\n"; $records = $stream->historyActivity(1463217523, 1463303923); print_r($records); } catch (\Exception $e) { echo "Error:", $e, "\n"; } //RTMP 推流地址 $url = Qiniu\Pili\RTMPPublishURL("publish-rtmp.test.com", $hubName, $streamKey, 3600, $ak, $sk); echo $url, "\n"; //RTMP 直播放址 $url = Qiniu\Pili\RTMPPlayURL("live-rtmp.test.com", $hubName, $streamKey); echo $url, "\n"; //HLS 直播地址 $url = Qiniu\Pili\HLSPlayURL("live-hls.test.com", $hubName, $streamKey); echo $url, "\n"; //HDL 直播地址 $url = Qiniu\Pili\HDLPlayURL("live-hdl.test.com", $hubName, $streamKey); echo $url, "\n"; //截图直播地址 $url = Qiniu\Pili\SnapshotPlayURL("live-snapshot.test.com", $hubName, $streamKey); echo $url, "\n";