Преглед на файлове

Call `canPlayType` as documented on MDN

JC Brand преди 7 години
родител
ревизия
308cbf5fb7
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      src/converse-notification.js

+ 4 - 2
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();
+                        }
                     }
                 }
             };