104 lines
3.4 KiB
HTML
104 lines
3.4 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>视频播放器</title>
|
||
|
|
<style>
|
||
|
|
body {
|
||
|
|
margin: 0;
|
||
|
|
padding: 20px;
|
||
|
|
background-color: #f0f0f0;
|
||
|
|
font-family: Arial, sans-serif;
|
||
|
|
}
|
||
|
|
.container {
|
||
|
|
max-width: 1200px;
|
||
|
|
margin: 0 auto;
|
||
|
|
background-color: white;
|
||
|
|
padding: 20px;
|
||
|
|
border-radius: 8px;
|
||
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||
|
|
}
|
||
|
|
.video-container {
|
||
|
|
width: 100%;
|
||
|
|
max-width: 1000px;
|
||
|
|
margin: 0 auto;
|
||
|
|
}
|
||
|
|
video {
|
||
|
|
width: 100%;
|
||
|
|
height: auto;
|
||
|
|
background-color: black;
|
||
|
|
border-radius: 4px;
|
||
|
|
}
|
||
|
|
h1 {
|
||
|
|
text-align: center;
|
||
|
|
color: #333;
|
||
|
|
margin-bottom: 30px;
|
||
|
|
}
|
||
|
|
.controls {
|
||
|
|
margin-top: 20px;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
button {
|
||
|
|
padding: 10px 20px;
|
||
|
|
margin: 0 10px;
|
||
|
|
border: none;
|
||
|
|
border-radius: 4px;
|
||
|
|
background-color: #007bff;
|
||
|
|
color: white;
|
||
|
|
cursor: pointer;
|
||
|
|
transition: background-color 0.3s;
|
||
|
|
}
|
||
|
|
button:hover {
|
||
|
|
background-color: #0056b3;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="container">
|
||
|
|
<h1>视频播放器</h1>
|
||
|
|
<div class="video-container">
|
||
|
|
<video id="videoPlayer" controls controlsList="nodownload">
|
||
|
|
<source src="https://srs-bazhong.t-aaron.com:2443/recording/50ae8720-d8b3-40c6-9e2b-4eb31ed619e6.mp4" type="video/mp4">
|
||
|
|
您的浏览器不支持 HTML5 视频播放。
|
||
|
|
</video>
|
||
|
|
</div>
|
||
|
|
<div class="controls">
|
||
|
|
<button onclick="document.getElementById('videoPlayer').play()">播放</button>
|
||
|
|
<button onclick="document.getElementById('videoPlayer').pause()">暂停</button>
|
||
|
|
<button onclick="document.getElementById('videoPlayer').currentTime = 0">重新播放</button>
|
||
|
|
<button onclick="toggleFullScreen()">全屏</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function toggleFullScreen() {
|
||
|
|
const video = document.getElementById('videoPlayer');
|
||
|
|
if (!document.fullscreenElement) {
|
||
|
|
if (video.requestFullscreen) {
|
||
|
|
video.requestFullscreen();
|
||
|
|
} else if (video.webkitRequestFullscreen) {
|
||
|
|
video.webkitRequestFullscreen();
|
||
|
|
} else if (video.msRequestFullscreen) {
|
||
|
|
video.msRequestFullscreen();
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
if (document.exitFullscreen) {
|
||
|
|
document.exitFullscreen();
|
||
|
|
} else if (document.webkitExitFullscreen) {
|
||
|
|
document.webkitExitFullscreen();
|
||
|
|
} else if (document.msExitFullscreen) {
|
||
|
|
document.msExitFullscreen();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 添加错误处理
|
||
|
|
const video = document.getElementById('videoPlayer');
|
||
|
|
video.addEventListener('error', function(e) {
|
||
|
|
console.error('视频加载错误:', e);
|
||
|
|
alert('视频加载失败,请检查网络连接或视频地址是否正确。');
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|