|
|
<style>
@import 'https://638183.freep.cn/638183/web/tz/tz.v3.css';
.pa {
--offsetX: 81px;
--bg: url('https://638183.freep.cn/638183/t24/w7/qgji.webp') no-repeat center/cover;
position: relative; /* 新增:作为视频层的定位容器 */
overflow: hidden; /* 新增:防止视频溢出 */
}
/* 新增:背景视频层样式 */
.bg-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover; /* 保持视频比例并覆盖全屏 */
opacity: 0.4; /* 调整透明度,避免遮挡背景图和内容 */
z-index: -1; /* 放在背景图上方,内容下方 */
pointer-events: none; /* 禁止视频接收鼠标事件,不影响其他操作 */
}
.vid {
width: 15%;
height: auto;
border-radius: 50%;
mix-blend-mode: screen;
cursor: pointer;
box-shadow: 0 0 0 5px rgba(0, 200, 0, .25);
position: relative; /* 确保视频按钮在最上层 */
z-index: 10;
}
/* 确保其他控件在视频层上方 */
.tz-lrc, .tz-bgprog, .tz-fs {
position: relative;
z-index: 10;
}
</style>
<div id="pa" class="pa">
<!-- 新增:背景视频层 -->
<video class="bg-video" autoplay loop muted playsinline>
<source src="https://img.tukuppt.com/video_show/2475824/00/01/90/5b4d5ec6e96e0.mp4" type="video/mp4">
<!-- 降级方案:如果浏览器不支持视频,显示备用图片 -->
<img src="https://638183.freep.cn/638183/t24/w7/qgji.webp" alt="背景图" style="width:100%;height:100%;object-fit:cover;">
</video>
</div>
<script type="module">
import TZ from 'https://638183.freep.cn/638183/web/tz/tz.v3.js';
import lrc2HC from 'https://638183.freep.cn/638183/web/tz/lrc2hc.js';
const tz = TZ.TZ('pa');
const gc = lrc2HC(`[00:00.200]...(清唱过门)\n[00:41.600]白雪 - 千古绝唱\n[01:10.580]人生自古谁无情\n[01:13.210]情到深处天地动\n[01:16.400]人间多少绝唱千古颂\n[01:23.090]莺莺张生红娘子\n[01:26.280]十娘怒沉百宝箱\n[01:29.400]若无真情无绝唱\n[01:36.090]情海无惊波涛凶\n[01:39.090]风流淹没红尘中\n[01:42.340]大浪淘尽多少痴情种\n[01:48.960]雷峰塔呀白娘子\n[01:52.150]红楼梦中梦难醒\n[01:55.340]千古绝唱千古情\n[02:01.840]自古红颜多薄命\n[02:08.280]有情总被无情伤\n[02:14.590]孟姜女哭长城\n[02:19.280]千古绝唱谁人听\n[02:22.640]梁山伯祝英台\n[02:27.510]千古绝唱唱到今\n[02:30.870]孟姜女哭长城\n[02:34.060]千古绝唱谁人听\n[02:37.310]梁山伯祝英台\n[02:40.560]千古绝唱唱到今\n[02:43.810]孟姜女哭长城\n[02:47.000]千古绝唱谁人听\n[02:50.250]梁山伯祝英台\n[02:53.560]千古绝唱唱到今\n[03:55.390]情海无惊波涛凶\n[03:58.390]风流淹没红尘中\n[04:01.640]大浪淘尽多少痴情种\n[04:08.200]雷峰塔呀白娘子\n[04:11.330]红楼梦中梦难醒\n[04:14.640]千古绝唱千古情\n[04:21.200]自古红颜多薄命\n[04:27.550]有情总被无情伤\n[04:34.060]孟姜女哭长城\n[04:38.300]千古绝唱谁人听\n[04:42.050]梁山伯祝英台\n[04:46.740]千古绝唱唱到今\n[04:50.490]孟姜女哭长城\n[04:53.490]千古绝唱谁人听\n[04:56.680]梁山伯祝英台\n[04:59.990]千古绝唱唱到今\n[05:03.240]孟姜女哭长城\n[05:06.430]千古绝唱谁人听\n[05:09.620]梁山伯祝英台\n[05:12.930]千古绝唱唱到今\n[05:16.180]孟姜女哭长城\n[05:19.300]千古绝唱谁人听\n[05:22.620]梁山伯祝英台\n[05:25.800]千古绝唱唱到今`);
tz.add('audio', '', '', { src: 'https://music.163.com/song/media/outer/url?id=27946560' });
tz.add('video', '', 'vid', {
src: 'https://img.tukuppt.com/video_show/2475824/00/01/90/5b4d5ec6e96e0.mp4',
DisablePictureInPicture: 'true'
}).playmp3();
tz.lrc(gc).style('bottom: 60px').style('--border: 0');
tz.bgprog().style('bottom: 20px');
tz.fs().style('right: 20px; top: 20px');
// 新增:处理视频加载和播放兼容性
document.addEventListener('DOMContentLoaded', function() {
const bgVideo = document.querySelector('.bg-video');
// 确保视频在移动设备上也能自动播放
if (bgVideo) {
// 尝试播放视频,如果失败则静音播放(解决部分浏览器限制)
bgVideo.play().catch(err => {
bgVideo.muted = true;
bgVideo.play();
});
// 视频加载完成后调整显示
bgVideo.onloadeddata = function() {
bgVideo.style.opacity = '0.4'; // 确保视频加载后再显示
};
}
});
</script>
|
|