From d5430a792088859644d9c879f929eff96b0777b7 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 16 Sep 2021 10:27:33 +0100 Subject: [PATCH] Use server configuration for voso websocket. --- src/lib/vortex/VoiceState.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lib/vortex/VoiceState.ts b/src/lib/vortex/VoiceState.ts index 9ce9efdd..54d143c3 100644 --- a/src/lib/vortex/VoiceState.ts +++ b/src/lib/vortex/VoiceState.ts @@ -95,7 +95,10 @@ class VoiceStateReference { try { const call = await channel.joinCall(); - await this.client.connect("wss://voso.revolt.chat/ws", channel._id); + await this.client.connect( + channel.client.configuration!.features.voso.ws, + channel._id, + ); runInAction(() => { this.status = VoiceStatus.AUTHENTICATING; @@ -144,30 +147,27 @@ class VoiceStateReference { } isDeaf() { - if(!this.client) - return false; + if (!this.client) return false; return this.client.isDeaf; } async startDeafen() { - if(!this.client) - return console.log("No client object"); // ! TODO: let the user know + if (!this.client) return console.log("No client object"); // ! TODO: let the user know this.client.isDeaf = true; - this.client?.consumers.forEach(consumer => { + this.client?.consumers.forEach((consumer) => { consumer.audio?.pause(); - }) + }); } async stopDeafen() { - if(!this.client) - return console.log("No client object"); // ! TODO: let the user know + if (!this.client) return console.log("No client object"); // ! TODO: let the user know this.client.isDeaf = false; - this.client?.consumers.forEach(consumer => { + this.client?.consumers.forEach((consumer) => { consumer.audio?.resume(); - }) + }); } async startProducing(type: ProduceType) { @@ -179,10 +179,11 @@ class VoiceStateReference { if (navigator.mediaDevices === undefined) return console.log("No media devices."); // ! TODO: let the user know - const mediaDevice = window.localStorage.getItem("audioInputDevice"); + const mediaDevice = + window.localStorage.getItem("audioInputDevice"); const mediaStream = await navigator.mediaDevices.getUserMedia({ - audio: mediaDevice?{deviceId: mediaDevice}:true + audio: mediaDevice ? { deviceId: mediaDevice } : true, }); await this.client?.startProduce(