feat(videos): 添加新的视频播放页面模板和功能

- 新增了多个视频播放页面模板,包括 4bWST-birthday、knzB8-MC 和 template-video
- 添加了视频下载功能
- 集成了 artplayer 和 artplayerPluginChapter 插件,支持视频播放和章节划分
- 新增了视频.css 样式文件,用于统一视频播放页面的样式
This commit is contained in:
2025-02-18 23:36:12 +08:00
Unverified
parent ccda78d397
commit 74ff163eb2
8 changed files with 367 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<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>

View File

@@ -0,0 +1,80 @@
<html lang="zh-CN">
<head>
<title id="pageTitle">视频播放</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
// 视频标题、链接和说明
var videoTitle = "";
var videoUrl = "./.mp4";
var videoDescription = "";
</script>
</head>
<body>
<div class="header">
<h1 id="videoTitle"></h1>
<div id="videoDescription" class="description"></div>
<div>
<button onclick="downloadVideo()">下载</button>
<button class="back-button" onclick="window.history.back()">返回</button>
</div>
</div>
<div class="artplayer-app"></div>
<script src="/artplayer.js"></script>
<!-- 引入 artplayerPluginChapter 插件 -->
<script src="/artplayer-plugin-chapter.js"></script>
<link rel="stylesheet" href="/videos/video.css">
<script>
document.getElementById('videoTitle').innerText = videoTitle;
document.getElementById('pageTitle').innerText = videoTitle + " - 播放";
document.getElementById('videoDescription').innerText = videoDescription;
var art = new Artplayer({
container: '.artplayer-app',
url: videoUrl,
autoSize: true,
fullscreen: true,
fullscreenWeb: true,
miniProgressBar: true,
autoOrientation: true,
autoplay: false, // 禁用自动播放
muted: false, // 不自动静音
setting: true,
aspectRatio: true,
fullscreen: true,
lang: 'zh-cn',
fastForward: true,
plugins: [
artplayerPluginChapter({
chapters: [
{ start: 0, end: 18, title: '1' },
{ start: 18, end: 36, title: '2' },
{ start: 36, end: 54, title: '3' },
{ start: 54, end: 72, title: '4' },
{ start: 72, end: Infinity, title: '5' },
]
}),
],
});
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>
</body>
</html>

View File

@@ -0,0 +1,79 @@
<html lang="zh-CN">
<head>
<title id="pageTitle">视频播放</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/artplayer.js"></script>
<!-- 引入 artplayerPluginChapter 插件 -->
<script src="/artplayer-plugin-chapter.js"></script>
<link rel="stylesheet" href="/videos/video.css">
<script>
// 视频标题、链接和说明
var videoTitle = "MC统一认证设置教程";
var videoUrl = "./2025-02-14-11-09-11_Notepad3_D0VfI8Cj2L.mp4";
var videoDescription = "此教程将演示如何在PCL2中设置MC统一认证登录\n注册相关信息http://o.nmgjg.com.cn/videos/25/02/knzB8-MC/txt.txt"
</script>
</head>
<body>
<div class="header">
<h1 id="videoTitle"></h1>
<div id="videoDescription" class="description"></div>
<div>
<button onclick="downloadVideo()">下载</button>
<button class="back-button" onclick="window.history.back()">返回</button>
</div>
</div>
<div class="artplayer-app"></div>
<script>
document.getElementById('videoTitle').innerText = videoTitle;
document.getElementById('pageTitle').innerText = videoTitle + " - 播放";
document.getElementById('videoDescription').innerText = videoDescription;
var art = new Artplayer({
container: '.artplayer-app',
url: videoUrl,
autoSize: true,
fullscreen: true,
fullscreenWeb: true,
miniProgressBar: true,
autoOrientation: true,
autoplay: false, // 禁用自动播放
muted: false, // 不自动静音
setting: true,
aspectRatio: true,
fullscreen: true,
lang: 'zh-cn',
fastForward: true,
plugins: [
artplayerPluginChapter({
chapters: [
{ start: 0, end: 27, title: '注册并登录' },
{ start: 27, end: Infinity, title: '配置启动器' }
]
}),
],
});
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>
</body>
</html>

View File

@@ -0,0 +1,2 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID<EFBFBD><EFBFBD>484a5570ea7c11ef9215e04acd26563f
ע<EFBFBD>᣺https://login.mc-user.com:233/484a5570ea7c11ef9215e04acd26563f/loginreg

Binary file not shown.

View File

@@ -0,0 +1,80 @@
<html lang="zh-CN">
<head>
<title id="pageTitle">视频播放</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
// 视频标题、链接和说明
var videoTitle = "视频标题";
var videoUrl = "./Big Buck Bunny_1080P_60fps.mp4";
var videoDescription = "视频说明,\n描述视频内容";
</script>
</head>
<body>
<div class="header">
<h1 id="videoTitle"></h1>
<div id="videoDescription" class="description"></div>
<div>
<button onclick="downloadVideo()">下载</button>
<button class="back-button" onclick="window.history.back()">返回</button>
</div>
</div>
<div class="artplayer-app"></div>
<script src="/artplayer.js"></script>
<!-- 引入 artplayerPluginChapter 插件 -->
<script src="/artplayer-plugin-chapter.js"></script>
<link rel="stylesheet" href="/videos/video.css">
<script>
document.getElementById('videoTitle').innerText = videoTitle;
document.getElementById('pageTitle').innerText = videoTitle + " - 播放";
document.getElementById('videoDescription').innerText = videoDescription;
var art = new Artplayer({
container: '.artplayer-app',
url: videoUrl,
autoSize: true,
fullscreen: true,
fullscreenWeb: true,
miniProgressBar: true,
autoOrientation: true,
autoplay: false, // 禁用自动播放
muted: false, // 不自动静音
setting: true,
aspectRatio: true,
fullscreen: true,
lang: 'zh-cn',
fastForward: true,
plugins: [
artplayerPluginChapter({
chapters: [
{ start: 0, end: 18, title: '1' },
{ start: 18, end: 36, title: '2' },
{ start: 36, end: 54, title: '3' },
{ start: 54, end: 72, title: '4' },
{ start: 72, end: Infinity, title: '5' },
]
}),
],
});
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>
</body>
</html>

72
videos/video.css Normal file
View File

@@ -0,0 +1,72 @@
.artplayer-app {
width: 100%;
height: calc(100vh - 50px);
/* 调整高度以适应标题栏 */
margin: 0;
border: 1px solid #ccc;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
display: flex;
flex-direction: column;
height: 100vh;
/* 设置body高度为视口高度 */
overflow: hidden;
/* 隐藏滚动条 */
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
background-color: #fff;
border-bottom: 1px solid #ccc;
}
h1 {
color: #333;
margin: 0;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: button;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.back-button {
padding: 10px 20px;
background-color: #6c757d;
color: white;
border: none;
border-radius: 5px;
cursor: button;
transition: background-color 0.3s;
}
.back-button:hover {
background-color: #545b62;
}
.description {
font-size: 14px;
color: #666;
margin-left: 10px;
/* 减少左边距,使说明紧挨标题 */
max-width: 400px;
white-space: normal;
word-wrap: break-word;
}