From 308cbf5fb7ad90176262930dfd7ec9f9d5610a08 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 25 Dec 2017 11:54:17 +0000 Subject: [PATCH] Call `canPlayType` as documented on MDN --- src/converse-notification.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/converse-notification.js b/src/converse-notification.js index 0da9d276a..ce6abc9f5 100644 --- a/src/converse-notification.js +++ b/src/converse-notification.js @@ -113,11 +113,13 @@ let audio; if (_converse.play_sounds && !_.isUndefined(window.Audio)) { audio = new Audio(_converse.sounds_path+"msg_received.ogg"); - if (audio.canPlayType('/audio/ogg')) { + if (audio.canPlayType('audio/ogg')) { audio.play(); } else { audio = new Audio(_converse.sounds_path+"msg_received.mp3"); - audio.play(); + if (audio.canPlayType('audio/mp3')) { + audio.play(); + } } } };