mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
only play one sound per reaction type
This commit is contained in:
@@ -38,13 +38,18 @@ export function ReactionsAudioRenderer(): ReactNode {
|
||||
if (!shouldPlay) {
|
||||
return;
|
||||
}
|
||||
for (const [sender, reaction] of Object.entries(reactions)) {
|
||||
if (oldReactions[sender]) {
|
||||
const oldReactionSet = new Set(
|
||||
Object.values(oldReactions).map((r) => r.name),
|
||||
);
|
||||
for (const reactionName of new Set(
|
||||
Object.values(reactions).map((r) => r.name),
|
||||
)) {
|
||||
if (oldReactionSet.has(reactionName)) {
|
||||
// Don't replay old reactions
|
||||
return;
|
||||
}
|
||||
if (SoundMap[reaction.name]) {
|
||||
audioEngineCtx.playSound(reaction.name);
|
||||
if (SoundMap[reactionName]) {
|
||||
audioEngineCtx.playSound(reactionName);
|
||||
} else {
|
||||
// Fallback sounds.
|
||||
audioEngineCtx.playSound("generic");
|
||||
|
||||
Reference in New Issue
Block a user