diff --git a/conf/app.php b/conf/app.php index 63ec16d..971f473 100644 --- a/conf/app.php +++ b/conf/app.php @@ -54,6 +54,8 @@ $configs = array( 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif', 'svg'), 'supportedVideoExts' => array('mp4', 'mov', 'm3u8'), + 'supportedAudioExts' => array('mp3'), + 'screenshot_start' => 1000, //视频播放页快照截取开始时间,单位:毫秒 'screenshot_expire_seconds' => 315360000, //视频封面图缓存3650天 'small_image_zoom_rate' => 2.5, //缩略图在最小尺寸基础上的放大倍数,以确保清晰度 diff --git a/plugins/Html.php b/plugins/Html.php index 6c42bf1..9aa22bf 100644 --- a/plugins/Html.php +++ b/plugins/Html.php @@ -277,4 +277,18 @@ eof; return $html; } + public static function getMediaSourceType($fileExtension) { + $sourceType = 'video/mp4'; + + if ($fileExtension == 'mov') { + $sourceType = 'video/mp4'; + }else if ($fileExtension == 'm3u8') { + $sourceType = 'application/x-mpegURL'; + }else if ($fileExtension == 'mp3') { + $sourceType = 'audio/mp3'; + } + + return $sourceType; + } + } diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index 601f245..22b7df8 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -5,6 +5,7 @@ require_once __DIR__ . '/../../../lib/DirScanner.php'; require_once __DIR__ . '/../../../plugins/Parsedown.php'; require_once __DIR__ . '/../../../plugins/Common.php'; +require_once __DIR__ . '/../../../plugins/Html.php'; Class SiteController extends Controller { @@ -560,6 +561,8 @@ Class SiteController extends Controller { return $this->renderJson(compact('code', 'msg')); } + //TODO: 增加mp3播放器,以及mp3时长获取 + public function actionPlayer() { $videoUrl = $this->get('url', ''); $videoId = $this->get('id', ''); @@ -576,6 +579,10 @@ Class SiteController extends Controller { $arr = parse_url($videoUrl); $videoFilename = basename($arr['path']); + //增加文件后缀格式检查,区分:mp4, mov, m3u8 + $videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION); + $videoSourceType = Html::getMediaSourceType($videoExtension); + //获取联系方式 $maxScanDeep = 0; //最大扫描目录级数 @@ -596,7 +603,7 @@ Class SiteController extends Controller { $params = compact( 'videoUrl', 'videoId', 'videoFilename', 'cateId', 'cacheParentDataId', 'page', 'pageSize', - 'copyright', 'isAdminIp' + 'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType' ); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/beauty/views/site/player.php b/themes/beauty/views/site/player.php index 6c74a56..6024cba 100644 --- a/themes/beauty/views/site/player.php +++ b/themes/beauty/views/site/player.php @@ -38,7 +38,7 @@ playsinline poster="" id="my-player"> - +
diff --git a/www/girls/README.md b/www/girls/README.md index f2a4f9c..2ef6ba7 100644 --- a/www/girls/README.md +++ b/www/girls/README.md @@ -1,6 +1,6 @@ # 家庭相册 -Machete是一款简单易用的家庭相册系统,可方便更新升级、支持Docker安装。 +Filesite/Machete是一款简单易用的家庭相册系统,可方便更新升级、支持Docker安装。 ## 使用场景