mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-24 19:19:21 +00:00
Fix play of second leave sound
This commit is contained in:
@@ -318,12 +318,24 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
(
|
(
|
||||||
reason: "timeout" | "user" | "allOthersLeft" | "decline" | "error",
|
reason: "timeout" | "user" | "allOthersLeft" | "decline" | "error",
|
||||||
): void => {
|
): void => {
|
||||||
let playSound: CallEventSounds = "left";
|
let audioPromise: Promise<void> | undefined = undefined;
|
||||||
if (reason === "timeout" || reason === "decline") playSound = reason;
|
switch (reason) {
|
||||||
|
case "allOthersLeft":
|
||||||
|
// When "allOthersLeft", the leaveSoundEffect$ in CallEventAudioRenderer
|
||||||
|
// already plays the "left" sound when the remote participant's media
|
||||||
|
// disappears. Playing it here too would cause the sound to play twice.
|
||||||
|
break;
|
||||||
|
case "timeout":
|
||||||
|
case "decline":
|
||||||
|
audioPromise = leaveSoundContext.current?.playSound(reason);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
audioPromise = leaveSoundContext.current?.playSound("left");
|
||||||
|
}
|
||||||
|
|
||||||
setJoined(false);
|
setJoined(false);
|
||||||
setLeft(true);
|
setLeft(true);
|
||||||
const audioPromise = leaveSoundContext.current?.playSound(playSound);
|
|
||||||
// We need to wait until the callEnded event is tracked on PostHog,
|
// We need to wait until the callEnded event is tracked on PostHog,
|
||||||
// otherwise the iframe may get killed first.
|
// otherwise the iframe may get killed first.
|
||||||
const posthogRequest = new Promise((resolve) => {
|
const posthogRequest = new Promise((resolve) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user