mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(app): let a sound restart immediately after being stopped (#1960)
This commit is contained in:
1 parent
38a299d852
commit
38e86acffe
1 file changed
+1
-1
@@ -499,6 +499,7 @@ export function clearCustomSoundCache(type?: SoundType): void {
|
|||||||
export async function stopSound(type: SoundType): Promise<void> {
|
export async function stopSound(type: SoundType): Promise<void> {
|
||||||
const activeSound = activeSounds.get(type);
|
const activeSound = activeSounds.get(type);
|
||||||
if (!activeSound) return;
|
if (!activeSound) return;
|
||||||
|
activeSounds.delete(type);
|
||||||
const {audio, gainNode, sourceNode} = activeSound;
|
const {audio, gainNode, sourceNode} = activeSound;
|
||||||
try {
|
try {
|
||||||
await fadeOut(gainNode, 0.08);
|
await fadeOut(gainNode, 0.08);
|
||||||
@@ -507,7 +508,6 @@ export async function stopSound(type: SoundType): Promise<void> {
|
|||||||
audio.currentTime = 0;
|
audio.currentTime = 0;
|
||||||
audio.loop = false;
|
audio.loop = false;
|
||||||
disconnectNodes(sourceNode, gainNode);
|
disconnectNodes(sourceNode, gainNode);
|
||||||
activeSounds.delete(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function stopAllSounds(): Promise<void> {
|
export async function stopAllSounds(): Promise<void> {
|
||||||
|
|||||||
Reference in new issue
Block a user