Authored by xiaofeng.yao@yoho.cn

录播任务改成推流推

... ... @@ -122,12 +122,12 @@ class Video extends \yii\db\ActiveRecord
->one();
$time = time();
//此处有bug,channel_id必须要转成字符串,不然底层会转换成科学计数法的格式
$ret = QcloudApiClient::self()->CreateRecord(strval($qchannel['channel_id']), date('Y-m-d H:i:s',time()+120), '');
file_put_contents("/tmp/live.log",date('Y-m-d H:i:s')."|start ".var_export($ret,true),FILE_APPEND)."\n";
if ($ret['code'] == 0) {
//$ret = QcloudApiClient::self()->CreateRecord(strval($qchannel['channel_id']), date('Y-m-d H:i:s',time()+120), '');
//file_put_contents("/tmp/live.log",date('Y-m-d H:i:s')."|start ".var_export($ret,true),FILE_APPEND)."\n";
if (1) {//$ret['code'] == 0
$this->setAttributes([
'app' => $room['app'],
'task_id' => $ret['task_id'],
'task_id' => 0,//$ret['task_id']
'live_title' => $room['title'],
'live_start_time' => $time,
'live_end_time' => 0,
... ... @@ -171,9 +171,9 @@ class Video extends \yii\db\ActiveRecord
->one();
if ($video) {
//此处有bug,channel_id必须要转成字符串,不然底层会转换成科学计数法的格式
$ret = QcloudApiClient::self()->StopRecord(strval($qchannel['channel_id']), $video['task_id']);
file_put_contents("/tmp/live.log",date('Y-m-d H:i:s')."|stop ".var_export($ret,true),FILE_APPEND)."\n";
if ($ret['code'] == 0) {
//$ret = QcloudApiClient::self()->StopRecord(strval($qchannel['channel_id']), $video['task_id']);
//file_put_contents("/tmp/live.log",date('Y-m-d H:i:s')."|stop ".var_export($ret,true),FILE_APPEND)."\n";
if (1) {//$ret['code'] == 0
$this->setAttributes([
'live_end_time' => time(),
]);
... ...
... ... @@ -150,7 +150,7 @@ class RoomController extends BaseController
if ($result) {
foreach($result as $flow){
$data[] = [
'url' => $flow['upstream_address'],
'url' => $flow['upstream_address'].'&record=flv',
'name' => $flow['title'],
'channel_id' => $flow['channel_id'],
'secret' => $flow['secret'],
... ... @@ -275,10 +275,11 @@ class RoomController extends BaseController
}
public function actionTest(){
// $re = \common\lib\QcloudApi\Client::self()->CreateRecord("16093425727657524184", date('Y-m-d H:i:s',time()+120), '');
$re = \common\lib\QcloudApi\Client::self()->DescribeRecordList("16093425727657524184",1,10);
$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
}
}
... ...