mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
@mmcc made it possible to override the font-size of captions and subtitles. closes #1547
This commit is contained in:
parent
e526c9335d
commit
13f154d4d6
@ -11,6 +11,7 @@ CHANGELOG
|
||||
* @seniorflexdeveloper added new translations and translation updates ([view](https://github.com/videojs/video.js/pull/1530))
|
||||
* @chikathreesix exported the videojs.Flash.embed method ([view](https://github.com/videojs/video.js/pull/1533))
|
||||
* @doublex fixed an issue with IE7 backwards compatibility ([view](https://github.com/videojs/video.js/pull/1542))
|
||||
* @mmcc made it possible to override the font-size of captions and subtitles ([view](https://github.com/videojs/video.js/pull/1547))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -944,6 +944,9 @@ body.vjs-full-window {
|
||||
.video-js .vjs-captions { color: #fc6 /* Captions are yellow */; }
|
||||
.vjs-tt-cue { display: block; }
|
||||
|
||||
/* Increase font-size when fullscreen */
|
||||
.video-js.vjs-fullscreen .vjs-text-track { font-size: 3em; }
|
||||
|
||||
/* Hide disabled or unsupported controls */
|
||||
.vjs-default-skin .vjs-hidden { display: none; }
|
||||
|
||||
|
@ -149,8 +149,6 @@ vjs.TextTrack = vjs.Component.extend({
|
||||
this.activeCues_ = [];
|
||||
this.readyState_ = 0;
|
||||
this.mode_ = 0;
|
||||
|
||||
this.player_.on('fullscreenchange', vjs.bind(this, this.adjustFontSize));
|
||||
}
|
||||
});
|
||||
|
||||
@ -308,22 +306,6 @@ vjs.TextTrack.prototype.mode = function(){
|
||||
return this.mode_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the font size of the text track to make it larger when playing in fullscreen mode
|
||||
* and restore it to its normal size when not in fullscreen mode.
|
||||
*/
|
||||
vjs.TextTrack.prototype.adjustFontSize = function(){
|
||||
if (this.player_.isFullscreen()) {
|
||||
// Scale the font by the same factor as increasing the video width to the full screen window width.
|
||||
// Additionally, multiply that factor by 1.4, which is the default font size for
|
||||
// the caption track (from the CSS)
|
||||
this.el_.style.fontSize = screen.width / this.player_.width() * 1.4 * 100 + '%';
|
||||
} else {
|
||||
// Change the font size of the text track back to its original non-fullscreen size
|
||||
this.el_.style.fontSize = '';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create basic div to hold cue text
|
||||
* @return {Element}
|
||||
|
Loading…
Reference in New Issue
Block a user