-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
130 lines (115 loc) · 4.1 KB
/
example.html
File metadata and controls
130 lines (115 loc) · 4.1 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Custom Web Component</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
overscroll-behavior: none;
}
video-player {
display: block;
width: 100%;
height: 100svh;
position: relative;
overflow: hidden;
}
video-player::part(video) {
width: 100%;
height: 100%;
object-fit: cover;
}
.controls-wrapper {
position: absolute;
bottom: 10px;
left: 0;
width: 100%;
}
.controls {
display: flex;
justify-content: space-between;
gap: 10px;
margin-inline: 10px;
.controls__play-mute {
width: fit-content;
[data-video-player="play-button"].paused:before {
content: "Play";
}
[data-video-player="play-button"]:before {
content: "Pause";
}
[data-video-player="mute-button"].muted:before {
content: "Unmute";
}
[data-video-player="mute-button"]:before {
content: "Mute";
}
}
.controls__time {
width: fit-content;
display: flex;
gap: 5px;
flex: 1;
[data-video-player="progress-bar"] {
width: 100%;
}
}
.controls__utils {
width: fit-content;
}
}
</style>
</head>
<body>
<div class="container">
<video-player muted loop autoplay>
<source
slot="video"
src="https://res.cloudinary.com/demo/video/upload/q_auto,f_auto/cat.mp4"
type="video/mp4"
media="(min-width:901px)"
/>
<source
slot="video"
src="https://res.cloudinary.com/demo/video/upload/q_auto,f_auto/dog.mp4"
type="video/mp4"
media="(max-width:900px)"
/>
<div slot="controls" class="controls-wrapper">
<div class="controls">
<div class="controls__play-mute">
<button data-video-player="play-button"></button>
<button data-video-player="mute-button"></button>
</div>
<div class="controls__time">
<p data-video-player="current-time"></p>
/
<p data-video-player="duration"></p>
<input
data-video-player="progress-bar"
type="range"
min="0"
max="100"
value="0"
/>
</div>
<div class="controls__utils">
<button data-video-player="fullscreen-button">Fullscreen</button>
<button data-video-player="pip-button">Pip</button>
</div>
</div>
</div>
</video-player>
</div>
<script
src="https://cdn.jsdelivr.net/gh/display-design-studio/video-player/js/index.min.js"
type="module"
></script>
</body>
</html>