fix subtitle offset

This commit is contained in:
j 2015-04-21 16:40:35 +05:30
parent 2097e111a2
commit 6a5cb61880

View file

@ -1323,6 +1323,9 @@ Ox.VideoPlayer = function(options, self) {
togglePaused('button'); togglePaused('button');
} }
} }
self.$subtitle && self.$subtitle.animate({
bottom: getCSS('subtitle').bottom
}, 250);
that.triggerEvent('durationchange', { that.triggerEvent('durationchange', {
duration: self.options.duration duration: self.options.duration
}); });
@ -1509,14 +1512,20 @@ Ox.VideoPlayer = function(options, self) {
marginLeft: -self.timelineImageWidth + 'px' marginLeft: -self.timelineImageWidth + 'px'
}; };
} else if (element == 'subtitle') { } else if (element == 'subtitle') {
var offset = 0,
videoCSS;
if (self.options.subtitlesOffset) {
videoCSS = getVideoCSS();
offset = Math.floor((
self.options.subtitlesOffset / 100
) * videoCSS.height) + videoCSS.top;
offset = Math.max(offset, 0);
}
css = { css = {
bottom: ( bottom: (
Math.floor(self.height / 16) Math.floor(self.height / 16)
+ Math.floor( + offset
self.options.subtitlesOffset / 100 * self.height + (!!self.controlsBottomAreVisible * 16)
)
+ (self.options.subtitlesOffset ? getVideoCSS().top : 0)
+ !!self.controlsBottomAreVisible * 16
) + 'px', ) + 'px',
width: self.width + 'px', width: self.width + 'px',
fontSize: Math.floor(self.height / 20) + 'px', fontSize: Math.floor(self.height / 20) + 'px',
@ -1949,6 +1958,9 @@ Ox.VideoPlayer = function(options, self) {
if (self.options.enableKeyboard && self.options.focus == 'load') { if (self.options.enableKeyboard && self.options.focus == 'load') {
that.gainFocus(); that.gainFocus();
} }
self.$subtitle && self.$subtitle.animate({
bottom: getCSS('subtitle').bottom
}, 250);
that.triggerEvent('loadedmetadata'); that.triggerEvent('loadedmetadata');
} }