diff --git a/src/room/GroupCallView.test.tsx b/src/room/GroupCallView.test.tsx index 6d0612b89..a5c3b0d8e 100644 --- a/src/room/GroupCallView.test.tsx +++ b/src/room/GroupCallView.test.tsx @@ -310,7 +310,7 @@ test("Should close widget when all other left and play a sound", async () => { expect(widgetClosedCalled).toBeFalsy(); resolvePlaySound.resolve(); - expect(playSound).toHaveBeenCalledWith("left"); + expect(playSound).toHaveBeenCalledWith("left", 0); await widgetClosedPromise; await flushPromises(); expect(widgetClosedCalled).toBeTruthy(); diff --git a/src/useAudioContext.tsx b/src/useAudioContext.tsx index 4d08dde89..4a7c031ca 100644 --- a/src/useAudioContext.tsx +++ b/src/useAudioContext.tsx @@ -114,7 +114,7 @@ interface Props { } interface UseAudioContext { - playSound(soundName: S): Promise; + playSound(soundName: S, volumeOverwrite?: number): Promise; playSoundLooping(soundName: S, delayS?: number): () => Promise; /** * Map of sound name to duration in seconds. @@ -195,7 +195,7 @@ export function useAudioContext( } return { - playSound: async (name): Promise => { + playSound: async (name, volumeOverwrite?: number): Promise => { if (!audioBuffers[name]) { logger.debug(`Tried to play a sound that wasn't buffered (${name})`); return; @@ -203,7 +203,7 @@ export function useAudioContext( return playSound( audioContext, audioBuffers[name], - soundEffectVolume * earpieceVolume, + volumeOverwrite ?? soundEffectVolume * earpieceVolume, earpiecePan, ); },