summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-03-05 16:56:45 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-03-05 16:56:45 -0500
commit3a2f43e8d5c85a116845c360902f268fd2798ffa (patch)
tree3fb05200422ac1a544d2cd93f938b8408e21e53d /www/js
parent7b49a8bed0a6c8e50adba8fc6c53c39d330bfa0c (diff)
downloadhtml5ks-3a2f43e8d5c85a116845c360902f268fd2798ffa.tar.xz
html5ks-3a2f43e8d5c85a116845c360902f268fd2798ffa.zip
add (untested) php and htaccess
Diffstat (limited to 'www/js')
-rw-r--r--www/js/api.js17
1 files changed, 13 insertions, 4 deletions
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;