-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
86 lines (76 loc) · 2.63 KB
/
index.html
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
<!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;
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.player-video__wrapper {
border: 10px solid #333;
}
[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";
}
video-player::part(video) {
aspect-ratio: 16/9;
object-fit: cover;
@media (max-width: 1024px) {
aspect-ratio: 1/1;
}
}
</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">
<button data-video-player="play-button"></button>
<button data-video-player="mute-button"></button>
<button data-video-player="fullscreen-button">Fullscreen</button>
<button data-video-player="pip-button">Pip</button>
<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>
</video-player>
</div>
<script src="js/index.js"></script>
</body>
</html>