mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
Simplify reaction sounds
This commit is contained in:
@@ -72,8 +72,8 @@ export function CallEventAudioRenderer({
|
||||
({ joined, ids }) =>
|
||||
ids.length <= MAX_PARTICIPANT_COUNT_FOR_SOUND && joined.length > 0,
|
||||
),
|
||||
throttle((_) => interval(THROTTLE_SOUND_EFFECT_MS)),
|
||||
debounce((_) => interval(DEBOUNCE_SOUND_EFFECT_MS)),
|
||||
throttle(() => interval(THROTTLE_SOUND_EFFECT_MS)),
|
||||
debounce(() => interval(DEBOUNCE_SOUND_EFFECT_MS)),
|
||||
)
|
||||
.subscribe((prev) => {
|
||||
console.log("Playing join sound for", ...prev.joined, "|", prev);
|
||||
@@ -86,8 +86,8 @@ export function CallEventAudioRenderer({
|
||||
({ ids, left }) =>
|
||||
ids.length <= MAX_PARTICIPANT_COUNT_FOR_SOUND && left.length > 0,
|
||||
),
|
||||
throttle((_) => interval(THROTTLE_SOUND_EFFECT_MS)),
|
||||
debounce((_) => interval(DEBOUNCE_SOUND_EFFECT_MS)),
|
||||
throttle(() => interval(THROTTLE_SOUND_EFFECT_MS)),
|
||||
debounce(() => interval(DEBOUNCE_SOUND_EFFECT_MS)),
|
||||
)
|
||||
.subscribe(() => {
|
||||
audioEngineCtx.playSound("left");
|
||||
|
||||
@@ -38,18 +38,13 @@ export function ReactionsAudioRenderer(): ReactNode {
|
||||
if (!shouldPlay) {
|
||||
return;
|
||||
}
|
||||
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)) {
|
||||
for (const [sender, reaction] of Object.entries(reactions)) {
|
||||
if (oldReactions[sender]) {
|
||||
// Don't replay old reactions
|
||||
return;
|
||||
}
|
||||
if (SoundMap[reactionName]) {
|
||||
audioEngineCtx.playSound(reactionName);
|
||||
if (SoundMap[reaction.name]) {
|
||||
audioEngineCtx.playSound(reaction.name);
|
||||
} else {
|
||||
// Fallback sounds.
|
||||
audioEngineCtx.playSound("generic");
|
||||
|
||||
Reference in New Issue
Block a user