-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
101 lines (90 loc) · 2.74 KB
/
index.html
File metadata and controls
101 lines (90 loc) · 2.74 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Return Gift</title>
<style>
/* Styles for the button */
.play-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.5);
color: #fff;
font-size: 24px;
padding: 15px 30px;
border: none;
cursor: pointer;
border-radius: 10px;
transition: opacity 0.3s;
}
.play-button:hover {
opacity: 0.8;
}
/* Hide the video when button is visible */
.video-container video {
display: none;
}
/* Styles for the video container */
.video-container {
position: relative;
width: 100%;
padding-top: 56.25%; /* 16:9 aspect ratio */
overflow: hidden;
background-color: black; /* Set background color to black */
}
.video-container video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
@media screen and (max-width: 768px) {
.video-container {
padding-top: 100%; /* 1:1 aspect ratio for mobile */
}
}
</style>
</head>
<body>
<div class="video-container" id="videoContainer">
<video id="videoPlayer" loop autoplay preload="auto">
<source src="padhai.mp4" type="video/mp4">
<!-- You can add additional source elements for other video formats -->
Your browser does not support the video tag.
</video>
<button class="play-button" onclick="playVideo()">Play Video</button>
</div>
<script>
function playVideo() {
var videoContainer = document.getElementById('videoContainer');
var video = document.getElementById('videoPlayer');
// Hide the button
var button = document.querySelector('.play-button');
button.style.display = 'none';
// Show the video
video.style.display = 'block';
// Start playing the video with sound
video.play();
}
document.addEventListener('DOMContentLoaded', function() {
// Resume video if autoplay is stopped
var video = document.getElementById('videoPlayer');
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === 'visible' && video.paused) {
video.play();
}
});
// Mobile autoplay handling
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
video.play(); // Autoplay on mobile
}
});
</script>
</body>
</html>