Update index.html
Browse files- index.html +274 -27
index.html
CHANGED
@@ -6,16 +6,93 @@
|
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
<title>高度な音声動画プレイヤー</title>
|
8 |
<style>
|
9 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
body {
|
11 |
font-family: 'Arial', sans-serif;
|
12 |
-
background-color:
|
13 |
color: #e6f1ff;
|
14 |
margin: 0;
|
15 |
padding: 20px;
|
16 |
display: flex;
|
17 |
flex-direction: column;
|
18 |
align-items: center;
|
|
|
19 |
}
|
20 |
|
21 |
h1 {
|
@@ -32,10 +109,12 @@
|
|
32 |
flex-direction: column;
|
33 |
width: 100%;
|
34 |
max-width: 800px;
|
35 |
-
background-color:
|
36 |
border-radius: 10px;
|
37 |
padding: 20px;
|
38 |
box-shadow: 0 0 20px rgba(100, 255, 218, 0.2);
|
|
|
|
|
39 |
}
|
40 |
|
41 |
.video-container {
|
@@ -147,6 +226,9 @@
|
|
147 |
outline: none;
|
148 |
opacity: 0;
|
149 |
transition: opacity 0.3s, width 0.3s;
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
.volume-control:hover .volume-slider {
|
@@ -176,6 +258,9 @@
|
|
176 |
background: #1e2a47;
|
177 |
border-radius: 3px;
|
178 |
outline: none;
|
|
|
|
|
|
|
179 |
}
|
180 |
|
181 |
.speed-slider::-webkit-slider-thumb {
|
@@ -222,6 +307,9 @@
|
|
222 |
background: #1e2a47;
|
223 |
border-radius: 5px;
|
224 |
outline: none;
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
.audio-slider::-webkit-slider-thumb {
|
@@ -269,6 +357,9 @@
|
|
269 |
background: #1e2a47;
|
270 |
border-radius: 5px;
|
271 |
outline: none;
|
|
|
|
|
|
|
272 |
}
|
273 |
|
274 |
.global-volume-slider::-webkit-slider-thumb,
|
@@ -432,6 +523,9 @@
|
|
432 |
</style>
|
433 |
</head>
|
434 |
<body>
|
|
|
|
|
|
|
435 |
<!-- ローディングオーバーレイ -->
|
436 |
<div class="loading-overlay" id="loadingOverlay">
|
437 |
<div class="spinner-box">
|
@@ -465,7 +559,7 @@
|
|
465 |
</div>
|
466 |
<div class="speed-control">
|
467 |
<span class="speed-value" id="speed-value">1.00x</span>
|
468 |
-
<input type="range" class="speed-slider" id="speed-slider" min="0.
|
469 |
</div>
|
470 |
<button class="control-button fullscreen-button" id="fullscreen-btn">⛶</button>
|
471 |
</div>
|
@@ -479,14 +573,14 @@
|
|
479 |
<div class="setting-item">
|
480 |
<label for="start-time">再生開始秒数:</label>
|
481 |
<div>
|
482 |
-
<input type="number" id="start-time" min="0" value="0" step="0.
|
483 |
<button class="time-set-button" id="set-start-time">現在の秒数に設定</button>
|
484 |
</div>
|
485 |
</div>
|
486 |
<div class="setting-item">
|
487 |
<label for="end-time">再生終了秒数:</label>
|
488 |
<div>
|
489 |
-
<input type="number" id="end-time" min="0" value="0" step="0.
|
490 |
<button class="time-set-button" id="set-end-time">現在の秒数に設定</button>
|
491 |
</div>
|
492 |
</div>
|
@@ -544,9 +638,69 @@
|
|
544 |
|
545 |
<script>
|
546 |
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
// ローディング状態を管理
|
548 |
let loadingCount = 0;
|
549 |
let totalToLoad = 6; // 動画 + 5音声ファイル
|
|
|
|
|
550 |
|
551 |
// ローディング完了チェック
|
552 |
function checkLoadingComplete() {
|
@@ -620,12 +774,13 @@
|
|
620 |
let isVideoPlaying = false;
|
621 |
let lastVolume = 1;
|
622 |
let currentPlaybackRate = 1;
|
|
|
623 |
|
624 |
// 動画のメタデータが読み込まれたら
|
625 |
video.addEventListener('loadedmetadata', function() {
|
626 |
try {
|
627 |
videoDuration = video.duration;
|
628 |
-
endTimeInput.value = videoDuration.toFixed(
|
629 |
endTimeInput.max = videoDuration;
|
630 |
startTimeInput.max = videoDuration - 0.1;
|
631 |
updateTimeDisplay();
|
@@ -669,6 +824,10 @@
|
|
669 |
|
670 |
// 時間表示を更新
|
671 |
function updateTimeDisplay() {
|
|
|
|
|
|
|
|
|
672 |
try {
|
673 |
const currentTime = video.currentTime;
|
674 |
const duration = video.duration || videoDuration;
|
@@ -886,12 +1045,22 @@
|
|
886 |
// 全画面ボタン
|
887 |
fullscreenBtn.addEventListener('click', function() {
|
888 |
try {
|
889 |
-
if (
|
890 |
-
videoContainer.requestFullscreen
|
891 |
-
|
892 |
-
videoContainer.webkitRequestFullscreen
|
893 |
-
|
894 |
-
videoContainer.msRequestFullscreen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
}
|
896 |
} catch (error) {
|
897 |
handleError(error, '全画面表示中にエラーが発生しました');
|
@@ -904,7 +1073,9 @@
|
|
904 |
document.addEventListener('msfullscreenchange', handleFullscreenChange);
|
905 |
|
906 |
function handleFullscreenChange() {
|
907 |
-
|
|
|
|
|
908 |
if (isFullscreen) {
|
909 |
// 全画面時の処理
|
910 |
video.controls = false;
|
@@ -914,6 +1085,19 @@
|
|
914 |
}
|
915 |
}
|
916 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
917 |
// 音声ファイルをロード
|
918 |
function loadAudioFiles() {
|
919 |
audioFiles.forEach(file => {
|
@@ -1003,10 +1187,13 @@
|
|
1003 |
}
|
1004 |
|
1005 |
// 動画を再生
|
1006 |
-
video.play()
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
|
|
|
|
|
|
1010 |
|
1011 |
// 音声を再生
|
1012 |
audioFiles.forEach(file => {
|
@@ -1019,19 +1206,17 @@
|
|
1019 |
|
1020 |
// 一時停止関数
|
1021 |
function pauseMedia() {
|
1022 |
-
if (!isPlaying) return;
|
1023 |
-
|
1024 |
try {
|
1025 |
video.pause();
|
|
|
|
|
|
|
|
|
1026 |
audioFiles.forEach(file => {
|
1027 |
if (audioElements[file]) {
|
1028 |
audioElements[file].pause();
|
1029 |
}
|
1030 |
});
|
1031 |
-
|
1032 |
-
isPlaying = false;
|
1033 |
-
isVideoPlaying = false;
|
1034 |
-
playPauseBtn.textContent = '▶';
|
1035 |
} catch (error) {
|
1036 |
handleError(error, 'メディア一時停止中にエラーが発生しました');
|
1037 |
}
|
@@ -1063,7 +1248,7 @@
|
|
1063 |
audioFiles.forEach(file => {
|
1064 |
if (audioElements[file]) {
|
1065 |
const volumeSlider = document.querySelector(`.audio-slider[data-audio="${file}"]`);
|
1066 |
-
const volume = parseFloat(volumeSlider.value) * value;
|
1067 |
audioElements[file].volume = volume;
|
1068 |
}
|
1069 |
});
|
@@ -1088,7 +1273,7 @@
|
|
1088 |
// 現在の秒数を開始時間に設定
|
1089 |
setStartTimeBtn.addEventListener('click', function() {
|
1090 |
try {
|
1091 |
-
startTimeInput.value = video.currentTime.toFixed(
|
1092 |
} catch (error) {
|
1093 |
handleError(error, '開始時間設定中にエラーが発生しました');
|
1094 |
}
|
@@ -1097,17 +1282,79 @@
|
|
1097 |
// 現在の秒数を終了時間に設定
|
1098 |
setEndTimeBtn.addEventListener('click', function() {
|
1099 |
try {
|
1100 |
-
endTimeInput.value = video.currentTime.toFixed(
|
1101 |
} catch (error) {
|
1102 |
handleError(error, '終了時間設定中にエラーが発生しました');
|
1103 |
}
|
1104 |
});
|
1105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1106 |
// 初期化
|
1107 |
loadAudioFiles();
|
1108 |
updateVolumeIcon();
|
1109 |
volumeSlider.value = video.volume;
|
1110 |
video.controls = false;
|
|
|
1111 |
});
|
1112 |
</script>
|
1113 |
</body>
|
|
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
<title>高度な音声動画プレイヤー</title>
|
8 |
<style>
|
9 |
+
/* テクノロジー風背景スタイル */
|
10 |
+
.tech-background {
|
11 |
+
position: fixed;
|
12 |
+
top: 0;
|
13 |
+
left: 0;
|
14 |
+
width: 100%;
|
15 |
+
height: 100%;
|
16 |
+
z-index: -2;
|
17 |
+
background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
|
18 |
+
overflow: hidden;
|
19 |
+
}
|
20 |
+
|
21 |
+
.circuit-line {
|
22 |
+
position: absolute;
|
23 |
+
background: rgba(0, 255, 255, 0.1);
|
24 |
+
box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
|
25 |
+
}
|
26 |
+
|
27 |
+
.grid-dot {
|
28 |
+
position: absolute;
|
29 |
+
width: 2px;
|
30 |
+
height: 2px;
|
31 |
+
background: rgba(0, 255, 255, 0.3);
|
32 |
+
border-radius: 50%;
|
33 |
+
}
|
34 |
+
|
35 |
+
.hexagon {
|
36 |
+
position: absolute;
|
37 |
+
width: 40px;
|
38 |
+
height: 23px;
|
39 |
+
background: rgba(0, 255, 255, 0.05);
|
40 |
+
border: 1px solid rgba(0, 255, 255, 0.1);
|
41 |
+
box-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
|
42 |
+
}
|
43 |
+
|
44 |
+
.hexagon:before, .hexagon:after {
|
45 |
+
content: "";
|
46 |
+
position: absolute;
|
47 |
+
width: 0;
|
48 |
+
border-left: 20px solid transparent;
|
49 |
+
border-right: 20px solid transparent;
|
50 |
+
}
|
51 |
+
|
52 |
+
.hexagon:before {
|
53 |
+
bottom: 100%;
|
54 |
+
border-bottom: 11.5px solid rgba(0, 255, 255, 0.05);
|
55 |
+
}
|
56 |
+
|
57 |
+
.hexagon:after {
|
58 |
+
top: 100%;
|
59 |
+
width: 0;
|
60 |
+
border-top: 11.5px solid rgba(0, 255, 255, 0.05);
|
61 |
+
}
|
62 |
+
|
63 |
+
.pulse {
|
64 |
+
position: absolute;
|
65 |
+
width: 10px;
|
66 |
+
height: 10px;
|
67 |
+
background: rgba(0, 255, 255, 0.7);
|
68 |
+
border-radius: 50%;
|
69 |
+
box-shadow: 0 0 10px 5px rgba(0, 255, 255, 0.5);
|
70 |
+
animation: pulse 2s infinite;
|
71 |
+
}
|
72 |
+
|
73 |
+
@keyframes pulse {
|
74 |
+
0% { transform: scale(0.8); opacity: 0.7; }
|
75 |
+
50% { transform: scale(1.2); opacity: 1; }
|
76 |
+
100% { transform: scale(0.8); opacity: 0.7; }
|
77 |
+
}
|
78 |
+
|
79 |
+
@keyframes float {
|
80 |
+
0% { transform: translateY(0) rotate(0deg); }
|
81 |
+
50% { transform: translateY(-20px) rotate(5deg); }
|
82 |
+
100% { transform: translateY(0) rotate(0deg); }
|
83 |
+
}
|
84 |
+
|
85 |
+
/* メインスタイル */
|
86 |
body {
|
87 |
font-family: 'Arial', sans-serif;
|
88 |
+
background-color: rgba(10, 25, 47, 0.8);
|
89 |
color: #e6f1ff;
|
90 |
margin: 0;
|
91 |
padding: 20px;
|
92 |
display: flex;
|
93 |
flex-direction: column;
|
94 |
align-items: center;
|
95 |
+
min-height: 100vh;
|
96 |
}
|
97 |
|
98 |
h1 {
|
|
|
109 |
flex-direction: column;
|
110 |
width: 100%;
|
111 |
max-width: 800px;
|
112 |
+
background-color: rgba(17, 34, 64, 0.9);
|
113 |
border-radius: 10px;
|
114 |
padding: 20px;
|
115 |
box-shadow: 0 0 20px rgba(100, 255, 218, 0.2);
|
116 |
+
backdrop-filter: blur(5px);
|
117 |
+
border: 1px solid rgba(100, 255, 218, 0.1);
|
118 |
}
|
119 |
|
120 |
.video-container {
|
|
|
226 |
outline: none;
|
227 |
opacity: 0;
|
228 |
transition: opacity 0.3s, width 0.3s;
|
229 |
+
background-image: linear-gradient(#64ffda, #64ffda);
|
230 |
+
background-size: 100% 100%;
|
231 |
+
background-repeat: no-repeat;
|
232 |
}
|
233 |
|
234 |
.volume-control:hover .volume-slider {
|
|
|
258 |
background: #1e2a47;
|
259 |
border-radius: 3px;
|
260 |
outline: none;
|
261 |
+
background-image: linear-gradient(#64ffda, #64ffda);
|
262 |
+
background-size: 100% 100%;
|
263 |
+
background-repeat: no-repeat;
|
264 |
}
|
265 |
|
266 |
.speed-slider::-webkit-slider-thumb {
|
|
|
307 |
background: #1e2a47;
|
308 |
border-radius: 5px;
|
309 |
outline: none;
|
310 |
+
background-image: linear-gradient(#64ffda, #64ffda);
|
311 |
+
background-size: 100% 100%;
|
312 |
+
background-repeat: no-repeat;
|
313 |
}
|
314 |
|
315 |
.audio-slider::-webkit-slider-thumb {
|
|
|
357 |
background: #1e2a47;
|
358 |
border-radius: 5px;
|
359 |
outline: none;
|
360 |
+
background-image: linear-gradient(#64ffda, #64ffda);
|
361 |
+
background-size: 100% 100%;
|
362 |
+
background-repeat: no-repeat;
|
363 |
}
|
364 |
|
365 |
.global-volume-slider::-webkit-slider-thumb,
|
|
|
523 |
</style>
|
524 |
</head>
|
525 |
<body>
|
526 |
+
<!-- テクノロジー風背景 -->
|
527 |
+
<div class="tech-background" id="techBg"></div>
|
528 |
+
|
529 |
<!-- ローディングオーバーレイ -->
|
530 |
<div class="loading-overlay" id="loadingOverlay">
|
531 |
<div class="spinner-box">
|
|
|
559 |
</div>
|
560 |
<div class="speed-control">
|
561 |
<span class="speed-value" id="speed-value">1.00x</span>
|
562 |
+
<input type="range" class="speed-slider" id="speed-slider" min="0.5" max="2" step="0.01" value="1">
|
563 |
</div>
|
564 |
<button class="control-button fullscreen-button" id="fullscreen-btn">⛶</button>
|
565 |
</div>
|
|
|
573 |
<div class="setting-item">
|
574 |
<label for="start-time">再生開始秒数:</label>
|
575 |
<div>
|
576 |
+
<input type="number" id="start-time" min="0" value="0" step="0.01">
|
577 |
<button class="time-set-button" id="set-start-time">現在の秒数に設定</button>
|
578 |
</div>
|
579 |
</div>
|
580 |
<div class="setting-item">
|
581 |
<label for="end-time">再生終了秒数:</label>
|
582 |
<div>
|
583 |
+
<input type="number" id="end-time" min="0" value="0" step="0.01">
|
584 |
<button class="time-set-button" id="set-end-time">現在の秒数に設定</button>
|
585 |
</div>
|
586 |
</div>
|
|
|
638 |
|
639 |
<script>
|
640 |
document.addEventListener('DOMContentLoaded', function() {
|
641 |
+
// テクノロジー風背景を生成
|
642 |
+
function createTechBackground() {
|
643 |
+
const bg = document.getElementById('techBg');
|
644 |
+
|
645 |
+
// 回路風の線を生成
|
646 |
+
for (let i = 0; i < 30; i++) {
|
647 |
+
const line = document.createElement('div');
|
648 |
+
line.className = 'circuit-line';
|
649 |
+
|
650 |
+
const isHorizontal = Math.random() > 0.5;
|
651 |
+
if (isHorizontal) {
|
652 |
+
line.style.width = `${Math.random() * 300 + 100}px`;
|
653 |
+
line.style.height = '1px';
|
654 |
+
} else {
|
655 |
+
line.style.width = '1px';
|
656 |
+
line.style.height = `${Math.random() * 300 + 100}px`;
|
657 |
+
}
|
658 |
+
|
659 |
+
line.style.left = `${Math.random() * 100}%`;
|
660 |
+
line.style.top = `${Math.random() * 100}%`;
|
661 |
+
line.style.opacity = Math.random() * 0.5 + 0.1;
|
662 |
+
|
663 |
+
bg.appendChild(line);
|
664 |
+
}
|
665 |
+
|
666 |
+
// グリッドドットを生成
|
667 |
+
for (let i = 0; i < 200; i++) {
|
668 |
+
const dot = document.createElement('div');
|
669 |
+
dot.className = 'grid-dot';
|
670 |
+
dot.style.left = `${Math.random() * 100}%`;
|
671 |
+
dot.style.top = `${Math.random() * 100}%`;
|
672 |
+
bg.appendChild(dot);
|
673 |
+
}
|
674 |
+
|
675 |
+
// 六角形を生成
|
676 |
+
for (let i = 0; i < 15; i++) {
|
677 |
+
const hex = document.createElement('div');
|
678 |
+
hex.className = 'hexagon';
|
679 |
+
hex.style.left = `${Math.random() * 100}%`;
|
680 |
+
hex.style.top = `${Math.random() * 100}%`;
|
681 |
+
hex.style.transform = `rotate(${Math.random() * 360}deg)`;
|
682 |
+
hex.style.animation = `float ${Math.random() * 10 + 5}s infinite ease-in-out`;
|
683 |
+
bg.appendChild(hex);
|
684 |
+
}
|
685 |
+
|
686 |
+
// パルスする点を生成
|
687 |
+
for (let i = 0; i < 8; i++) {
|
688 |
+
const pulse = document.createElement('div');
|
689 |
+
pulse.className = 'pulse';
|
690 |
+
pulse.style.left = `${Math.random() * 100}%`;
|
691 |
+
pulse.style.top = `${Math.random() * 100}%`;
|
692 |
+
pulse.style.animationDelay = `${Math.random() * 2}s`;
|
693 |
+
bg.appendChild(pulse);
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
createTechBackground();
|
698 |
+
|
699 |
// ローディング状態を管理
|
700 |
let loadingCount = 0;
|
701 |
let totalToLoad = 6; // 動画 + 5音声ファイル
|
702 |
+
let lastUpdateTime = 0;
|
703 |
+
const updateInterval = 50; // 50msごとに更新 (20fps)
|
704 |
|
705 |
// ローディング完了チェック
|
706 |
function checkLoadingComplete() {
|
|
|
774 |
let isVideoPlaying = false;
|
775 |
let lastVolume = 1;
|
776 |
let currentPlaybackRate = 1;
|
777 |
+
let isFullscreen = false;
|
778 |
|
779 |
// 動画のメタデータが読み込まれたら
|
780 |
video.addEventListener('loadedmetadata', function() {
|
781 |
try {
|
782 |
videoDuration = video.duration;
|
783 |
+
endTimeInput.value = videoDuration.toFixed(2);
|
784 |
endTimeInput.max = videoDuration;
|
785 |
startTimeInput.max = videoDuration - 0.1;
|
786 |
updateTimeDisplay();
|
|
|
824 |
|
825 |
// 時間表示を更新
|
826 |
function updateTimeDisplay() {
|
827 |
+
const now = performance.now();
|
828 |
+
if (now - lastUpdateTime < updateInterval && !isFullscreen) return;
|
829 |
+
lastUpdateTime = now;
|
830 |
+
|
831 |
try {
|
832 |
const currentTime = video.currentTime;
|
833 |
const duration = video.duration || videoDuration;
|
|
|
1045 |
// 全画面ボタン
|
1046 |
fullscreenBtn.addEventListener('click', function() {
|
1047 |
try {
|
1048 |
+
if (!isFullscreen) {
|
1049 |
+
if (videoContainer.requestFullscreen) {
|
1050 |
+
videoContainer.requestFullscreen();
|
1051 |
+
} else if (videoContainer.webkitRequestFullscreen) {
|
1052 |
+
videoContainer.webkitRequestFullscreen();
|
1053 |
+
} else if (videoContainer.msRequestFullscreen) {
|
1054 |
+
videoContainer.msRequestFullscreen();
|
1055 |
+
}
|
1056 |
+
} else {
|
1057 |
+
if (document.exitFullscreen) {
|
1058 |
+
document.exitFullscreen();
|
1059 |
+
} else if (document.webkitExitFullscreen) {
|
1060 |
+
document.webkitExitFullscreen();
|
1061 |
+
} else if (document.msExitFullscreen) {
|
1062 |
+
document.msExitFullscreen();
|
1063 |
+
}
|
1064 |
}
|
1065 |
} catch (error) {
|
1066 |
handleError(error, '全画面表示中にエラーが発生しました');
|
|
|
1073 |
document.addEventListener('msfullscreenchange', handleFullscreenChange);
|
1074 |
|
1075 |
function handleFullscreenChange() {
|
1076 |
+
isFullscreen = !!(document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement);
|
1077 |
+
fullscreenBtn.textContent = isFullscreen ? '⛶' : '⛶';
|
1078 |
+
|
1079 |
if (isFullscreen) {
|
1080 |
// 全画面時の処理
|
1081 |
video.controls = false;
|
|
|
1085 |
}
|
1086 |
}
|
1087 |
|
1088 |
+
// キーボードイベント (ESCで全画面終了)
|
1089 |
+
document.addEventListener('keydown', function(e) {
|
1090 |
+
if (e.key === 'Escape' && isFullscreen) {
|
1091 |
+
if (document.exitFullscreen) {
|
1092 |
+
document.exitFullscreen();
|
1093 |
+
} else if (document.webkitExitFullscreen) {
|
1094 |
+
document.webkitExitFullscreen();
|
1095 |
+
} else if (document.msExitFullscreen) {
|
1096 |
+
document.msExitFullscreen();
|
1097 |
+
}
|
1098 |
+
}
|
1099 |
+
});
|
1100 |
+
|
1101 |
// 音声ファイルをロード
|
1102 |
function loadAudioFiles() {
|
1103 |
audioFiles.forEach(file => {
|
|
|
1187 |
}
|
1188 |
|
1189 |
// 動画を再生
|
1190 |
+
video.play().then(() => {
|
1191 |
+
isPlaying = true;
|
1192 |
+
isVideoPlaying = true;
|
1193 |
+
playPauseBtn.textContent = '⏸';
|
1194 |
+
}).catch(error => {
|
1195 |
+
handleError(error, '動画再生中にエラーが発生しました');
|
1196 |
+
});
|
1197 |
|
1198 |
// 音声を再生
|
1199 |
audioFiles.forEach(file => {
|
|
|
1206 |
|
1207 |
// 一時停止関数
|
1208 |
function pauseMedia() {
|
|
|
|
|
1209 |
try {
|
1210 |
video.pause();
|
1211 |
+
isPlaying = false;
|
1212 |
+
isVideoPlaying = false;
|
1213 |
+
playPauseBtn.textContent = '▶';
|
1214 |
+
|
1215 |
audioFiles.forEach(file => {
|
1216 |
if (audioElements[file]) {
|
1217 |
audioElements[file].pause();
|
1218 |
}
|
1219 |
});
|
|
|
|
|
|
|
|
|
1220 |
} catch (error) {
|
1221 |
handleError(error, 'メディア一時停止中にエラーが発生しました');
|
1222 |
}
|
|
|
1248 |
audioFiles.forEach(file => {
|
1249 |
if (audioElements[file]) {
|
1250 |
const volumeSlider = document.querySelector(`.audio-slider[data-audio="${file}"]`);
|
1251 |
+
const volume = parseFloat(volumeSlider.value) * (value/10);
|
1252 |
audioElements[file].volume = volume;
|
1253 |
}
|
1254 |
});
|
|
|
1273 |
// 現在の秒数を開始時間に設定
|
1274 |
setStartTimeBtn.addEventListener('click', function() {
|
1275 |
try {
|
1276 |
+
startTimeInput.value = video.currentTime.toFixed(2);
|
1277 |
} catch (error) {
|
1278 |
handleError(error, '開始時間設定中にエラーが発生しました');
|
1279 |
}
|
|
|
1282 |
// 現在の秒数を終了時間に設定
|
1283 |
setEndTimeBtn.addEventListener('click', function() {
|
1284 |
try {
|
1285 |
+
endTimeInput.value = video.currentTime.toFixed(2);
|
1286 |
} catch (error) {
|
1287 |
handleError(error, '終了時間設定中にエラーが発生しました');
|
1288 |
}
|
1289 |
});
|
1290 |
|
1291 |
+
// スライダーの背景を更新
|
1292 |
+
function updateSliderBackgrounds() {
|
1293 |
+
// ボリュームスライダー
|
1294 |
+
const volumePercent = volumeSlider.value * 100;
|
1295 |
+
volumeSlider.style.backgroundSize = `${volumePercent}% 100%`;
|
1296 |
+
|
1297 |
+
// 再生速度スライダー
|
1298 |
+
const speedPercent = (speedSlider.value - speedSlider.min) / (speedSlider.max - speedSlider.min) * 100;
|
1299 |
+
speedSlider.style.backgroundSize = `${speedPercent}% 100%`;
|
1300 |
+
|
1301 |
+
// 全体音量スライダー
|
1302 |
+
const globalVolumePercent = (globalVolumeSlider.value - globalVolumeSlider.min) / (globalVolumeSlider.max - globalVolumeSlider.min) * 100;
|
1303 |
+
globalVolumeSlider.style.backgroundSize = `${globalVolumePercent}% 100%`;
|
1304 |
+
|
1305 |
+
// 再生速度スライダー (設定)
|
1306 |
+
const playbackSpeedPercent = (playbackSpeedSlider.value - playbackSpeedSlider.min) / (playbackSpeedSlider.max - playbackSpeedSlider.min) * 100;
|
1307 |
+
playbackSpeedSlider.style.backgroundSize = `${playbackSpeedPercent}% 100%`;
|
1308 |
+
|
1309 |
+
// 各音声スライダー
|
1310 |
+
audioSliders.forEach(slider => {
|
1311 |
+
const percent = slider.value * 100;
|
1312 |
+
slider.style.backgroundSize = `${percent}% 100%`;
|
1313 |
+
});
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
// スライダーの初期背景を設定
|
1317 |
+
function initSliderBackgrounds() {
|
1318 |
+
// すべてのスライダーに背景を設定
|
1319 |
+
const sliders = [
|
1320 |
+
volumeSlider,
|
1321 |
+
speedSlider,
|
1322 |
+
globalVolumeSlider,
|
1323 |
+
playbackSpeedSlider,
|
1324 |
+
...audioSliders
|
1325 |
+
];
|
1326 |
+
|
1327 |
+
sliders.forEach(slider => {
|
1328 |
+
if (slider) {
|
1329 |
+
slider.style.backgroundImage = 'linear-gradient(#64ffda, #64ffda)';
|
1330 |
+
slider.style.backgroundRepeat = 'no-repeat';
|
1331 |
+
}
|
1332 |
+
});
|
1333 |
+
|
1334 |
+
updateSliderBackgrounds();
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
// スライダー変更時に背景を更新
|
1338 |
+
const allSliders = [
|
1339 |
+
volumeSlider,
|
1340 |
+
speedSlider,
|
1341 |
+
globalVolumeSlider,
|
1342 |
+
playbackSpeedSlider,
|
1343 |
+
...audioSliders
|
1344 |
+
];
|
1345 |
+
|
1346 |
+
allSliders.forEach(slider => {
|
1347 |
+
if (slider) {
|
1348 |
+
slider.addEventListener('input', updateSliderBackgrounds);
|
1349 |
+
}
|
1350 |
+
});
|
1351 |
+
|
1352 |
// 初期化
|
1353 |
loadAudioFiles();
|
1354 |
updateVolumeIcon();
|
1355 |
volumeSlider.value = video.volume;
|
1356 |
video.controls = false;
|
1357 |
+
initSliderBackgrounds();
|
1358 |
});
|
1359 |
</script>
|
1360 |
</body>
|