summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-07-30 15:28:05 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-07-30 15:28:05 -0400
commit9d8168f54695807e28eafcc316d45e1379fc3ce5 (patch)
treeb48eb0789e5cd031d205992cf8909fb4dd64fd11
parent76ed917899a058a31c82cd6b04641a3e7c1825b5 (diff)
downloadhtml5ks-9d8168f54695807e28eafcc316d45e1379fc3ce5.tar.xz
html5ks-9d8168f54695807e28eafcc316d45e1379fc3ce5.zip
api.js: chrome needs addEventListener for playing
-rw-r--r--www/js/api.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/www/js/api.js b/www/js/api.js
index 4869391..3a2c4f5 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -43,14 +43,15 @@ window.html5ks.api = {
var volume = html5ks.persistent[channel + "Volume"];
audio.volume = fade ? 0 : volume;
audio.play();
- audio.onplaying = function () {
- deferred.resolve();
+ audio.addEventListener("playing", function playing() {
+ audio.removeEventListener("playing", playing, false);
if (fade) {
html5ks.api.set_volume(volume, fade, channel);
}
- };
+ deferred.resolve();
+ }, false);
audio.onerror = function () {
- deferred.reject(this.error);
+ throw new Error();
};
return deferred.promise;
},