Last active
April 16, 2020 10:17
-
-
Save aglitchman/6696a1e6a6c9498e93bab0e20aa4020b to your computer and use it in GitHub Desktop.
Defold recently dropped support of Internet Explorer 11 for HTML5 builds. If you want to run your game on IE11 then add this code to your engine_template.html right after the <body> tag. Tested on Defold 1.2.167. Changelog: 2020-04-16 - Added "resume" implementation for AudioContext for Edge ≤18, Chrome <41, Firefox <40 browsers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="old-browser-support"> | |
if (!(navigator.getGamepads || navigator.webkitGetGamepads)) { | |
navigator.getGamepads = function() { return []; }; | |
} | |
if (!(window.AudioContext || window.webkitAudioContext)) { | |
window.AudioContext = function() { | |
this.sampleRate = 44100; | |
this.destination = 0; | |
this.currentTime = 0; | |
this.state = "running"; | |
}; | |
window.AudioContext.prototype.createBuffer = function() { | |
return { | |
getChannelData: function() { return []; } | |
} | |
}; | |
window.AudioContext.prototype.createBufferSource = function() { | |
return { | |
connect: function() {}, | |
start: function() {} | |
} | |
}; | |
} | |
// IE11 + Edge ≤18, Chrome <41, Firefox <40 | |
var audioContext = window.AudioContext || window.webkitAudioContext; | |
if (!audioContext.prototype.resume) { | |
audioContext.prototype.resume = function() {}; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment