Skip to content

Commit a5dc475

Browse files
committed
增加一个参数用来组装录播地址
1 parent 90d67bf commit a5dc475

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/Live.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @copyright Copyright (c) 2012 TintSoft Technology Co. Ltd.
55
* @license http://www.tintsoft.com/license/
66
*/
7+
78
namespace aliyun\live;
89

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

62+
/**
63+
* @var string
64+
*/
65+
public $recordDomain;
66+
6167
/**
6268
* @var bool 是否使用安全连接
6369
*/
@@ -92,7 +98,8 @@ class Live extends Component
9298
* 初始化直播组件
9399
* @throws InvalidConfigException
94100
*/
95-
public function init(){
101+
public function init()
102+
{
96103
parent::init();
97104
$this->expirationTime = time() + $this->authTime;
98105
$this->playScheme = $this->secureConnection ? 'https://' : 'http://';
@@ -111,6 +118,10 @@ public function init(){
111118
if (empty ($this->domain)) {
112119
throw new InvalidConfigException ('The "domain" property must be set.');
113120
}
121+
if (empty ($this->recordDomain)) {
122+
throw new InvalidConfigException ('The "domain" property must be set.');
123+
}
124+
114125
}
115126

116127
/**
@@ -381,6 +392,16 @@ public function getPlayScheme()
381392
return $this->playScheme;
382393
}
383394

395+
/**
396+
* 获取录像播放地址
397+
* @param string $uri
398+
* @return string
399+
*/
400+
public function getRecordUrl($uri)
401+
{
402+
return '//' . $this->recordDomain . '/' . $uri;
403+
}
404+
384405
/**
385406
* @return string
386407
*/

0 commit comments

Comments
 (0)