mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 06:32:08 -05:00
feat: add sounds when user joins/leaves call (#587)
This commit is contained in:
parent
2b8b9c959f
commit
4c87bc54a8
1 changed files with 6 additions and 0 deletions
|
@ -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<VoiceEvents> {
|
|||
|
||||
this.isDeaf = false;
|
||||
|
||||
const state = useApplicationState();
|
||||
|
||||
this.signaling.on(
|
||||
"data",
|
||||
(json) => {
|
||||
|
@ -65,11 +69,13 @@ export default class VoiceClient extends EventEmitter<VoiceEvents> {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue