tonyassi commited on
Commit
94de7fa
·
verified ·
1 Parent(s): 29878d5

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +15 -4
index.html CHANGED
@@ -38,17 +38,28 @@
38
  }
39
  }
40
 
41
- // Event listener for fullscreen change
42
- document.addEventListener('fullscreenchange', () => {
43
  const videoContainer = document.getElementById('videoContainer');
44
  const videoPlayer = document.getElementById('videoPlayer');
45
 
46
  // Check if exiting fullscreen mode
47
- if (!document.fullscreenElement && videoPlayer.readyState >= 2) {
 
 
 
 
 
48
  videoContainer.style.display = 'none'; // Hide the video container
49
  videoPlayer.pause(); // Pause the video
50
  }
51
- });
 
 
 
 
 
 
52
  </script>
53
  </body>
54
  </html>
 
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>