mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-28 18:00:59 -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 { Device, Producer, Transport } from "mediasoup-client/lib/types";
|
||||||
|
|
||||||
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import Signaling from "./Signaling";
|
import Signaling from "./Signaling";
|
||||||
import {
|
import {
|
||||||
ProduceType,
|
ProduceType,
|
||||||
|
@ -58,6 +60,8 @@ export default class VoiceClient extends EventEmitter<VoiceEvents> {
|
||||||
|
|
||||||
this.isDeaf = false;
|
this.isDeaf = false;
|
||||||
|
|
||||||
|
const state = useApplicationState();
|
||||||
|
|
||||||
this.signaling.on(
|
this.signaling.on(
|
||||||
"data",
|
"data",
|
||||||
(json) => {
|
(json) => {
|
||||||
|
@ -65,11 +69,13 @@ export default class VoiceClient extends EventEmitter<VoiceEvents> {
|
||||||
switch (json.type) {
|
switch (json.type) {
|
||||||
case WSEventType.UserJoined: {
|
case WSEventType.UserJoined: {
|
||||||
this.participants.set(data.id, {});
|
this.participants.set(data.id, {});
|
||||||
|
state.settings.sounds.playSound("call_join");
|
||||||
this.emit("userJoined", data.id);
|
this.emit("userJoined", data.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WSEventType.UserLeft: {
|
case WSEventType.UserLeft: {
|
||||||
this.participants.delete(data.id);
|
this.participants.delete(data.id);
|
||||||
|
state.settings.sounds.playSound("call_leave");
|
||||||
this.emit("userLeft", data.id);
|
this.emit("userLeft", data.id);
|
||||||
|
|
||||||
if (this.recvTransport) this.stopConsume(data.id);
|
if (this.recvTransport) this.stopConsume(data.id);
|
||||||
|
|
Loading…
Reference in a new issue