From dff1a48e05406eb12527506117fd0bb112505947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Tue, 8 Nov 2016 01:02:56 -0500 Subject: [PATCH] Prevent sound notification to throw an exception on mobile --- client/js/lounge.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 30186cd8..1eab796b 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -1011,7 +1011,11 @@ $(function() { if (msg.highlight || (options.notifyAllMessages && msg.type === "message")) { if (!document.hasFocus() || !$(target).hasClass("active")) { if (options.notification) { - pop.play(); + try { + pop.play(); + } catch (exception) { + // On mobile, sounds can not be played without user interaction. + } } toggleNotificationMarkers(true);