This commit is contained in:
make
2025-05-06 00:38:52 +08:00
parent a687e7ea93
commit 1c23e3dc7a
69 changed files with 2525 additions and 1694 deletions

View File

@@ -1,122 +1,125 @@
{extend name="base" /}
{block name="get-data"}
{if $Request.route.intVId}
{video:info v_id="$Request.route.intVId" n_key="arrVideo" n_forge_id="$Request.route.intForgeId" /}
{else}
{video:info v_id="$DomainModel->info_id" n_key="arrVideo" n_forge_id="0" /}
{/if}
{video:info v_id="$Request.route.intVId" v_key="arrVideo" /}
{site:grm page_code="h5_video_info" diff="$arrVideo.v_id" num="120" g_key="arrGrm" /}
{/block}
{block name="title"}
{if $DomainModel->info_id == $Request.route.intVId || empty($Request.route.intVId)}
{site:replace code="INDEX@INDEX@TITLE"}
{else}
{site:replace code="VIDEO@GETVIDEOINFO@TITLE" diff="$Request.route.intVId" /}
{/if}
{site:replace code="VIDEO@GETVIDEOPLAY@TITLE" diff="$Request.route.intVId" /}
{/block}
{block name="keywords"}
{if $DomainModel->info_id == $Request.route.intVId || empty($Request.route.intVId)}
{site:replace code="INDEX@INDEX@KEYWORDS"}
{else}
{site:replace code="VIDEO@GETVIDEOINFO@KEYWORDS" diff="$Request.route.intVId"}
{/if}
{site:replace code="VIDEO@GETVIDEOPLAY@KEYWORDS" diff="$Request.route.intVId"}
{/block}
{block name="description"}
{if $DomainModel->info_id == $Request.route.intVId || empty($Request.route.intVId)}
{site:replace code="INDEX@INDEX@DESCRIPTION"}
{else}
{site:replace code="VIDEO@GETVIDEOINFO@DESCRIPTION" diff="$Request.route.intVId"}
{/if}
{site:replace code="VIDEO@GETVIDEOPLAY@DESCRIPTION" diff="$Request.route.intVId"}
{/block}
{block name="head"}
<!-- 社交媒体标签 -->
<meta property="og:title" content='{site:replace code="VIDEO@GETVIDEOPLAY@TITLE"}' />
<meta property="og:description" content='{site:replace code="VIDEO@GETVIDEOPLAY@DESCRIPTION"}' />
<meta property="og:url" content="https://{$DomainModel->d_domain}" />
<meta property="og:type" content="website" />
<!-- 结构化数据 -->
{// Open Graph 协议用于Facebook、LinkedIn等}
<meta property="og:title" content='{site:replace code="VIDEO@GETVIDEOINFO@TITLE"}'>
<meta property="og:description" content='{site:replace code="VIDEO@GETVIDEOINFO@DESCRIPTION"}'>
{switch $arrVideo.v_parent_category_en }
{case 'dian-ying' }
<meta property="og:type" content="video.movie" />
{/case}
{case 'dian-shi-ju' }
<meta property="og:type" content="video.episode" />
{/case}
{case 'zong-yi' }
<meta property="og:type" content="video.tv_show" />
{/case}
{case 'dong-man' }
<meta property="og:type" content="video.episode" />
{/case}
{case 'duan-ju-da-quan' }
<meta property="og:type" content="video.episode" />
{/case}
{default /}
<meta property="og:type" content="video.movie" />
{/switch}
<meta property="og:url" content='https://{$DomainModel->d_domain}{site:vurl v_id="$arrVideo.v_id" v_py="$arrVideo.v_name_en"/}'>
<meta property="og:image" content="{$arrVideo.v_pic}">
<meta property="og:site_name" content="{$DomainModel->d_name}">
<meta property="og:video:type" content="video/m3u8">
{// Twitter Card用于Twitter/X}
<meta name="twitter:card" content="player">
<meta name="twitter:title" content='{site:replace code="VIDEO@GETVIDEOINFO@TITLE"}'>
<meta name="twitter:description" content='{site:replace code="VIDEO@GETVIDEOINFO@DESCRIPTION"}'>
<meta name="twitter:image" content="{$arrVideo.v_pic}">
{// 结构化数据}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "VideoObject",
"name": "{strVideoName}",
"description": "{strVideoDescription}",
"director": {
"@type": "Person",
"name": "{strVideoDirector}"
},
"actor": {
"@type": "Person",
"name": "{strVideoActor}"
},
"thumbnailUrl": "https://{strSiteDomain}/img/video/{strYear}/{strVideoName}.webp",
"url": "https://{strSiteDomain}/voddetail/{strVideoName}",
"inLanguage": "{strLangName}",
"contentLocation": {
"@type": "Place",
"name": "{strAreaName}"
}
{
"@context": "https://schema.org",
"@type": "VideoObject",
"name": "{$arrVideo.v_name}",
"description": "{$arrVideo.v_description}",
"thumbnailUrl": "{$arrVideo.v_pic}",
"uploadDate": "{:date('y-m-d')}",
"url": 'https://{$DomainModel->d_domain}{site:vurl v_id="$arrVideo.v_id" v_py="$arrVideo.v_name_en"/}',
"inLanguage": [
{volist name='$arrVideo.v_lang' id='strVideoLang' key='index'}
"{$strVideoLang}",
{/volist}
],
"contentLocation": [
{volist name='$arrVideo.v_area' id='strVideoArea' key='index'}
{
"@type": "Place",
"name": "{$strVideoArea}"
},
{/volist}
],
"director": [
{volist name='$arrVideo.v_director' id='strVideoDirector' key='index'}
{
"@type": "Person",
"name": "{$strVideoDirector}"
}
{/volist}
],
"actor": [
{volist name='$arrVideo.v_actor' id='strVideoActor' key='index'}
{
"@type": "Person",
"name": "{$strVideoActor}"
},
{/volist}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{$arrVideo.v_score}",
},
"publisher": {
"@type": "Organization",
"name": "{$DomainModel->d_name}",
}
</script>
}
</script>
{/block}
{block name="head-css"}
<link rel="stylesheet" href="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/dplayer/1.24.0/DPlayer.min.css">
<style type="text/css">
.stui-player__head {
display: none;
}
.dplayer-video-wrap {
max-height: 480px;
}
video {
max-height: 480px;
}
@media (max-width:767px) {
body {
padding-top: 0;
}
.stui-header__top {
display: none;
}
.stui-player__head {
display: block;
padding: 15px;
background-color: #333;
color: #fff;
}
.stui-player__head a {
color: #fff;
}
}
</style>
{/block}
{block name="head-js"}
<script type="text/javascript"
src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/hls.js/1.1.5-0.canary.8257/hls.min.js" defer></script>
<script type="text/javascript" src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/dplayer/1.26.0/DPlayer.min.js"
defer></script>
{/block}
{block name='body-class'}video-play-page{/block}
{block name="main"}
<div class="container">
@@ -268,7 +271,7 @@
sort_type="news"
d_key="d_key" d_val="Video" cache_life="86400"}
{include file="public/video-list-shu" /}
{include file="public/video-list-shu" start="0"/}
{/video:list}
</ul>
@@ -280,7 +283,7 @@
v_year="all"
sort_type="news"
d_key="d_key" d_val="Video" cache_life="86400"}
{include file="public/video-list-text2" /}
{include file="public/video-list-text2" start="0" /}
{/video:list}
</ul>
</div>
@@ -303,7 +306,7 @@
v_parent_category_en="$arrVideo.v_parent_category_en"
sort_type="weekly"
d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-phb" /}
{include file="public/video-list-phb" start="0"/}
{/video:ranklist}
</ul>
</div>
@@ -323,7 +326,7 @@
v_parent_category_en="$arrVideo.v_parent_category_en"
sort_type="monthly"
d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-phb" /}
{include file="public/video-list-phb" start="0"/}
{/video:ranklist}
</ul>
</div>
@@ -346,20 +349,6 @@
'v_category': `{$arrVideo['v_category']}`,
};
</script>
{/block}
{block name="customize"}
<script>
function findFirstUrl(obj) {
for (const key in obj) {
const data = obj[key];
if (Array.isArray(data) && data.length > 0 && data[0].url) {
return data[0].url;
}
}
return null;
}
var intPlayUrlIndex = '{$Request.route.intPlayIndex}'
var strPlayType = '{$Request.route.strPlayType}'
var intJumpTimeFirst = 1;
@@ -367,83 +356,20 @@
var intJumpTimeTwoEnd = 1;
var arrPlayUrl = {$arrVideo.v_play_url|json_encode|raw} ;
var strPlayUrl = ""
if (strPlayType == 'default') {
strPlayUrl = findFirstUrl(arrPlayUrl)
} else {
var ActivePlayUrl = arrPlayUrl[strPlayType][intPlayUrlIndex - 1]
strPlayUrl = ActivePlayUrl.url
}
document.addEventListener('DOMContentLoaded', function () {
initDPlayer(strPlayUrl)
function initDPlayer(strPlayUrl) {
let DomDPlayer = document.getElementById('dplayer')
videoPlayer = new DPlayer({
container: DomDPlayer,
autoplay: true,
screenshot: false,
//logo: dplayerLogo,
video: {
url: strPlayUrl,
type: 'hls',
},
pluginOptions: {
hls: {
maxBufferLength: 600,
},
},
});
videoPlayer.play()
// 监听全屏进入事件
videoPlayer.on('fullscreen', function () {
DomDPlayer.classList.add("dp-fullscreen");
// 设置视频元素的样式,取消 max-height
document.querySelector("video").style.maxHeight = "none";
});
// 监听全屏退出事件
videoPlayer.on('fullscreen_cancel', function () {
DomDPlayer.classList.remove("dp-fullscreen");
// 恢复 max-height 为 480px
document.querySelector("video").style.maxHeight = "480px";
});
videoPlayer.on('error', function () {
});
videoPlayer.on('play', function () {
console.log('play')
// 确保视频准备好后再进行跳转
// setTimeout(() => {
// if (videoPlayer.video.readyState >= 2) {
// // readyState >= 2 表示元数据已加载
// videoPlayer.seek(20); // 跳转到 20 分钟
// }
// }, 1000); // 等待一会儿确保视频已开始
});
// 监听当前播放时间
videoPlayer.on('timeupdate', function () {
if (videoPlayer.video.currentTime < intJumpTimeFirst) { // 当前时间小于 20 秒
videoPlayer.seek(intJumpTimeFirst); // 跳过到 20 秒
}
if (videoPlayer.video.currentTime >= intJumpTimeTwoStart && videoPlayer.video.currentTime < intJumpTimeTwoEnd) { // 当前时间小于 20 秒
videoPlayer.seek(intJumpTimeTwoEnd + 1); // 跳过到 20 秒
}
});
}
})
// 页面加载时执行
// $(document).ready(function () {
// let vod_name = $("h1 a").text();
// let vod_url = window.location.pathname;
// let vod_part = $(".stui-content__playlist .active a").text();
// addHistory(vod_name, vod_url, vod_part)
// history();
// });
</script>
{/block}
{block name="customize"}
{/block}
{block name="footer-js"}
<script type="text/javascript"
src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/hls.js/1.1.5-0.canary.8257/hls.min.js" defer></script>
<script type="text/javascript" src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/dplayer/1.26.0/DPlayer.min.js"
defer></script>
{/block}