From 9d8168f54695807e28eafcc316d45e1379fc3ce5 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 30 Jul 2013 15:28:05 -0400 Subject: api.js: chrome needs addEventListener for playing --- www/js/api.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'www') 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; }, -- cgit v1.2.3-70-g09d2