Update index.html
Browse files- index.html +8 -20
index.html
CHANGED
@@ -38,28 +38,16 @@
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
-
//
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
43 |
const videoContainer = document.getElementById('videoContainer');
|
44 |
-
|
45 |
-
|
46 |
-
// Check if exiting fullscreen mode
|
47 |
-
if (
|
48 |
-
!document.fullscreenElement &&
|
49 |
-
!document.webkitFullscreenElement &&
|
50 |
-
!document.mozFullScreenElement &&
|
51 |
-
!document.msFullscreenElement
|
52 |
-
) {
|
53 |
-
videoContainer.style.display = 'none'; // Hide the video container
|
54 |
-
videoPlayer.pause(); // Pause the video
|
55 |
-
}
|
56 |
}
|
57 |
-
|
58 |
-
// Add event listeners for different browsers and platforms
|
59 |
-
document.addEventListener('fullscreenchange', onFullscreenChange);
|
60 |
-
document.addEventListener('webkitfullscreenchange', onFullscreenChange); // For Safari and iOS
|
61 |
-
document.addEventListener('mozfullscreenchange', onFullscreenChange); // For Firefox
|
62 |
-
document.addEventListener('MSFullscreenChange', onFullscreenChange); // For older IE/Edge
|
63 |
</script>
|
64 |
</body>
|
65 |
</html>
|
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
+
// Add event listeners for focus and blur to detect fullscreen exit
|
42 |
+
const videoPlayer = document.getElementById('videoPlayer');
|
43 |
+
videoPlayer.addEventListener('webkitendfullscreen', hideVideoOnExit); // Specific to iOS Safari
|
44 |
+
videoPlayer.addEventListener('pause', hideVideoOnExit); // Additional fallback for mobile
|
45 |
+
videoPlayer.addEventListener('ended', hideVideoOnExit); // Hide when video ends (optional)
|
46 |
+
|
47 |
+
function hideVideoOnExit() {
|
48 |
const videoContainer = document.getElementById('videoContainer');
|
49 |
+
videoContainer.style.display = 'none'; // Hide the video container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</script>
|
52 |
</body>
|
53 |
</html>
|