soiz1 commited on
Commit
4816b51
·
1 Parent(s): 28fe881

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -1
index.html CHANGED
@@ -909,7 +909,7 @@ document.getElementById('sw-register-btn').addEventListener('click', async () =>
909
  </div>
910
 
911
  <video id="video" muted>
912
- <source src="v.mp4" type="video/mp4">
913
  </video>
914
  <div class="video-controls">
915
  <div class="progress-container" id="progress-container">
@@ -1129,6 +1129,15 @@ document.addEventListener('DOMContentLoaded', function() {
1129
  video.preservesPitch = true;
1130
  video.mozPreservesPitch = true; // Firefox用
1131
  video.webkitPreservesPitch = true; // 古いWebKit用
 
 
 
 
 
 
 
 
 
1132
  const videoContainer = document.getElementById('video-container');
1133
  const playPauseBtn = document.getElementById('play-pause-btn');
1134
  const timeDisplay = document.getElementById('time-display');
 
909
  </div>
910
 
911
  <video id="video" muted>
912
+ <source src="v.mp4" type="video/mp4" allowPictureInPicture>
913
  </video>
914
  <div class="video-controls">
915
  <div class="progress-container" id="progress-container">
 
1129
  video.preservesPitch = true;
1130
  video.mozPreservesPitch = true; // Firefox用
1131
  video.webkitPreservesPitch = true; // 古いWebKit用
1132
+ document.addEventListener('visibilitychange', async () => {
1133
+ if (document.hidden && !document.pictureInPictureElement && !video.paused) {
1134
+ try {
1135
+ await video.requestPictureInPicture();
1136
+ } catch (err) {
1137
+ console.error('PiP起動エラー:', err);
1138
+ }
1139
+ }
1140
+ });
1141
  const videoContainer = document.getElementById('video-container');
1142
  const playPauseBtn = document.getElementById('play-pause-btn');
1143
  const timeDisplay = document.getElementById('time-display');