tonyassi commited on
Commit
0d62e1b
·
verified ·
1 Parent(s): 94de7fa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +8 -20
index.html CHANGED
@@ -38,28 +38,16 @@
38
  }
39
  }
40
 
41
- // Cross-browser event listener for fullscreen change
42
- function onFullscreenChange() {
 
 
 
 
 
43
  const videoContainer = document.getElementById('videoContainer');
44
- const videoPlayer = document.getElementById('videoPlayer');
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>