diff --git a/public/index.html b/public/index.html index 0cdd990..d67b765 100644 --- a/public/index.html +++ b/public/index.html @@ -744,7 +744,7 @@ - + diff --git a/public/scripts/ui.js b/public/scripts/ui.js index f29e204..27cae3f 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -991,7 +991,7 @@ class ReceiveFileDialog extends ReceiveDialog { badgeClassName: badgeClassName }); - window.blop.play(); + audioPlayer.playBlop(); await this._nextFiles(); } @@ -2068,7 +2068,7 @@ class ReceiveTextDialog extends Dialog { } _onText(text, peerId) { - window.blop.play(); + audioPlayer.playBlop(); this._receiveTextQueue.push({text: text, peerId: peerId}); this._setDocumentTitleMessages(); if (this.isShown()) return; diff --git a/public/scripts/util.js b/public/scripts/util.js index fc418ff..16c03c3 100644 --- a/public/scripts/util.js +++ b/public/scripts/util.js @@ -62,6 +62,24 @@ window.isMobile = window.iOS || window.android; // Helper functions + +const audioPlayer = (() => { + const blop = document.getElementById('blop'); + blop.addEventListener('ended', _ => { + blop.muted = true + }); + + + return { + playBlop() { + if (window.isMobile) return; + + blop.muted = false; + blop.play(); + } + } +})(); + const zipper = (() => { let zipWriter;