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