Files
SEONexus/code/app/home/view/videoDadi/video/getVideoPlayUrl.html
2025-05-04 02:40:11 +08:00

414 lines
17 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{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}
{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}
{/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}
{/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}
{/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" />
<!-- 结构化数据 -->
<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}"
}
}
</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="main"}
<div class="container">
<h1 class="view-title">
{site:replace code="VIDEO@GETVIDEOPLAY@H1"}
</h1>
<h4 class="view-description">{site:replace code="VIDEO@GETVIDEOPLAY@TEXT"}</h4>
<div class="row">
<div class="col-lg-wide-75 col-xs-1 padding-0">
<div class="stui-pannel stui-pannel-bg clearfix">
<div class="stui-pannel-box">
<div class="stui-pannel-bd">
<div class="stui-player col-pd">
<div class="stui-player__head">
<span class="pull-right">
<a style="color: rgb(202, 129, 28);" href="/">
<i class="iconfont icon-home"></i>
</a>
</span>
<a style="color: rgb(233, 161, 136);" href="javascript:;"
onclick="window.history.go(-1)">
<i class="iconfont icon-back"></i>
返回
</a>
</div>
<div class="dplayer-prent">
<div id="dplayer" class="dplayer" muted=“muted” style="margin-top: 5px;"></div>
</div>
<div class="stui-player__detail detail">
<ul class="more-btn">
<li>
<a style="color: rgb(204, 180, 44);" href="javascript:;" class="btn btn-default"
onclick="window.location.reload()">
刷新
<i class="icon iconfont icon-refresh hidden-xs"></i>
</a>
</li>
<li>
<a style="color: rgb(14, 41, 1);" class="btn btn-default copylink"
href="javascript:;">
分享
<i class="icon iconfont icon-share hidden-xs"></i>
</a>
</li>
{if $Request.route.intPlayIndex > 1}
<li>
<a style="color: rgb(30, 99, 7);" class="btn btn-default"
href="//{$arrVideo.v_name_en}-1-{$Request.route.intPlayIndex-1}.html">
<i class="icon iconfont icon-back hidden-xs"></i>
上一集
</a>
</li>
{/if}
{if $Request.route.intPlayIndex < 100} <li>
<a style="color: rgb(246, 155, 213);" class="btn btn-default"
href="//{$arrVideo.v_name_en}-1-{$Request.route.intPlayIndex+1}.html">
下一集
<i class="icon iconfont icon-more hidden-xs"></i>
</a>
</li>
{/if}
</ul>
<h1 class="title"><a style="color: rgb(244, 139, 75);"
href="//{$arrVideo.v_name_en}.html">
《{$arrVideo.v_name}》
</a>
</h1>
<p class="data margin-0">
<span class="text-muted">类型:</span>
<a style="color: rgb({:mt_rand(0,255)}, {:mt_rand(0,255)}, {:mt_rand(0,255)});"
href="//-------------.html" target="_blank">{$arrVideo.v_category}</a>
&nbsp;
&nbsp;
<span class="split-line"></span>
<span class="text-muted">地区:</span>
<a style="color: rgb(240, 3, 132)" href="//--{$arrVideo.v_area}-----------.html"
target="_blank">{$arrVideo.v_area}</a>
&nbsp;
<span class="split-line"></span>
<span class="text-muted">年份:</span>
<a style="color: rgb(102, 158, 132)" href="//-------------{$arrVideo.v_year}.html"
target="_blank">{$arrVideo.v_year}</a>
&nbsp;
</p>
</div>
</div>
</div>
</div>
</div>
{foreach $arrVideo.v_play_url as $key=>$arrPlayUrlType }
<div class="stui-pannel stui-pannel-bg clearfix">
<div class="stui-pannel-box b playlist mb">
<div class="stui-pannel_hd">
<div class="stui-pannel__head bottom-line active clearfix"><span
class="more text-muted pull-right">无需安装任何插件</span>
<h3 class="title"><img src="/template/videodadi/icon/icon_30.png">{$key}</h3>
</div>
</div>
<div class="stui-pannel_bd col-pd clearfix">
<ul class="stui-content__playlist clearfix">
{volist name='$arrPlayUrlType' id='arrPlayUrl' key='index'}
<li class="{if $index == $Request.route.intPlayIndex}active{/if}">
<a href="//{$arrPlayUrl.name}-1-{$index}.html" m3u8="{$arrPlayUrl.url}">{$arrPlayUrl.name}</a>
</li>
{/volist}
</ul>
</div>
</div>
</div>
{/foreach}
<div class="stui-pannel stui-pannel-bg clearfix" id="desc">
<div class="stui-pannel-box">
<div class="stui-pannel_hd">
<div class="stui-pannel__head active bottom-line clearfix">
<h3 class="title"><img src="/template/videodadi/icon/icon_30.png">剧情简介</h3>
</div>
</div>
<div class="stui-pannel_bd">
<h3>【{$arrVideo.v_name}】</h3>
<p class="col-pd">  
{$arrVideo.v_description|raw}
<a href="//.html">{}</a>&nbsp;&nbsp;
</p>
</div>
</div>
</div>
<div class="stui-pannel stui-pannel-bg clearfix">
<div class="stui-pannel-box">
<div class="stui-pannel_hd">
<div class="stui-pannel__head active bottom-line clearfix">
<h3 class="title"><img src="/template/videodadi/icon/icon_6.png">猜你喜欢</h3>
</div>
</div>
<div class="stui-pannel_bd">
<ul class="stui-vodlist__bd clearfix">
{video:list count="12" sort_type="news" d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-shu" /}
{/video:list}
</ul>
<ul class="stui-vodlist__text col-pd clearfix hidden-xs">
{video:list count="12" sort_type="news" d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-text2" /}
{/video:list}
</ul>
</div>
</div>
</div>
</div>
<div class="col-lg-wide-25 col-xs-1 stui-pannel-side hidden-sm hidden-xs">
<div class="stui-pannel stui-pannel-bg clearfix">
<div class="stui-pannel-box">
<div class="stui-pannel_hd">
<div class="stui-pannel__head active bottom-line clearfix">
<h3 class="title"><img src="/template/videodadi/icon/icon_12.png">喜剧片周榜单</h3>
</div>
</div>
<div class="stui-pannel_bd">
<ul class="stui-vodlist__text col-pd clearfix">
{video:ranklist count="10" sort_type="weekly" d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-phb" /}
{/video:ranklist}
</ul>
</div>
</div>
</div>
<div class="stui-pannel stui-pannel-bg clearfix">
<div class="stui-pannel-box">
<div class="stui-pannel_hd">
<div class="stui-pannel__head active bottom-line clearfix">
<h3 class="title"><img src="/template/videodadi/icon/icon_12.png">喜剧片月榜单</h3>
</div>
</div>
<div class="stui-pannel_bd">
<ul class="stui-vodlist__text col-pd clearfix">
{video:ranklist count="10" sort_type="weekly" d_key="key" d_val="Video" cache_life="86400"}
{include file="public/video-list-phb" /}
{/video:ranklist}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
{/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;
var intJumpTimeTwoStart = 1;
var intJumpTimeTwoEnd = 1;
var arrPlayUrl = {:json_encode($arrVideo.v_play_url)};
var strPlayUrl = ""
if(strPlayType == 'default'){
strPlayUrl = findFirstUrl(arrPlayUrl)
}else{
var ActivePlayUrl = arrPlayUrl[strPlayType][intPlayUrlIndex - 1]
strPlayUrl = ActivePlayUrl.url
}
document.addEventListener('DOMContentLoaded', function () {
console.log(strPlayUrl)
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}