mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-05 19:59:20 +00:00
Fix reaction sound
This commit is contained in:
@@ -9,16 +9,17 @@ import { ReactNode, useDeferredValue, useEffect } from "react";
|
|||||||
|
|
||||||
import { useReactions } from "../useReactions";
|
import { useReactions } from "../useReactions";
|
||||||
import { playReactionsSound, useSetting } from "../settings/settings";
|
import { playReactionsSound, useSetting } from "../settings/settings";
|
||||||
import { ReactionSet } from "../reactions";
|
import { GenericReaction, ReactionSet } from "../reactions";
|
||||||
import { prefetchSounds, useAudioContext } from "../useAudioContext";
|
import { prefetchSounds, useAudioContext } from "../useAudioContext";
|
||||||
import { useLatest } from "../useLatest";
|
import { useLatest } from "../useLatest";
|
||||||
|
|
||||||
const SoundMap = Object.fromEntries(
|
const SoundMap = Object.fromEntries([
|
||||||
ReactionSet.filter((v) => v.sound !== undefined).map((v) => [
|
...ReactionSet.filter((v) => v.sound !== undefined).map((v) => [
|
||||||
v.name,
|
v.name,
|
||||||
v.sound!,
|
v.sound!,
|
||||||
]),
|
]),
|
||||||
);
|
[GenericReaction.name, GenericReaction.sound],
|
||||||
|
]);
|
||||||
|
|
||||||
const Sounds = prefetchSounds(SoundMap);
|
const Sounds = prefetchSounds(SoundMap);
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ export function ReactionsAudioRenderer(): ReactNode {
|
|||||||
audioEngineRef.current.playSound(reactionName);
|
audioEngineRef.current.playSound(reactionName);
|
||||||
} else {
|
} else {
|
||||||
// Fallback sounds.
|
// Fallback sounds.
|
||||||
|
console.log("Playing fallback sound");
|
||||||
audioEngineRef.current.playSound("generic");
|
audioEngineRef.current.playSound("generic");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user