Fix the camera open debounce logic
This commit is contained in:
parent
b3d4b375ed
commit
0e79788e0f
|
@ -1463,13 +1463,6 @@ const app = Vue.createApp({
|
||||||
this.ChatClient("Couldn't open video by username: not found.");
|
this.ChatClient("Couldn't open video by username: not found.");
|
||||||
},
|
},
|
||||||
openVideo(user, force) {
|
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) {
|
if (user.username === this.username) {
|
||||||
this.ChatClient("You can already see your own webcam.");
|
this.ChatClient("You can already see your own webcam.");
|
||||||
return;
|
return;
|
||||||
|
@ -1493,6 +1486,13 @@ const app = Vue.createApp({
|
||||||
localStorage["skip-nsfw-modal"] = "true";
|
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.
|
// Camera is already open? Then disconnect the connection.
|
||||||
if (this.WebRTC.pc[user.username] != undefined && this.WebRTC.pc[user.username].offerer != undefined) {
|
if (this.WebRTC.pc[user.username] != undefined && this.WebRTC.pc[user.username].offerer != undefined) {
|
||||||
this.closeVideo(user.username, "offerer");
|
this.closeVideo(user.username, "offerer");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user