goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.8k stars 2.22k forks source link

Howl#once('loaderror', ...) doesn't work #670

Open andybarron opened 7 years ago

andybarron commented 7 years ago

Setting the onloaderror config property works, but calling on or once for 'loaderror' doesn't for some reason.

goldfire commented 7 years ago

Can you give sample code? I've just tested with both on and once and both worked for me.

alvisisme commented 7 years ago

The audio element's error event may be binded before on('loaderror') api is called when autoplay option is true.

let audio = new Howl({
  html5: true,
  src: 'audio/not_exist.mp3', // the audio file not exists, should trigger error event
  autoplay: true
});
audio.on('load', function () {
  console.log('==>loaded');
});
/**
 * Other events here. 
 * The delay time is uncertain.
 */
// may run after error event binded
audio.on('loaderror', function (msg) {
  console.log('==>loaderror ' + msg);
});

set the delay time to test

let audio = new Howl({
  html5: true,
  src: 'audio/not_exist.mp3', // the audio file not exists, should trigger error event
  autoplay: true
});
// just test the delay time
setTimeout(function () {
  console.log('loaderror event listened');
  audio.on('loaderror', function (msg) {
    console.log('==>loaderror ' + msg);
  });
  // 10ms is good to catch the error message in my browser but 1000ms is bad
}, 1000);
ibc commented 6 years ago

Yes, confirmed that when running howl.play(); howl.on('loaderror', fn), the "loaderror" event is never fired, even if the src value points to a file that does not exist and autoplay is set to false.

Any news about this bug?

goldfire commented 4 years ago

Closing due to inactivity. If this is still an issue, reply with more info and I'll reopen.

ibc commented 4 years ago

Inactivity, yes, because the report was ignored all this time.

goldfire commented 4 years ago

Inactivity, yes, because the report was ignored all this time.

I've put thousands of hours of work into this open source project. Sorry that my free labor is not sufficient enough for you.

ibc commented 4 years ago

Don't take me wrong. I just meant that this issue does exist and the reports above confirm it. Closing it due to inactivity from the maintainer does not look much legit to me.

goldfire commented 4 years ago

I'm always happy to accept pull requests. The code is open source after all.