From 3a2f43e8d5c85a116845c360902f268fd2798ffa Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 5 Mar 2014 16:56:45 -0500 Subject: add (untested) php and htaccess --- www/js/api.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'www/js') diff --git a/www/js/api.js b/www/js/api.js index b74c1ae..1452074 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -50,14 +50,22 @@ window.html5ks.api = { html5ks.spin(1); el.oncanplaythrough = function () { + el.oncanplaythrough = null; el.play(); html5ks.spin(-1); }; + setTimeout(function () { + if (el.oncanplaythrough) { + console.warn("video not playing after 3 seconds"); + el.oncanplaythrough(); + } + }, 3000); + el.onerror = function (e) { if (e.code === e.MEDIA_ERR_SRC_NOT_SUPPORTED) { if (_nextType(++i)) { - console.warn("browser claimed support for " + types[i-1] + " but failed"); + console.warn("browser claimed support for " + types[i-1][0] + " but failed"); } else { console.error("no media formats supported"); } @@ -153,7 +161,7 @@ window.html5ks.api = { video.volume = html5ks.persistent.musicVolume; var done = function () { video.style.display = "none"; - video.pause(); + video.src = ""; deferred.resolve(); }; document.addEventListener("keyup", function keyupListener(e) { @@ -164,8 +172,9 @@ window.html5ks.api = { } }, false); video.onclick = function (e) { - if (e.button === 0 && skippable) { - done(); + if (e.button === 0) { + if (video.paused) video.play(); + else if (skippable) done(); } }; video.onended = done; -- cgit v1.2.3-70-g09d2