Skip to content

Commit 0fb67f7

Browse files
authored
Merge pull request #1019 from quizlet/ta-fix-onError
fix onError lost in refactor of decodeAudioData
2 parents 4f27c15 + bc5d261 commit 0fb67f7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/howler.core.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2228,21 +2228,21 @@
22282228
* @param {Howl} self
22292229
*/
22302230
var decodeAudioData = function(arraybuffer, self) {
2231+
// Fire a load error if something broke.
2232+
var error = function() {
2233+
self._emit('loaderror', null, 'Decoding audio data failed.');
2234+
};
2235+
22312236
// Load the sound on success.
22322237
var success = function(buffer) {
22332238
if (buffer && self._sounds.length > 0) {
22342239
cache[self._src] = buffer;
22352240
loadSound(self, buffer);
22362241
} else {
2237-
onError();
2242+
error();
22382243
}
22392244
};
22402245

2241-
// Fire a load error if something broke.
2242-
var error = function() {
2243-
self._emit('loaderror', null, 'Decoding audio data failed.');
2244-
};
2245-
22462246
// Decode the buffer into an audio source.
22472247
if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) {
22482248
Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error);

0 commit comments

Comments
 (0)