de-refactoring

This commit is contained in:
rolux 2015-04-20 09:50:46 +02:00
parent cbcfbe8340
commit fc982fe775

View file

@ -1731,16 +1731,6 @@ Ox.VideoPlayer = function(options, self) {
function getVideoCSS(videoWidth, videoHeight) { function getVideoCSS(videoWidth, videoHeight) {
// optional arguments allow for this function to be used for poster CSS // optional arguments allow for this function to be used for poster CSS
var dimensions = getVideoDimensions(videoWidth, videoHeight);
return {
left: Math.floor((self.width - dimensions[0]) / 2),
top: Math.floor((self.height - dimensions[1]) / 2),
width: dimensions[0],
height: dimensions[1]
};
}
function getVideoDimensions(videoWidth, videoHeight) {
var playerWidth = self.width, var playerWidth = self.width,
playerHeight = self.height, playerHeight = self.height,
playerRatio = playerWidth / playerHeight, playerRatio = playerWidth / playerHeight,
@ -1756,7 +1746,14 @@ Ox.VideoPlayer = function(options, self) {
width = videoIsWider ? playerWidth : playerHeight * videoRatio; width = videoIsWider ? playerWidth : playerHeight * videoRatio;
height = videoIsWider ? playerWidth / videoRatio : playerHeight; height = videoIsWider ? playerWidth / videoRatio : playerHeight;
} }
return [Math.round(width), Math.round(height)]; width = Math.round(width);
height = Math.round(height);
return {
left: Math.floor((self.width - width) / 2),
top: Math.floor((self.height - width) / 2),
width: width,
height: height
};
} }
function getVolumeImage() { function getVolumeImage() {