fix video player poster aspect ratio
This commit is contained in:
parent
ab06286f8c
commit
4583f7bd77
1 changed files with 13 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue