diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-30 15:28:05 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-30 15:28:05 -0400 |
commit | 9d8168f54695807e28eafcc316d45e1379fc3ce5 (patch) | |
tree | b48eb0789e5cd031d205992cf8909fb4dd64fd11 /www/js | |
parent | 76ed917899a058a31c82cd6b04641a3e7c1825b5 (diff) | |
download | html5ks-9d8168f54695807e28eafcc316d45e1379fc3ce5.tar.xz html5ks-9d8168f54695807e28eafcc316d45e1379fc3ce5.zip |
api.js: chrome needs addEventListener for playing
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/api.js | 9 |
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; }, |