AudioContext.decodeAudioData() fails with 'EncodingError: Decoding failed' error

See original GitHub issue

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);
    }
  }
...

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
tanzopencommented, Nov 1, 2021

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

3reactions
goldenratiocommented, Oct 29, 2021

Seems to happen even in Safari 15.1 beta any ideas on this? also do we have safari bug issue to track?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari 15 fails to decode audio data that previous versions ...
On my own Safari 15 it works fine, but for some people the call audioContext.decodeAudioData is failing, they just get EncodingError: Decoding ......
Read more >
Specific mp3 file does not decode correctly when using ...
This is a dupe of bug 862088, and it happens because the MP3 file doesn't have an ID3 tag so we fail to...
Read more >
howler.js - Bountysource
AudioContext.decodeAudioData() fails with 'EncodingError: Decoding failed' error $ 0. Created 1 year ago in goldfire/howler.js with 6 comments ...
Read more >
Web Audio API - W3C
The buffer passed to decodeAudioData() has its content-type determined by sniffing, ... In case of failure, set can decode to false.
Read more >
Uncaught (in promise) DOMException: Unable to decode ...
Asked by: locked. Error: Uncaught (in promise) DOMException: Unable to decode audio data - Audio context decoding ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found