From 5cdad44abf69742ddf4805ddfb5051ba4fb64497 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Tue, 3 May 2022 13:18:27 +0530 Subject: [PATCH] Load sound file on startup (#444) --- public/index.html | 6 ++++++ src/client/state/Notifications.js | 7 ++----- src/index.scss | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index a4a3119..aa6a95e 100644 --- a/public/index.html +++ b/public/index.html @@ -18,5 +18,11 @@
+ + \ No newline at end of file diff --git a/src/client/state/Notifications.js b/src/client/state/Notifications.js index 512b3e7..f0f7a8c 100644 --- a/src/client/state/Notifications.js +++ b/src/client/state/Notifications.js @@ -6,9 +6,6 @@ import cons from './cons'; import navigation from './navigation'; import settings from './settings'; -import NotificationSound from '../../../public/sound/notification.ogg'; -import InviteSound from '../../../public/sound/invite.ogg'; - function isNotifEvent(mEvent) { const eType = mEvent.getType(); if (!cons.supportEventTypes.includes(eType)) return false; @@ -238,14 +235,14 @@ class Notifications extends EventEmitter { _playNotiSound() { if (!this._notiAudio) { - this._notiAudio = new Audio(NotificationSound); + this._notiAudio = document.getElementById('notificationSound'); } this._notiAudio.play(); } _playInviteSound() { if (!this._inviteAudio) { - this._inviteAudio = new Audio(InviteSound); + this._inviteAudio = document.getElementById('inviteSound'); } this._inviteAudio.play(); } diff --git a/src/index.scss b/src/index.scss index b803534..3a4707c 100644 --- a/src/index.scss +++ b/src/index.scss @@ -475,6 +475,10 @@ textarea { supported by Chrome, Edge, Opera and Firefox */ } +audio:not([controls]) { + display: none !important; +} + .flex--center { display: flex; justify-content: center;