fix : audio volume
This commit is contained in:
@@ -8,7 +8,10 @@ const playSound = async (url: string) => {
|
|||||||
audioContext = new AudioContext();
|
audioContext = new AudioContext();
|
||||||
audio = new Audio();
|
audio = new Audio();
|
||||||
const source = audioContext.createMediaElementSource(audio);
|
const source = audioContext.createMediaElementSource(audio);
|
||||||
source.connect(audioContext.destination);
|
const volume = audioContext.createGain();
|
||||||
|
volume.gain.value = 0.3;
|
||||||
|
source.connect(volume);
|
||||||
|
volume.connect(audioContext.destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.src = url;
|
audio.src = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user