From 4c87bc54a8a226d90dae7bf5bc73216676db533e Mon Sep 17 00:00:00 2001 From: Evilhotdog <44662495+Evilhotdog@users.noreply.github.com> Date: Fri, 29 Apr 2022 15:22:18 +0100 Subject: [PATCH] feat: add sounds when user joins/leaves call (#587) --- src/lib/vortex/VoiceClient.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/vortex/VoiceClient.ts b/src/lib/vortex/VoiceClient.ts index 8f7b6e42..b84e31eb 100644 --- a/src/lib/vortex/VoiceClient.ts +++ b/src/lib/vortex/VoiceClient.ts @@ -4,6 +4,8 @@ import { types } from "mediasoup-client"; import { Device, Producer, Transport } from "mediasoup-client/lib/types"; +import { useApplicationState } from "../../mobx/State"; + import Signaling from "./Signaling"; import { ProduceType, @@ -58,6 +60,8 @@ export default class VoiceClient extends EventEmitter { this.isDeaf = false; + const state = useApplicationState(); + this.signaling.on( "data", (json) => { @@ -65,11 +69,13 @@ export default class VoiceClient extends EventEmitter { switch (json.type) { case WSEventType.UserJoined: { this.participants.set(data.id, {}); + state.settings.sounds.playSound("call_join"); this.emit("userJoined", data.id); break; } case WSEventType.UserLeft: { this.participants.delete(data.id); + state.settings.sounds.playSound("call_leave"); this.emit("userLeft", data.id); if (this.recvTransport) this.stopConsume(data.id);