From 13f154d4d671a1fa0952e0b199b5a75dbedcc66c Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Tue, 30 Sep 2014 15:27:05 -0700 Subject: [PATCH] @mmcc made it possible to override the font-size of captions and subtitles. closes #1547 --- CHANGELOG.md | 1 + src/css/video-js.less | 3 +++ src/js/tracks.js | 18 ------------------ 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d82444f..68dd7360e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) -------------------- diff --git a/src/css/video-js.less b/src/css/video-js.less index cd2be602d..78a377cca 100644 --- a/src/css/video-js.less +++ b/src/css/video-js.less @@ -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; } diff --git a/src/js/tracks.js b/src/js/tracks.js index 5965d5c04..873e56eaf 100644 --- a/src/js/tracks.js +++ b/src/js/tracks.js @@ -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}