Files
o.nmgjg.com.cn/index/videos/25/02/04/4bWST-birthday/index.html

55 lines
1.7 KiB
HTML
Executable File

<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/dplayer.js"></script>
<script>
// 定义视频标题和链接
var videoTitle = "视频标题";
var videoUrl = "./video.mp4";
// 设置视频标题
document.getElementById('videoTitle').innerText = videoTitle;
// 设置页面标题
document.getElementById('pageTitle').innerText = videoTitle + " - 播放";
var dp = new DPlayer({
container: '.artplayer-app',
url: videoUrl,
autoSize: true,
fullscreen: true,
fullscreenWeb: true,
miniProgressBar: true,
autoOrientation: true,
autoplay: false, // 禁用自动播放
muted: false, // 不自动静音
setting: true,
aspectRatio: true,
lang: 'zh-cn',
fastForward: true,
screenshot: true,
airplay: true,
chromecast: true,
volume: 0.7,
highlight: [
{ time: 0, text: '开始' },
{ time: 18, text: '第一部分' },
{ time: 36, text: '第二部分' },
{ time: 54, text: '第三部分' },
{ time: 72, text: '第四部分' },
],
});
function downloadVideo() {
fetch(videoUrl)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = videoTitle + '.mp4'; // 设置下载文件名
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
})
.catch(error => console.error('Error downloading the video:', error));
}
</script>