Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created November 25, 2016 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakearchibald/131d7101b134b6f7bed1d8320e4da599 to your computer and use it in GitHub Desktop.
Save jakearchibald/131d7101b134b6f7bed1d8320e4da599 to your computer and use it in GitHub Desktop.
if (!window.AudioContext && window.webkitAudioContext) {
const oldFunc = webkitAudioContext.prototype.decodeAudioData;
webkitAudioContext.prototype.decodeAudioData = function(arraybuffer) {
return new Promise((resolve, reject) => {
oldFunc.call(this, arraybuffer, resolve, reject);
});
}
}
@nomsolence
Copy link

ty for polyfill, here it is with whitespace:

if (!window.AudioContext && window.webkitAudioContext) {
    const oldFunc = webkitAudioContext.prototype.decodeAudioData;
    webkitAudioContext.prototype.decodeAudioData = function(arraybuffer) {
        return new Promise((resolve, reject) => {
            oldFunc.call(this, arraybuffer, resolve, reject);
        });
    }
}

@nomsolence
Copy link

nevermind it was just my github breaking the spaces 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment