soiz1 commited on
Commit
c730992
·
verified ·
1 Parent(s): ebb64a7

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +13 -13
index.html CHANGED
@@ -51,8 +51,8 @@
51
 
52
  <div class="control-group">
53
  <label for="volumeRange">音量:</label>
54
- <input type="range" id="volumeRange" min="0" max="200" step="1" value="100">
55
- <input type="number" id="volumeInput" min="0" max="200" step="1" value="100">%
56
  </div>
57
 
58
  <div class="control-group">
@@ -71,22 +71,13 @@
71
  const volumeInput = document.getElementById('volumeInput');
72
  const loopCheckbox = document.getElementById('loopCheckbox');
73
 
74
- // Web Audio API用のセットアップ
75
  const audioContext = new (window.AudioContext || window.webkitAudioContext)();
76
  const gainNode = audioContext.createGain();
77
  const source = audioContext.createMediaElementSource(video);
78
  source.connect(gainNode);
79
  gainNode.connect(audioContext.destination);
80
 
81
- // 音量を制御する関数
82
- function updateVolume(value) {
83
- const volume = parseFloat(value) / 100;
84
- volumeInput.value = value;
85
- volumeRange.value = value;
86
- gainNode.gain.value = volume;
87
- }
88
-
89
- // 再生速度を制御する関数
90
  function updatePlaybackRate(value) {
91
  const speed = parseFloat(value);
92
  speedInput.value = speed;
@@ -94,7 +85,16 @@
94
  video.playbackRate = speed;
95
  }
96
 
97
- // イベントリスナー
 
 
 
 
 
 
 
 
 
98
  ['input', 'change', 'mouseup'].forEach(eventName => {
99
  speedRange.addEventListener(eventName, () => {
100
  updatePlaybackRate(speedRange.value);
 
51
 
52
  <div class="control-group">
53
  <label for="volumeRange">音量:</label>
54
+ <input type="range" id="volumeRange" min="0" max="100" step="1" value="100">
55
+ <input type="number" id="volumeInput" min="0" max="100" step="1" value="100">%
56
  </div>
57
 
58
  <div class="control-group">
 
71
  const volumeInput = document.getElementById('volumeInput');
72
  const loopCheckbox = document.getElementById('loopCheckbox');
73
 
74
+ // Web Audio API の設定
75
  const audioContext = new (window.AudioContext || window.webkitAudioContext)();
76
  const gainNode = audioContext.createGain();
77
  const source = audioContext.createMediaElementSource(video);
78
  source.connect(gainNode);
79
  gainNode.connect(audioContext.destination);
80
 
 
 
 
 
 
 
 
 
 
81
  function updatePlaybackRate(value) {
82
  const speed = parseFloat(value);
83
  speedInput.value = speed;
 
85
  video.playbackRate = speed;
86
  }
87
 
88
+ function updateVolume(value) {
89
+ const volume = parseFloat(value);
90
+ volumeInput.value = volume;
91
+ volumeRange.value = volume;
92
+
93
+ // 音量を最大3倍に設定
94
+ const volumeLevel = (volume / 100) * 3;
95
+ gainNode.gain.value = Math.min(volumeLevel, 3); // 最大音量3.0に制限
96
+ }
97
+
98
  ['input', 'change', 'mouseup'].forEach(eventName => {
99
  speedRange.addEventListener(eventName, () => {
100
  updatePlaybackRate(speedRange.value);