<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\utils\Service\Tencent\TencentIm;

/**
 * 直播接口
 */
class Live extends Api
{
    protected $noNeedLogin = ['im_live_url'];
    protected $noNeedRight = ['*'];

    /**
     * 直播推流和播放地址
     * @return true
     */
    public function im_live_url()
    {
        $push_domain = 'xiaoshanpush.huxiukeji.cn';
        $play_domain = 'xiaoshanplay.huxiukeji.cn';
        $stream_name = 'xiaoshan01';
        $push_key    = '65b5e18d53b58c2df0355f53c404d2ee';
        $im = new TencentIm();
        return $this->success('获取成功',[
            'push_url' => $im->getLivePushUrl($push_domain,$stream_name,$push_key,date('Y-m-d H:i:s',strtotime('+1 day'))),
            'play_url' => $im->getLivePlayUrl($play_domain,$stream_name)
        ]);
    }


}