soiz1 commited on
Commit
3070df2
·
1 Parent(s): cf299ae

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +41 -36
index.html CHANGED
@@ -992,7 +992,7 @@ document.addEventListener('DOMContentLoaded', function() {
992
  }
993
  }
994
 
995
- // 音量を適用
996
  function applyVolume() {
997
  if (!isAudioCombined) return;
998
 
@@ -1332,28 +1332,34 @@ function applyVolume() {
1332
  togglePlayPause();
1333
  });
1334
 
1335
- // 音量コントロール
1336
- volumeSlider.addEventListener('input', function() {
1337
- if (!isAudioCombined) return;
1338
- video.volume = this.value;
1339
- lastVolume = this.value;
1340
- updateVolumeIcon();
1341
- });
1342
 
1343
- // 音量ボタン
1344
- volumeBtn.addEventListener('click', function() {
1345
- if (!isAudioCombined) return;
1346
-
1347
- if (video.volume > 0) {
1348
- lastVolume = video.volume;
1349
- video.volume = 0;
1350
- volumeSlider.value = 0;
1351
- } else {
1352
- video.volume = lastVolume;
1353
- volumeSlider.value = lastVolume;
1354
- }
1355
- updateVolumeIcon();
1356
- });
 
 
 
 
 
 
 
 
 
 
 
1357
 
1358
  // 音量アイコンを更新
1359
  function updateVolumeIcon() {
@@ -1456,20 +1462,19 @@ function applyVolume() {
1456
  });
1457
  });
1458
 
1459
- globalVolumeSlider.addEventListener('input', function() {
1460
- const value = parseFloat(this.value);
1461
- // 表示値は0-10の範囲で表示
1462
- globalVolumeValue.textContent = value.toFixed(1);
1463
-
1464
- // スライダーの背景を更新
1465
- const percent = (value - this.min) / (this.max - this.min) * 100;
1466
- this.style.backgroundSize = `${percent}% 100%`;
1467
-
1468
- // 合成後に音量を適用(0-1の範囲に変換)
1469
- if (isAudioCombined) {
1470
- applyVolume();
1471
- }
1472
- });
1473
 
1474
  // ループ設定変更時
1475
  loopCheckbox.addEventListener('change', function() {
 
992
  }
993
  }
994
 
995
+ // 音量を適用 (リアルタイムで反映)
996
  function applyVolume() {
997
  if (!isAudioCombined) return;
998
 
 
1332
  togglePlayPause();
1333
  });
1334
 
1335
+ volumeSlider.addEventListener('input', function() {
1336
+ if (!isAudioCombined) return;
 
 
 
 
 
1337
 
1338
+ // グローバル音量係数を考慮
1339
+ const baseVolume = parseFloat(this.value);
1340
+ const globalVolume = parseFloat(globalVolumeSlider.value) / 10;
1341
+ const finalVolume = Math.max(0, Math.min(1, baseVolume * globalVolume));
1342
+
1343
+ video.volume = finalVolume;
1344
+ lastVolume = baseVolume; // ベース音量を保存
1345
+ updateVolumeIcon();
1346
+ });
1347
+
1348
+ volumeBtn.addEventListener('click', function() {
1349
+ if (!isAudioCombined) return;
1350
+
1351
+ if (video.volume > 0) {
1352
+ lastVolume = volumeSlider.value; // ベース音量を保存
1353
+ video.volume = 0;
1354
+ volumeSlider.value = 0;
1355
+ } else {
1356
+ // グローバル音量係数を考慮して復元
1357
+ const globalVolume = parseFloat(globalVolumeSlider.value) / 10;
1358
+ video.volume = Math.max(0, Math.min(1, lastVolume * globalVolume));
1359
+ volumeSlider.value = lastVolume;
1360
+ }
1361
+ updateVolumeIcon();
1362
+ });
1363
 
1364
  // 音量アイコンを更新
1365
  function updateVolumeIcon() {
 
1462
  });
1463
  });
1464
 
1465
+ // グローバル音量スライダーのイベントリスナーを更新
1466
+ globalVolumeSlider.addEventListener('input', function() {
1467
+ const value = parseFloat(this.value);
1468
+ // 表示値は0-10の範囲で表示
1469
+ globalVolumeValue.textContent = value.toFixed(1);
1470
+
1471
+ // スライダーの背景を更新
1472
+ const percent = (value - this.min) / (this.max - this.min) * 100;
1473
+ this.style.backgroundSize = `${percent}% 100%`;
1474
+
1475
+ // 音量をリアルタイムで適用
1476
+ applyVolume();
1477
+ });
 
1478
 
1479
  // ループ設定変更時
1480
  loopCheckbox.addEventListener('change', function() {