-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.html1
56 lines (49 loc) · 1.55 KB
/
preview.html1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>视频预览</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}
.preview-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
/* 这个值是根据视频宽高比调整的,例如:如果视频是16:9,则为(9÷16)×100% */
overflow: hidden;
}
.preview-container video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: contain;
/* 或者使用 object-fit: fill/contain 等以适应不同布局需求 */
}
</style>
</head>
<body>
<div class="preview-container">
<!-- 根据URL参数加载并播放视频 -->
<video id="previewVideo" src="" autoplay playsinline loop ></video>
</div>
<!-- <video id="previewVideo" src="" autoplay playsinline loop controls></video> -->
<script>
// 获取URL中的video参数
var urlParams = new URLSearchParams(window.location.search);
var videoUrl = decodeURIComponent(urlParams.get('video'));
// 设置视频源
document.getElementById('previewVideo').src = videoUrl;
</script>
</body>
</html>