From f65f65343049c1c032db408afa316a9b222966c2 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 1 Sep 2023 17:11:17 -0700 Subject: [PATCH] Quick mute all sounds checkbox --- web/static/js/BareRTC.js | 11 ++++++++++- web/templates/chat.html | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 457a133..dca023b 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -133,6 +133,7 @@ const app = Vue.createApp({ exitMessages: false, // hide exit messages by default in public channels watchNotif: true, // notify in chat about cameras being watched closeDMs: false, // ignore unsolicited DMs + muteSounds: false, // mute all sound effects }, // My video feed. @@ -396,6 +397,9 @@ const app = Vue.createApp({ "prefs.watchNotif": function() { localStorage.watchNotif = this.prefs.watchNotif; }, + "prefs.muteSounds": function() { + localStorage.muteSounds = this.prefs.muteSounds; + }, "prefs.closeDMs": function() { localStorage.closeDMs = this.prefs.closeDMs; @@ -603,6 +607,9 @@ const app = Vue.createApp({ if (localStorage.watchNotif != undefined) { this.prefs.watchNotif = localStorage.watchNotif === "true"; } + if (localStorage.muteSounds != undefined) { + this.prefs.muteSounds = localStorage.muteSounds === "true"; + } if (localStorage.closeDMs != undefined) { this.prefs.closeDMs = localStorage.closeDMs === "true"; } @@ -1281,7 +1288,7 @@ const app = Vue.createApp({ description: JSON.stringify(pc.localDescription), })); }).catch(e => { - this.ChatClient(`Error sending WebRTC negotiation message (SDP): ${e}`); + console.error(`Error sending WebRTC negotiation message (SDP): ${e}`); }); }; }, @@ -2450,6 +2457,8 @@ const app = Vue.createApp({ }, playSound(event) { + // Muting all SFX? + if (this.prefs.muteSounds) return; let filename = this.config.sounds.settings[event]; // Do we have an audio track? if (this.config.sounds.audioTracks[filename] != undefined) { diff --git a/web/templates/chat.html b/web/templates/chat.html index c04c85a..178deda 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -184,6 +184,15 @@
+
+ +
+