Live.php 851 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use app\utils\Service\Tencent\TencentIm;
  5. /**
  6. * 直播接口
  7. */
  8. class Live extends Api
  9. {
  10. protected $noNeedLogin = ['im_live_url'];
  11. protected $noNeedRight = ['*'];
  12. /**
  13. * 直播推流和播放地址
  14. * @return true
  15. */
  16. public function im_live_url()
  17. {
  18. $push_domain = 'xiaoshanpush.huxiukeji.cn';
  19. $play_domain = 'xiaoshanplay.huxiukeji.cn';
  20. $stream_name = 'xiaoshan01';
  21. $push_key = '65b5e18d53b58c2df0355f53c404d2ee';
  22. $im = new TencentIm();
  23. return $this->success('获取成功',[
  24. 'push_url' => $im->getLivePushUrl($push_domain,$stream_name,$push_key,date('Y-m-d H:i:s',strtotime('+1 day'))),
  25. 'play_url' => $im->getLivePlayUrl($play_domain,$stream_name)
  26. ]);
  27. }
  28. }