Skip to content

Commit

Permalink
Prevent issue with IE11 enhanced security audio test
Browse files Browse the repository at this point in the history
Fixes #631
  • Loading branch information
goldfire committed Nov 11, 2016
1 parent 1f7f411 commit ec91a63
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,14 @@
*/
_setupCodecs: function() {
var self = this || Howler;
var audioTest = (typeof Audio !== 'undefined') ? new Audio() : null;
var audioTest = null;

// Must wrap in a try/catch because IE11 in server mode throws an error.
try {
audioTest = (typeof Audio !== 'undefined') ? new Audio() : null;
} catch (err) {
return self;
}

if (!audioTest || typeof audioTest.canPlayType !== 'function') {
return self;
Expand Down

0 comments on commit ec91a63

Please sign in to comment.