Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): let a sound restart immediately after being stopped (#1960)

Hampus38e86acffe14
diff --git a/fluxer_app/src/features/notification/utils/SoundUtils.ts b/fluxer_app/src/features/notification/utils/SoundUtils.ts
index e323fa477..abb032f2e 100644
--- a/fluxer_app/src/features/notification/utils/SoundUtils.ts
+++ b/fluxer_app/src/features/notification/utils/SoundUtils.ts
@@ -499,6 +499,7 @@ export function clearCustomSoundCache(type?: SoundType): void {
export async function stopSound(type: SoundType): Promise<void> {
const activeSound = activeSounds.get(type);
if (!activeSound) return;
+ activeSounds.delete(type);
const {audio, gainNode, sourceNode} = activeSound;
try {
await fadeOut(gainNode, 0.08);
@@ -507,7 +508,6 @@ export async function stopSound(type: SoundType): Promise<void> {
audio.currentTime = 0;
audio.loop = false;
disconnectNodes(sourceNode, gainNode);
- activeSounds.delete(type);
}
export async function stopAllSounds(): Promise<void> {