howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

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

Open leshak2k opened this issue 3 years ago • 13 comments

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

leshak2k avatar Aug 27 '21 22:08 leshak2k

+1 Bump

slahav avatar Sep 01 '21 13:09 slahav

Would also like to see this resolved. +1

evanestal avatar Sep 01 '21 15:09 evanestal

👀 following +1

thebarge avatar Sep 01 '21 15:09 thebarge

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 avatar Sep 03 '21 19:09 slahav

@slahav I wonder if you could post the source where Apple stated that. Thanks.

dheimoz avatar Sep 10 '21 22:09 dheimoz

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.

damrbaby avatar Sep 23 '21 14:09 damrbaby

@goldfire was this fixed in v2.2.3 with #1476 ? https://github.com/goldfire/howler.js/issues/1476#issuecomment-864618792

BernsteinA avatar Oct 21 '21 21:10 BernsteinA

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

goldenratio avatar Oct 29 '21 10:10 goldenratio

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

tanzopen avatar Nov 01 '21 10:11 tanzopen

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

+1 bump

tfulpeducationguy avatar Nov 23 '21 17:11 tfulpeducationguy

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.

goldfire avatar Dec 13 '21 01:12 goldfire

🎉 Good news - on Safari 15.4 MacOS Catalina v10.15.7 there is no more issue(s) with decoding ...

This ticket is now obsolete

tanzopen avatar Mar 24 '22 07:03 tanzopen

I'm on MacOS Monterey 12.3.1 Safari 15.4 (17613.1.17.1.13)

And I am still experiencing this exact issue.

llibdude avatar Apr 27 '22 16:04 llibdude