From 635a26dc482681922b2fad15af2789e91c34a526 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 10 Feb 2014 09:32:08 +0000 Subject: [PATCH] wait if video is currently seeking --- source/Ox.UI/js/Video/VideoElement.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/Video/VideoElement.js b/source/Ox.UI/js/Video/VideoElement.js index 175998aa..af228d0f 100644 --- a/source/Ox.UI/js/Video/VideoElement.js +++ b/source/Ox.UI/js/Video/VideoElement.js @@ -227,7 +227,11 @@ Ox.VideoElement = function(options, self) { } function onLoadedMetadata($video, callback) { - if ($video[0].readyState) { + if ($video[0].seeking) { + $video.one('seeked', function(event) { + callback($video[0]); + }); + } else if ($video[0].readyState) { callback($video[0]); } else { $video.one('loadedmetadata', function(event) { @@ -254,7 +258,6 @@ Ox.VideoElement = function(options, self) { self.video && self.video.pause(); self.currentItem = item; self.currentItemId = self.items[self.currentItem].id; - Ox.Log('Video', 'sCV', self.video.src, item['in']); setCurrentVideo(function() { if (!self.loadedMetadata) { self.loadedMetadata = true; @@ -295,6 +298,8 @@ Ox.VideoElement = function(options, self) { self.video.volume = volume; self.video.muted = muted; self.$video.css(css); + Ox.Log('Video', 'sCV', self.video.src, self.items[self.currentItem]['in'], + self.video.currentTime, self.video.seeking); onLoadedMetadata(self.$video, function(video) { self.$video.one('seeked', function() { self.loading = false;