Update index.html
Browse files- index.html +41 -40
index.html
CHANGED
@@ -1129,46 +1129,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
1129 |
video.preservesPitch = true;
|
1130 |
video.mozPreservesPitch = true; // Firefox用
|
1131 |
video.webkitPreservesPitch = true; // 古いWebKit用
|
1132 |
-
async function enterPiP() {
|
1133 |
-
if (!document.pictureInPictureElement && !video.paused) {
|
1134 |
-
try {
|
1135 |
-
await video.requestPictureInPicture();
|
1136 |
-
} catch (err) {
|
1137 |
-
console.warn('PiP開始失敗:', err);
|
1138 |
-
}
|
1139 |
-
}
|
1140 |
-
}
|
1141 |
-
|
1142 |
-
async function exitPiP() {
|
1143 |
-
if (document.pictureInPictureElement) {
|
1144 |
-
try {
|
1145 |
-
await document.exitPictureInPicture();
|
1146 |
-
} catch (err) {
|
1147 |
-
console.warn('PiP終了失敗:', err);
|
1148 |
-
}
|
1149 |
-
}
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
document.addEventListener('visibilitychange', async () => {
|
1153 |
-
if (document.hidden) {
|
1154 |
-
// 他タブに移動 → PiP表示
|
1155 |
-
// 動画が停止していれば再生再開
|
1156 |
-
if (video.paused) {
|
1157 |
-
try {
|
1158 |
-
await video.play();
|
1159 |
-
} catch (e) {
|
1160 |
-
console.warn('再生エラー:', e);
|
1161 |
-
}
|
1162 |
-
}
|
1163 |
-
enterPiP();
|
1164 |
-
} else {
|
1165 |
-
// タブに戻ったとき → PiP終了
|
1166 |
-
exitPiP();
|
1167 |
-
}
|
1168 |
-
});
|
1169 |
-
|
1170 |
-
// 動画終了時に自動的にPiPを閉じる(次回再開のため)
|
1171 |
-
video.addEventListener('ended', exitPiP);
|
1172 |
const videoContainer = document.getElementById('video-container');
|
1173 |
const playPauseBtn = document.getElementById('play-pause-btn');
|
1174 |
const timeDisplay = document.getElementById('time-display');
|
@@ -1224,6 +1184,27 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
1224 |
let currentPlaybackRate = 1;
|
1225 |
let isFullscreen = false;
|
1226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1227 |
// 動画のバッファリング状態を監視
|
1228 |
video.addEventListener('waiting', function() {
|
1229 |
isBuffering = true;
|
@@ -1421,6 +1402,26 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
1421 |
enablePlayerControls();
|
1422 |
|
1423 |
previewSection.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1424 |
// 合成後に音量と再生速度を適用
|
1425 |
applyVolume();
|
1426 |
applyPlaybackRate();
|
|
|
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');
|
|
|
1184 |
let currentPlaybackRate = 1;
|
1185 |
let isFullscreen = false;
|
1186 |
|
1187 |
+
async function enterPiP() {
|
1188 |
+
if (!document.pictureInPictureElement && !video.paused) {
|
1189 |
+
try {
|
1190 |
+
await video.requestPictureInPicture();
|
1191 |
+
} catch (err) {
|
1192 |
+
console.warn('PiP開始失敗:', err);
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
async function exitPiP() {
|
1198 |
+
if (document.pictureInPictureElement) {
|
1199 |
+
try {
|
1200 |
+
await document.exitPictureInPicture();
|
1201 |
+
} catch (err) {
|
1202 |
+
console.warn('PiP終了失敗:', err);
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
|
1208 |
// 動画のバッファリング状態を監視
|
1209 |
video.addEventListener('waiting', function() {
|
1210 |
isBuffering = true;
|
|
|
1402 |
enablePlayerControls();
|
1403 |
|
1404 |
previewSection.style.display = 'block';
|
1405 |
+
document.addEventListener('visibilitychange', async () => {
|
1406 |
+
if (document.hidden) {
|
1407 |
+
// 他タブに移動 → PiP表示
|
1408 |
+
// 動画が停止していれば再生再開
|
1409 |
+
if (video.paused) {
|
1410 |
+
try {
|
1411 |
+
await video.play();
|
1412 |
+
} catch (e) {
|
1413 |
+
console.warn('再生エラー:', e);
|
1414 |
+
}
|
1415 |
+
}
|
1416 |
+
enterPiP();
|
1417 |
+
} else {
|
1418 |
+
// タブに戻ったとき → PiP終了
|
1419 |
+
exitPiP();
|
1420 |
+
}
|
1421 |
+
});
|
1422 |
+
|
1423 |
+
// 動画終了時に自動的にPiPを閉じる(次回再開のため)
|
1424 |
+
video.addEventListener('ended', exitPiP);
|
1425 |
// 合成後に音量と再生速度を適用
|
1426 |
applyVolume();
|
1427 |
applyPlaybackRate();
|