Update index.html
Browse files- index.html +100 -67
index.html
CHANGED
|
@@ -161,43 +161,33 @@
|
|
| 161 |
}
|
| 162 |
|
| 163 |
.speed-control {
|
| 164 |
-
|
|
|
|
|
|
|
| 165 |
}
|
| 166 |
|
| 167 |
-
.speed-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
cursor: pointer;
|
| 173 |
-
padding: 5px 10px;
|
| 174 |
border-radius: 3px;
|
|
|
|
| 175 |
}
|
| 176 |
|
| 177 |
-
.speed-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
background
|
| 182 |
-
border-radius:
|
| 183 |
-
padding: 5px 0;
|
| 184 |
-
display: none;
|
| 185 |
-
min-width: 80px;
|
| 186 |
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
| 187 |
-
}
|
| 188 |
-
|
| 189 |
-
.speed-options.show {
|
| 190 |
-
display: block;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
-
.speed-option {
|
| 194 |
-
padding: 5px 10px;
|
| 195 |
cursor: pointer;
|
| 196 |
-
text-align: center;
|
| 197 |
}
|
| 198 |
|
| 199 |
-
.speed-
|
| 200 |
-
|
|
|
|
|
|
|
| 201 |
}
|
| 202 |
|
| 203 |
.fullscreen-button {
|
|
@@ -282,13 +272,34 @@
|
|
| 282 |
background: linear-gradient(90deg, transparent, #64ffda, transparent);
|
| 283 |
margin: 20px 0;
|
| 284 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
</style>
|
| 286 |
</head>
|
| 287 |
<body>
|
| 288 |
<h1>高度な音声動画プレイヤー</h1>
|
| 289 |
|
| 290 |
<div class="container">
|
| 291 |
-
<div class="video-container">
|
| 292 |
<video id="video" muted>
|
| 293 |
<source src="v.mp4" type="video/mp4">
|
| 294 |
</video>
|
|
@@ -305,17 +316,8 @@
|
|
| 305 |
<input type="range" class="volume-slider" id="volume-slider" min="0" max="1" step="0.01" value="1">
|
| 306 |
</div>
|
| 307 |
<div class="speed-control">
|
| 308 |
-
<
|
| 309 |
-
<
|
| 310 |
-
<div class="speed-option" data-speed="0.25">0.25x</div>
|
| 311 |
-
<div class="speed-option" data-speed="0.5">0.5x</div>
|
| 312 |
-
<div class="speed-option" data-speed="0.75">0.75x</div>
|
| 313 |
-
<div class="speed-option" data-speed="1">1x</div>
|
| 314 |
-
<div class="speed-option" data-speed="1.25">1.25x</div>
|
| 315 |
-
<div class="speed-option" data-speed="1.5">1.5x</div>
|
| 316 |
-
<div class="speed-option" data-speed="2">2x</div>
|
| 317 |
-
<div class="speed-option" data-speed="3">3x</div>
|
| 318 |
-
</div>
|
| 319 |
</div>
|
| 320 |
<button class="control-button fullscreen-button" id="fullscreen-btn">⛶</button>
|
| 321 |
</div>
|
|
@@ -343,6 +345,11 @@
|
|
| 343 |
<input type="range" id="global-volume" min="0" max="3" step="0.1" value="1">
|
| 344 |
<span id="global-volume-value">1</span>
|
| 345 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
</div>
|
| 347 |
|
| 348 |
<div class="tech-decoration"></div>
|
|
@@ -389,6 +396,7 @@
|
|
| 389 |
document.addEventListener('DOMContentLoaded', function() {
|
| 390 |
// 要素を取得
|
| 391 |
const video = document.getElementById('video');
|
|
|
|
| 392 |
const playPauseBtn = document.getElementById('play-pause-btn');
|
| 393 |
const timeDisplay = document.getElementById('time-display');
|
| 394 |
const progressContainer = document.getElementById('progress-container');
|
|
@@ -396,8 +404,10 @@
|
|
| 396 |
const progressTime = document.getElementById('progress-time');
|
| 397 |
const volumeBtn = document.getElementById('volume-btn');
|
| 398 |
const volumeSlider = document.getElementById('volume-slider');
|
| 399 |
-
const
|
| 400 |
-
const
|
|
|
|
|
|
|
| 401 |
const fullscreenBtn = document.getElementById('fullscreen-btn');
|
| 402 |
const playBtn = document.getElementById('play-btn');
|
| 403 |
const pauseBtn = document.getElementById('pause-btn');
|
|
@@ -535,39 +545,61 @@
|
|
| 535 |
}
|
| 536 |
}
|
| 537 |
|
| 538 |
-
//
|
| 539 |
-
|
| 540 |
-
|
|
|
|
|
|
|
| 541 |
});
|
| 542 |
|
| 543 |
-
//
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
// 音声の再生速度も更新
|
| 552 |
-
audioFiles.forEach(file => {
|
| 553 |
-
if (audioSources[file]) {
|
| 554 |
-
audioSources[file].playbackRate.value = speed;
|
| 555 |
-
}
|
| 556 |
-
});
|
| 557 |
-
});
|
| 558 |
});
|
| 559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
// 全画面ボタン
|
| 561 |
fullscreenBtn.addEventListener('click', function() {
|
| 562 |
-
if (
|
| 563 |
-
|
| 564 |
-
} else if (
|
| 565 |
-
|
| 566 |
-
} else if (
|
| 567 |
-
|
| 568 |
}
|
| 569 |
});
|
| 570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
// 音声ファイルを読み込む
|
| 572 |
function loadAudioFiles() {
|
| 573 |
audioFiles.forEach(file => {
|
|
@@ -733,6 +765,7 @@
|
|
| 733 |
loadAudioFiles();
|
| 734 |
updateVolumeIcon();
|
| 735 |
volumeSlider.value = video.volume;
|
|
|
|
| 736 |
});
|
| 737 |
</script>
|
| 738 |
</body>
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
.speed-control {
|
| 164 |
+
display: flex;
|
| 165 |
+
align-items: center;
|
| 166 |
+
gap: 5px;
|
| 167 |
}
|
| 168 |
|
| 169 |
+
.speed-slider {
|
| 170 |
+
width: 80px;
|
| 171 |
+
height: 6px;
|
| 172 |
+
-webkit-appearance: none;
|
| 173 |
+
background: #1e2a47;
|
|
|
|
|
|
|
| 174 |
border-radius: 3px;
|
| 175 |
+
outline: none;
|
| 176 |
}
|
| 177 |
|
| 178 |
+
.speed-slider::-webkit-slider-thumb {
|
| 179 |
+
-webkit-appearance: none;
|
| 180 |
+
width: 12px;
|
| 181 |
+
height: 12px;
|
| 182 |
+
background: #64ffda;
|
| 183 |
+
border-radius: 50%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
cursor: pointer;
|
|
|
|
| 185 |
}
|
| 186 |
|
| 187 |
+
.speed-value {
|
| 188 |
+
font-size: 14px;
|
| 189 |
+
min-width: 30px;
|
| 190 |
+
text-align: center;
|
| 191 |
}
|
| 192 |
|
| 193 |
.fullscreen-button {
|
|
|
|
| 272 |
background: linear-gradient(90deg, transparent, #64ffda, transparent);
|
| 273 |
margin: 20px 0;
|
| 274 |
}
|
| 275 |
+
|
| 276 |
+
/* 全画面時のスタイル */
|
| 277 |
+
.video-container:-webkit-full-screen {
|
| 278 |
+
width: 100%;
|
| 279 |
+
height: 100%;
|
| 280 |
+
background-color: black;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.video-container:-webkit-full-screen video {
|
| 284 |
+
width: 100%;
|
| 285 |
+
height: 100%;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.video-container:-webkit-full-screen .video-controls {
|
| 289 |
+
position: fixed;
|
| 290 |
+
bottom: 0;
|
| 291 |
+
left: 0;
|
| 292 |
+
right: 0;
|
| 293 |
+
width: 100%;
|
| 294 |
+
border-radius: 0;
|
| 295 |
+
}
|
| 296 |
</style>
|
| 297 |
</head>
|
| 298 |
<body>
|
| 299 |
<h1>高度な音声動画プレイヤー</h1>
|
| 300 |
|
| 301 |
<div class="container">
|
| 302 |
+
<div class="video-container" id="video-container">
|
| 303 |
<video id="video" muted>
|
| 304 |
<source src="v.mp4" type="video/mp4">
|
| 305 |
</video>
|
|
|
|
| 316 |
<input type="range" class="volume-slider" id="volume-slider" min="0" max="1" step="0.01" value="1">
|
| 317 |
</div>
|
| 318 |
<div class="speed-control">
|
| 319 |
+
<span class="speed-value" id="speed-value">1x</span>
|
| 320 |
+
<input type="range" class="speed-slider" id="speed-slider" min="0.25" max="3" step="0.25" value="1">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
</div>
|
| 322 |
<button class="control-button fullscreen-button" id="fullscreen-btn">⛶</button>
|
| 323 |
</div>
|
|
|
|
| 345 |
<input type="range" id="global-volume" min="0" max="3" step="0.1" value="1">
|
| 346 |
<span id="global-volume-value">1</span>
|
| 347 |
</div>
|
| 348 |
+
<div class="setting-item">
|
| 349 |
+
<label for="settings-speed">再生速度:</label>
|
| 350 |
+
<input type="range" id="settings-speed" min="0.25" max="3" step="0.25" value="1">
|
| 351 |
+
<span id="settings-speed-value">1x</span>
|
| 352 |
+
</div>
|
| 353 |
</div>
|
| 354 |
|
| 355 |
<div class="tech-decoration"></div>
|
|
|
|
| 396 |
document.addEventListener('DOMContentLoaded', function() {
|
| 397 |
// 要素を取得
|
| 398 |
const video = document.getElementById('video');
|
| 399 |
+
const videoContainer = document.getElementById('video-container');
|
| 400 |
const playPauseBtn = document.getElementById('play-pause-btn');
|
| 401 |
const timeDisplay = document.getElementById('time-display');
|
| 402 |
const progressContainer = document.getElementById('progress-container');
|
|
|
|
| 404 |
const progressTime = document.getElementById('progress-time');
|
| 405 |
const volumeBtn = document.getElementById('volume-btn');
|
| 406 |
const volumeSlider = document.getElementById('volume-slider');
|
| 407 |
+
const speedSlider = document.getElementById('speed-slider');
|
| 408 |
+
const speedValue = document.getElementById('speed-value');
|
| 409 |
+
const settingsSpeedSlider = document.getElementById('settings-speed');
|
| 410 |
+
const settingsSpeedValue = document.getElementById('settings-speed-value');
|
| 411 |
const fullscreenBtn = document.getElementById('fullscreen-btn');
|
| 412 |
const playBtn = document.getElementById('play-btn');
|
| 413 |
const pauseBtn = document.getElementById('pause-btn');
|
|
|
|
| 545 |
}
|
| 546 |
}
|
| 547 |
|
| 548 |
+
// 再生速度スライダー (動画プレイヤー)
|
| 549 |
+
speedSlider.addEventListener('input', function() {
|
| 550 |
+
const speed = parseFloat(this.value);
|
| 551 |
+
speedValue.textContent = `${speed}x`;
|
| 552 |
+
updatePlaybackRate(speed);
|
| 553 |
});
|
| 554 |
|
| 555 |
+
// 再生速度スライダー (設定メニュー)
|
| 556 |
+
settingsSpeedSlider.addEventListener('input', function() {
|
| 557 |
+
const speed = parseFloat(this.value);
|
| 558 |
+
settingsSpeedValue.textContent = `${speed}x`;
|
| 559 |
+
speedSlider.value = speed;
|
| 560 |
+
speedValue.textContent = `${speed}x`;
|
| 561 |
+
updatePlaybackRate(speed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 562 |
});
|
| 563 |
|
| 564 |
+
// 再生速度を更新
|
| 565 |
+
function updatePlaybackRate(speed) {
|
| 566 |
+
video.playbackRate = speed;
|
| 567 |
+
|
| 568 |
+
// 音声の再生速度も更新
|
| 569 |
+
audioFiles.forEach(file => {
|
| 570 |
+
if (audioSources[file]) {
|
| 571 |
+
audioSources[file].playbackRate.value = speed;
|
| 572 |
+
}
|
| 573 |
+
});
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
// 全画面ボタン
|
| 577 |
fullscreenBtn.addEventListener('click', function() {
|
| 578 |
+
if (videoContainer.requestFullscreen) {
|
| 579 |
+
videoContainer.requestFullscreen();
|
| 580 |
+
} else if (videoContainer.webkitRequestFullscreen) {
|
| 581 |
+
videoContainer.webkitRequestFullscreen();
|
| 582 |
+
} else if (videoContainer.msRequestFullscreen) {
|
| 583 |
+
videoContainer.msRequestFullscreen();
|
| 584 |
}
|
| 585 |
});
|
| 586 |
|
| 587 |
+
// 全画面変更イベント
|
| 588 |
+
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
| 589 |
+
document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
|
| 590 |
+
document.addEventListener('msfullscreenchange', handleFullscreenChange);
|
| 591 |
+
|
| 592 |
+
function handleFullscreenChange() {
|
| 593 |
+
const isFullscreen = document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
|
| 594 |
+
if (isFullscreen) {
|
| 595 |
+
// 全画面時の処理
|
| 596 |
+
video.controls = false;
|
| 597 |
+
} else {
|
| 598 |
+
// 通常表示時の処理
|
| 599 |
+
video.controls = false; // ブラウザのコントロールは非表示のまま
|
| 600 |
+
}
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
// 音声ファイルを読み込む
|
| 604 |
function loadAudioFiles() {
|
| 605 |
audioFiles.forEach(file => {
|
|
|
|
| 765 |
loadAudioFiles();
|
| 766 |
updateVolumeIcon();
|
| 767 |
volumeSlider.value = video.volume;
|
| 768 |
+
video.controls = false; // ブラウザのコントロールを非表示
|
| 769 |
});
|
| 770 |
</script>
|
| 771 |
</body>
|