Skip to content

Commit

Permalink
增加一个参数用来组装录播地址
Browse files Browse the repository at this point in the history
  • Loading branch information
xutl committed May 5, 2017
1 parent 90d67bf commit a5dc475
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/Live.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (c) 2012 TintSoft Technology Co. Ltd.
* @license http://www.tintsoft.com/license/
*/

namespace aliyun\live;

use yii\base\Component;
Expand Down Expand Up @@ -58,6 +59,11 @@ class Live extends Component
*/
public $pushDomain = 'video-center.alivecdn.com';

/**
* @var string
*/
public $recordDomain;

/**
* @var bool 是否使用安全连接
*/
Expand Down Expand Up @@ -92,7 +98,8 @@ class Live extends Component
* 初始化直播组件
* @throws InvalidConfigException
*/
public function init(){
public function init()
{
parent::init();
$this->expirationTime = time() + $this->authTime;
$this->playScheme = $this->secureConnection ? 'https://' : 'http://';
Expand All @@ -111,6 +118,10 @@ public function init(){
if (empty ($this->domain)) {
throw new InvalidConfigException ('The "domain" property must be set.');
}
if (empty ($this->recordDomain)) {
throw new InvalidConfigException ('The "domain" property must be set.');
}

}

/**
Expand Down Expand Up @@ -381,6 +392,16 @@ public function getPlayScheme()
return $this->playScheme;
}

/**
* 获取录像播放地址
* @param string $uri
* @return string
*/
public function getRecordUrl($uri)
{
return '//' . $this->recordDomain . '/' . $uri;
}

/**
* @return string
*/
Expand Down

0 comments on commit a5dc475

Please sign in to comment.