Authored by xiaofeng.yao@yoho.cn

推流端增加秘钥获取推流地址接口

... ... @@ -298,19 +298,60 @@ class RoomController extends BaseController
$this->renderJson(Yii::$app->params['success_code'],'',$list);
}
public function actionLog(){
$message = "test";
$level = "";
Yii::$app->log->getLogger()->log($message, $level);
}
public function actionTest(){
// $re = \common\lib\QcloudApi\Client::self()->CreateRecord("16093425727657864680", date('Y-m-d H:i:s',time()+120), '');
$re = \common\lib\QcloudApi\Client::self()->DescribeRecordList("16093425727657864680",1,10);
// $re = \common\lib\QcloudApi\Client::self()->StopRecord("16093425727657524184", "131525");
var_dump($re);
//http://200013340.vod.myqcloud.com/200013340_6e79da1e65d140d887cdbb7f3ebadf79.f20.mp4
/**
* 获取推流房间
* -二期推流需求
* @return [type] [description]
*/
public function actionGetpushroom()
{
$requests = $this->requests();
$secret = $requests['secret'];
do{
if(empty(trim($requests['secret']))){
$retArr = [
'code' => Yii::$app->params['failed_code'],
'messsage' => '缺少密钥'
];
break;
}
if($model = Room::findOne(['secret'=>$secret])){
if($model->living==1){
$retArr = [
'code' => Yii::$app->params['failed_code'],
'messsage' => '该房间正在直播中'
];
break;
}
$channel_id = $upstream_address = '';
if($model->roomQchannel){
$channel_id = $model->roomQchannel->channel_id;
$upstream_address = $model->roomQchannel->upstream_address;
}
$retArr = [
'code' => Yii::$app->params['success_code'],
'messsage' => '',
'data' => [
'url' => $upstream_address.'&record=flv',
'name' => $model->title,
'channel_id' => $channel_id,
'secret' => $model->secret,
'cid' => '',
'app' => '1',
'id' => $model->room_id,
'type' => $model->living,
]
];
}else{
$retArr = [
'code' => Yii::$app->params['failed_code'],
'messsage' => '房间不存在'
];
}
break;
}while (true);
$this->renderJson($retArr['code'], $retArr['messsage'], isset($retArr['data']) ? $retArr['data']:'');
}
/**
... ...