Skip to content

Commit

Permalink
Merge pull request #1019 from quizlet/ta-fix-onError
Browse files Browse the repository at this point in the history
fix onError lost in refactor of decodeAudioData
  • Loading branch information
goldfire authored Aug 25, 2018
2 parents 4f27c15 + bc5d261 commit 0fb67f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2228,21 +2228,21 @@
* @param {Howl} self
*/
var decodeAudioData = function(arraybuffer, self) {
// Fire a load error if something broke.
var error = function() {
self._emit('loaderror', null, 'Decoding audio data failed.');
};

// Load the sound on success.
var success = function(buffer) {
if (buffer && self._sounds.length > 0) {
cache[self._src] = buffer;
loadSound(self, buffer);
} else {
onError();
error();
}
};

// Fire a load error if something broke.
var error = function() {
self._emit('loaderror', null, 'Decoding audio data failed.');
};

// Decode the buffer into an audio source.
if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) {
Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error);
Expand Down

0 comments on commit 0fb67f7

Please sign in to comment.