-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
102 lines (84 loc) · 2.93 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Happy 32nd Birthday Maddie!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css" />
<style>
video{
width: 90vw; /* 90% of viewport vidth */
height: 50.625vw; /* ratio = 9/16 * 90 = 50.625 */
max-height: 90vh;
max-width: 160vh; /* 16/9 * 90 = 160 */
background: #fff;
margin: auto;
position: absolute;
top:0;bottom:0;
left:0;right:0;
}
#controls{
position: absolute;
right: 20px;
bottom: 20px;
}
#pause{
text-transform: uppercase;
color: #000;
font-weight:bold;
letter-spacing: -1px;
font-size: 3em;
text-decoration: none;
}
.hidden-video {
display: none;
width: 0;
height: 0;
}
</style>
<script defer data-domain="happybirthdaymaddie.com" src="https://plausible.io/js/plausible.js"></script>
</head>
<body>
<video poster="//d2o5n5ng8inxze.cloudfront.net/happybirthdaymaddie/2024/happy-birthday-maddie-poster.jpg" id="video" laysinline autoplay muted loop>
<source src="//d2o5n5ng8inxze.cloudfront.net/happybirthdaymaddie/2024/happy-birthday-maddie.mp4" type="video/mp4">
<source src="//d2o5n5ng8inxze.cloudfront.net/happybirthdaymaddie/2024/happy-birthday-maddie.webm" type="video/webm">
</video>
<div class="hidden-video">
<iframe src="https://www.youtube.com/embed/MK6TXMsvgQg?autoplay=1&mute=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div id="controls">
<a href="#" id="pause">❚❚</a>
</div>
<script>
var vid = document.getElementById("video");
var pauseButton = document.querySelector("#controls #pause");
if (window.matchMedia('(prefers-reduced-motion)').matches) {
vid.removeAttribute("autoplay");
vid.pause();
pauseButton.innerHTML = "❚❚";
}
pauseButton.addEventListener("click", function(e) {
e.preventDefault();
if (vid.paused) {
vid.play();
pauseButton.innerHTML = "❚❚";
} else {
vid.pause();
pauseButton.innerHTML = "►";
}
});
window.addEventListener('load', () => {
setTimeout(unmute, 1000);
});
const unmute = () => {
let video = document.querySelector('video[muted][autoplay]');
try {
video.muted = false;
} catch (err) {
video.controls = true;
}
}
</script>
</body>
</html>