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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -11
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="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,11 +71,11 @@
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) {
@@ -86,13 +86,12 @@
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 => {
 
51
 
52
  <div class="control-group">
53
  <label for="volumeRange">音量:</label>
54
+ <input type="range" id="volumeRange" min="0" max="300" step="1" value="100">
55
+ <input type="number" id="volumeInput" min="0" max="300" 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 videoSource = audioContext.createMediaElementSource(video);
78
+ videoSource.connect(gainNode);
79
  gainNode.connect(audioContext.destination);
80
 
81
  function updatePlaybackRate(value) {
 
86
  }
87
 
88
  function updateVolume(value) {
89
+ const volume = parseFloat(value) / 100;
90
+ volumeInput.value = value;
91
+ volumeRange.value = value;
92
 
93
+ // 音量は最大3倍まで設定
94
+ gainNode.gain.value = Math.min(volume * 3, 3); // 音量を3倍までに制限
 
95
  }
96
 
97
  ['input', 'change', 'mouseup'].forEach(eventName => {