From 5deeff54e19003703e7ffb3ee1d3406c3092ebf9 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Tue, 14 Jul 2015 00:39:28 +0200 Subject: [PATCH] Include URL in audio load error message. --- src/yuu/audio.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/yuu/audio.js b/src/yuu/audio.js index 0e543a7..cc00cf7 100644 --- a/src/yuu/audio.js +++ b/src/yuu/audio.js @@ -89,7 +89,7 @@ currentTime: { alias: "_ctx.currentTime" }, - decodeAudioData: function (data) { + decodeAudioData: function (data, hint) { var ctx = this._ctx; try { return ctx.decodeAudioData(data); @@ -98,7 +98,8 @@ ctx.decodeAudioData(data, function (buffer) { resolve(buffer); }, function () { - reject(new Error("Error decoding audio buffer")); + reject(new Error("Error decoding audio buffer" + + (hint ? ": " + hint : ""))); }); }); } @@ -174,7 +175,9 @@ var url = yuu.resourcePath(path, "sound", "wav"); this.data = null; this.ready = yuu.GET(url, { responseType: "arraybuffer" }) - .then(ctx.decodeAudioData.bind(ctx)) + .then(function (data) { + return ctx.decodeAudioData(data, url); + }) .then(yf.setter.bind(this, "buffer")) .then(yf.K(this)); } -- 2.20.1