From 43ff113fe93887605f8696ae69095c9c3a44ae8d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 10 Apr 2014 01:35:37 -0700 Subject: [PATCH] forgot to add this file --- src/Images/Video.coffee | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/Images/Video.coffee diff --git a/src/Images/Video.coffee b/src/Images/Video.coffee new file mode 100644 index 000000000..6ee8ef4da --- /dev/null +++ b/src/Images/Video.coffee @@ -0,0 +1,21 @@ +Video = + configure: (video, disableAutoplay) -> + video.loop = true + video.muted = !Conf['Allow Sound'] + video.controls = Conf['Show Controls'] + video.autoplay = false + if Conf['Autoplay'] and not disableAutoplay + Video.start video + else + video.pause() + + start: (video) -> + {controls} = video + video.controls = false + video.play() + # Hacky workaround for Firefox forever-loading bug for very short videos + if controls + $.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !d.contains video), -> + video.controls = true + , 500 +