|
|
@@ -65,6 +65,12 @@ class LiveService extends BaseService
|
|
|
*/
|
|
|
public function getLiveUrl($streamName, $appName = 'xlapp', $playType = 'rtmp', $expireTime = 1440)
|
|
|
{
|
|
|
+ $cachekey = "caches:live:urls:{$streamName}_{$appName}_{$playType}";
|
|
|
+ $datas = RedisService::get($cachekey);
|
|
|
+ if($datas){
|
|
|
+ return $datas;
|
|
|
+ }
|
|
|
+
|
|
|
$playUrls = [];
|
|
|
//未开启鉴权Key的情况下
|
|
|
$pushDomain = ConfigService::make()->getConfigByCode('live_push_url');
|
|
|
@@ -98,12 +104,13 @@ class LiveService extends BaseService
|
|
|
$playUrls['hls'] = 'http://' . $playDomain . '/' . $appName . '/' . $streamName . '.m3u8?auth_key=' . $timeStamp . '-0-0-' . $hlsMd5hash;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- return [
|
|
|
+ $datas = [
|
|
|
'push_url' => $pushUrl,
|
|
|
'play_url' => isset($playUrls[$playType]) ? $playUrls[$playType] : '',
|
|
|
'play_urls' => $playUrls,
|
|
|
];
|
|
|
+ RedisService::set($cachekey, $datas, 1800);
|
|
|
+ return $datas;
|
|
|
}
|
|
|
|
|
|
/**
|