Commit 308cbf5f authored by JC Brand's avatar JC Brand

Call `canPlayType` as documented on MDN

parent 1d14bdb0
...@@ -113,11 +113,13 @@ ...@@ -113,11 +113,13 @@
let audio; let audio;
if (_converse.play_sounds && !_.isUndefined(window.Audio)) { if (_converse.play_sounds && !_.isUndefined(window.Audio)) {
audio = new Audio(_converse.sounds_path+"msg_received.ogg"); audio = new Audio(_converse.sounds_path+"msg_received.ogg");
if (audio.canPlayType('/audio/ogg')) { if (audio.canPlayType('audio/ogg')) {
audio.play(); audio.play();
} else { } else {
audio = new Audio(_converse.sounds_path+"msg_received.mp3"); audio = new Audio(_converse.sounds_path+"msg_received.mp3");
audio.play(); if (audio.canPlayType('audio/mp3')) {
audio.play();
}
} }
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment