Prevent sound notification to throw an exception on mobile

This commit is contained in:
Jérémie Astori 2016-11-08 01:02:56 -05:00
parent e21ec8b447
commit dff1a48e05

View File

@ -1011,7 +1011,11 @@ $(function() {
if (msg.highlight || (options.notifyAllMessages && msg.type === "message")) { if (msg.highlight || (options.notifyAllMessages && msg.type === "message")) {
if (!document.hasFocus() || !$(target).hasClass("active")) { if (!document.hasFocus() || !$(target).hasClass("active")) {
if (options.notification) { if (options.notification) {
try {
pop.play(); pop.play();
} catch (exception) {
// On mobile, sounds can not be played without user interaction.
}
} }
toggleNotificationMarkers(true); toggleNotificationMarkers(true);