From 95e6e4c36faeda39c80692ce47483d015549514c Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 10 Apr 2014 12:50:12 +0000 Subject: [PATCH] fix setting paused=false before video is loaded on VideoPlayer;fix calling play() on VideoElement before its ready. --- source/Ox.UI/js/Video/VideoElement.js | 10 ++++++---- source/Ox.UI/js/Video/VideoPlayer.js | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Video/VideoElement.js b/source/Ox.UI/js/Video/VideoElement.js index 395b51c7..5c54e429 100644 --- a/source/Ox.UI/js/Video/VideoElement.js +++ b/source/Ox.UI/js/Video/VideoElement.js @@ -459,10 +459,12 @@ Ox.VideoElement = function(options, self) { if (self.ended) { that.currentTime(0); } - self.ended = false; - self.paused = false; - self.seeking = false; - self.video.play(); + isReady(self.$video, function(video) { + self.ended = false; + self.paused = false; + self.seeking = false; + video.play(); + }); return that; }; diff --git a/source/Ox.UI/js/Video/VideoPlayer.js b/source/Ox.UI/js/Video/VideoPlayer.js index 1731dbdd..af654ff4 100644 --- a/source/Ox.UI/js/Video/VideoPlayer.js +++ b/source/Ox.UI/js/Video/VideoPlayer.js @@ -1874,9 +1874,9 @@ Ox.VideoPlayer = function(options, self) { if (!self.options.paused) { self.options.paused = true; - togglePaused('button'); + togglePaused('loadedmetadata'); } else if (self.options.paused && self.playOnLoad) { - togglePaused('button'); + togglePaused('loadedmetadata'); } self.$playButton && self.$playButton.options({disabled: false});