diff --git a/source/Ox.UI/js/Video/VideoPlayer.js b/source/Ox.UI/js/Video/VideoPlayer.js index 3a132007..0fb95441 100644 --- a/source/Ox.UI/js/Video/VideoPlayer.js +++ b/source/Ox.UI/js/Video/VideoPlayer.js @@ -460,8 +460,15 @@ Ox.VideoPlayer = function(options, self) { .attr({ src: self.options.poster }) - .appendTo(self.$videoContainer); - self.posterIsVisible = true; + .one({ + load: function() { + self.$poster.css(getVideoCSS( + self.$poster[0].width, + self.$poster[0].height + )).appendTo(self.$videoContainer); + self.posterIsVisible = true; + } + }); } /* @@ -1560,12 +1567,13 @@ Ox.VideoPlayer = function(options, self) { }, 0); } - function getVideoCSS() { + function getVideoCSS(videoWidth, videoHeight) { + // optional arguments allow for this function to be used for poster CSS var playerWidth = self.width, playerHeight = self.height, playerRatio = playerWidth / playerHeight, - videoWidth = self.videoWidth, - videoHeight = self.videoHeight, + videoWidth = videoWidth || self.videoWidth, + videoHeight = videoHeight || self.videoHeight, videoRatio = videoWidth / videoHeight, videoIsWider = videoRatio > playerRatio, width, height;