mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-25 23:22:06 -05:00
Use server configuration for voso websocket.
This commit is contained in:
parent
0494f0647a
commit
d5430a7920
1 changed files with 14 additions and 13 deletions
|
@ -95,7 +95,10 @@ class VoiceStateReference {
|
||||||
try {
|
try {
|
||||||
const call = await channel.joinCall();
|
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(() => {
|
runInAction(() => {
|
||||||
this.status = VoiceStatus.AUTHENTICATING;
|
this.status = VoiceStatus.AUTHENTICATING;
|
||||||
|
@ -144,30 +147,27 @@ class VoiceStateReference {
|
||||||
}
|
}
|
||||||
|
|
||||||
isDeaf() {
|
isDeaf() {
|
||||||
if(!this.client)
|
if (!this.client) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return this.client.isDeaf;
|
return this.client.isDeaf;
|
||||||
}
|
}
|
||||||
|
|
||||||
async startDeafen() {
|
async startDeafen() {
|
||||||
if(!this.client)
|
if (!this.client) return console.log("No client object"); // ! TODO: let the user know
|
||||||
return console.log("No client object"); // ! TODO: let the user know
|
|
||||||
|
|
||||||
this.client.isDeaf = true;
|
this.client.isDeaf = true;
|
||||||
|
|
||||||
this.client?.consumers.forEach(consumer => {
|
this.client?.consumers.forEach((consumer) => {
|
||||||
consumer.audio?.pause();
|
consumer.audio?.pause();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
async stopDeafen() {
|
async stopDeafen() {
|
||||||
if(!this.client)
|
if (!this.client) return console.log("No client object"); // ! TODO: let the user know
|
||||||
return console.log("No client object"); // ! TODO: let the user know
|
|
||||||
|
|
||||||
this.client.isDeaf = false;
|
this.client.isDeaf = false;
|
||||||
this.client?.consumers.forEach(consumer => {
|
this.client?.consumers.forEach((consumer) => {
|
||||||
consumer.audio?.resume();
|
consumer.audio?.resume();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async startProducing(type: ProduceType) {
|
async startProducing(type: ProduceType) {
|
||||||
|
@ -179,10 +179,11 @@ class VoiceStateReference {
|
||||||
if (navigator.mediaDevices === undefined)
|
if (navigator.mediaDevices === undefined)
|
||||||
return console.log("No media devices."); // ! TODO: let the user know
|
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({
|
const mediaStream = await navigator.mediaDevices.getUserMedia({
|
||||||
audio: mediaDevice?{deviceId: mediaDevice}:true
|
audio: mediaDevice ? { deviceId: mediaDevice } : true,
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.client?.startProduce(
|
await this.client?.startProduce(
|
||||||
|
|
Loading…
Reference in a new issue