Skip to content

Commit 9e28680

Browse files
committed
fix more things
1 parent d9c462a commit 9e28680

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/webpage/voice.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ class VoiceFactory {
4444
this.updateSelf();
4545
}
4646
}
47+
disconect() {
48+
if (!this.curChan) return;
49+
this.curChan = null;
50+
this.curGuild = null;
51+
this.handleGateway({
52+
op: 4,
53+
d: {
54+
guild_id: this.curGuild,
55+
channel_id: this.curChan,
56+
self_mute: this.imute,
57+
self_deaf: false,
58+
self_video: false,
59+
flags: 3,
60+
},
61+
});
62+
}
4763
updateSelf() {
4864
if (this.currentVoice && this.currentVoice.open) {
4965
this.handleGateway({
@@ -59,8 +75,8 @@ class VoiceFactory {
5975
});
6076
}
6177
}
62-
curGuild?: string;
63-
curChan?: string;
78+
curGuild: string | null = null;
79+
curChan: string | null = null;
6480
joinVoice(channelId: string, guildId: string, self_mute = false) {
6581
const voice = this.voiceChannels.get(channelId);
6682
this.mute = self_mute;
@@ -152,7 +168,7 @@ class Voice {
152168
this.ws.send(JSON.stringify({op: 3, d: 10}));
153169
}
154170
}
155-
readonly users = new Map<number, string>();
171+
users = new Map<number, string>();
156172
readonly speakingMap = new Map<string, number>();
157173
onSpeakingChange = (_userid: string, _speaking: number) => {};
158174
disconnect(userid: string) {
@@ -826,9 +842,17 @@ a=rtcp-mux\r`;
826842
this.micTrack?.stop();
827843
this.micTrack = undefined;
828844
this.micTrack = undefined;
845+
this.mic = undefined;
829846
this.off = undefined;
830847
this.counter = undefined;
831848
this.offer = undefined;
849+
this.senders = new Set();
850+
this.recivers = new Set();
851+
this.ssrcMap = new Map();
852+
this.fingerprint = undefined;
853+
this.users = new Map();
854+
this.owner.disconect();
855+
console.log(this);
832856
}
833857
}
834858
export {Voice, VoiceFactory};

0 commit comments

Comments
 (0)