|
|
|
@ -745,33 +745,40 @@ Class SiteController extends Controller {
@@ -745,33 +745,40 @@ Class SiteController extends Controller {
|
|
|
|
|
|
|
|
|
|
$cateId = $this->get('pid', ''); |
|
|
|
|
$cacheParentDataId = $this->get('cid', ''); |
|
|
|
|
$page = $this->get('page', 1); |
|
|
|
|
$page = $this->get('page', 0); |
|
|
|
|
$pageSize = $this->get('limit', 100); |
|
|
|
|
|
|
|
|
|
if (empty($videoUrl) || empty($videoId) || empty($cateId) || empty($cacheParentDataId)) { |
|
|
|
|
//增加按年、月查看视频自动播放更多视频支持 |
|
|
|
|
$para_year = $this->get('year', ''); |
|
|
|
|
$para_month = $this->get('month', ''); |
|
|
|
|
|
|
|
|
|
if (empty($videoUrl) || empty($videoId) || empty($cateId)) { |
|
|
|
|
throw new Exception("缺少参数!", 403); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arr = parse_url($videoUrl); |
|
|
|
|
$videoFilename = basename($arr['path']); |
|
|
|
|
|
|
|
|
|
//增加文件后缀格式检查,区分:mp4, mov, m3u8 |
|
|
|
|
//增加文件后缀格式检查,区分:mp4, mov, m3u8, mp3 |
|
|
|
|
$videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION); |
|
|
|
|
$videoSourceType = Html::getMediaSourceType($videoExtension); |
|
|
|
|
|
|
|
|
|
//从缓存数据获取封面图 |
|
|
|
|
$poster = '/img/beauty/audio_bg.jpg'; |
|
|
|
|
$cacheSeconds = 86400; |
|
|
|
|
$cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); |
|
|
|
|
if (!empty($cachedParentData)) { |
|
|
|
|
$mp3 = $cachedParentData[$videoId]; |
|
|
|
|
if (!empty($mp3['snapshot'])) { |
|
|
|
|
$poster = $mp3['snapshot']; |
|
|
|
|
}else { |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$matchedImage = Html::searchImageByFilename($mp3['filename'], $cachedParentData, $imgExts); |
|
|
|
|
if (!empty($matchedImage)) { |
|
|
|
|
$poster = $matchedImage['path']; |
|
|
|
|
|
|
|
|
|
if (!empty($cacheParentDataId)) { |
|
|
|
|
$cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); |
|
|
|
|
if (!empty($cachedParentData)) { |
|
|
|
|
$mp3 = $cachedParentData[$videoId]; |
|
|
|
|
if (!empty($mp3['snapshot'])) { |
|
|
|
|
$poster = $mp3['snapshot']; |
|
|
|
|
}else { |
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
$matchedImage = Html::searchImageByFilename($mp3['filename'], $cachedParentData, $imgExts); |
|
|
|
|
if (!empty($matchedImage)) { |
|
|
|
|
$poster = $matchedImage['path']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -797,7 +804,8 @@ Class SiteController extends Controller {
@@ -797,7 +804,8 @@ Class SiteController extends Controller {
|
|
|
|
|
$params = compact( |
|
|
|
|
'videoUrl', 'videoId', 'videoFilename', |
|
|
|
|
'cateId', 'cacheParentDataId', 'page', 'pageSize', |
|
|
|
|
'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster' |
|
|
|
|
'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster', |
|
|
|
|
'para_year', 'para_month' |
|
|
|
|
); |
|
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
|
} |
|
|
|
|