Fix the camera open debounce logic

ipad-testing
Noah 2023-08-08 17:55:22 -07:00
parent b3d4b375ed
commit 0e79788e0f
1 changed files with 7 additions and 7 deletions

View File

@ -1463,13 +1463,6 @@ const app = Vue.createApp({
this.ChatClient("Couldn't open video by username: not found.");
},
openVideo(user, force) {
// Debounce so we don't spam too much for the same user.
if (this.WebRTC.debounceOpens[user.username]) return;
this.WebRTC.debounceOpens[user.username] = true;
setTimeout(() => {
delete(this.WebRTC.debounceOpens[user.username]);
}, 5000);
if (user.username === this.username) {
this.ChatClient("You can already see your own webcam.");
return;
@ -1493,6 +1486,13 @@ const app = Vue.createApp({
localStorage["skip-nsfw-modal"] = "true";
}
// Debounce so we don't spam too much for the same user.
if (this.WebRTC.debounceOpens[user.username]) return;
this.WebRTC.debounceOpens[user.username] = true;
setTimeout(() => {
delete(this.WebRTC.debounceOpens[user.username]);
}, 5000);
// Camera is already open? Then disconnect the connection.
if (this.WebRTC.pc[user.username] != undefined && this.WebRTC.pc[user.username].offerer != undefined) {
this.closeVideo(user.username, "offerer");