howler.js
howler.js copied to clipboard
AudioContext.decodeAudioData() fails with 'EncodingError: Decoding failed' error
Safari 15 beta 4 @ MacOS Catalina v10.15.7
The following code fails to play mp3 audio file with EncodingError: Decoding failed
error:
loadAudioWithHowler() {
const audio = new Howl({
src: 'https://bug2report.s3.amazonaws.com/popup.mp3',
preload: false,
html5: false,
})
.on('load', () => {
console.log(`+++ loaded`);
})
.on('loaderror', (id, message) => {
console.log(`+++ error -> ${message}`);
});
audio.load();
}
Corresponding howler.core.js
function with added error
parameter:
...
var decodeAudioData = function(arraybuffer, self) {
// Fire a load error if something broke.
var error = function(error) {
self._emit('loaderror', null, `Decoding audio data failed: ${error}`);
};
// Load the sound on success.
var success = function(buffer) {
if (buffer && self._sounds.length > 0) {
cache[self._src] = buffer;
loadSound(self, buffer);
} else {
error();
}
};
// Decode the buffer into an audio source.
if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) {
Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error);
} else {
Howler.ctx.decodeAudioData(arraybuffer, success, error);
}
}
...
+1 Bump
Would also like to see this resolved. +1
👀 following +1
FYI for everybody following. Apple confirmed this is an issue on their end, and are working to resolve it. Sadly they won't be able to resolve it before their imminent release, so it will be a patch fic post the release.
@slahav I wonder if you could post the source where Apple stated that. Thanks.
We had to switch to html5 audio in desktop Safari 15 as a work-around (using html5: true
). There does not seem to be a way to distinguish Safari 15 on Catalina from Big Sur, and the issue is only present on Catalina.
@goldfire was this fixed in v2.2.3 with #1476 ? https://github.com/goldfire/howler.js/issues/1476#issuecomment-864618792
Seems to happen even in Safari 15.1 beta any ideas on this? also do we have safari bug issue to track?
According to Bugzilla this issue should be already patched in https://bugs.webkit.org/show_bug.cgi?id=230974 Strangely i'm with Safari 15.1 on Catalina 10.15.7 ( official ) and the issue still persists so either patch is not included or it is not working at all ...
I don't see any audio related notes in : https://support.apple.com/en-us/HT212875
There are two duplicates of the issue that highlights the mp3 decoding issue https://bugs.webkit.org/show_bug.cgi?id=231449 https://bugs.webkit.org/show_bug.cgi?id=231872
Seems to happen even in Safari 15.1 beta any ideas on this? also do we have safari bug issue to track?
+1 bump
There doesn't look to be anything that can be done on howler's end to resolve this. Leaving this open for now though so we can continue to track the webkit issue that @tanzopen listed until the fix lands in the released version of Safari on Catalina.
🎉 Good news - on Safari 15.4 MacOS Catalina v10.15.7 there is no more issue(s) with decoding ...
This ticket is now obsolete
I'm on MacOS Monterey 12.3.1 Safari 15.4 (17613.1.17.1.13)
And I am still experiencing this exact issue.