Skip to content

Commit

Permalink
fix(FEC-12539): Shaka text displayer font size too small on TVs (#208)
Browse files Browse the repository at this point in the history
solves: FEC-12539 - Regression 

**issue:** the previous fix is incorrect since the media query refers to the screen size and not the player size

**fix:** The :fullscreen [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) is not applied in samrtTvs, so instead i relying on the Env.IsSmartTv env variable
  • Loading branch information
JonathanTGold authored Sep 29, 2022
1 parent 125e11d commit f224a1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 0 additions & 6 deletions src/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@
:-ms-fullscreen .shaka-text-container {
font-size: 4.4vmin;
}

@media screen and (min-width: 1240px) {
.shaka-text-container {
font-size: 4.4vmin;
}
}
16 changes: 12 additions & 4 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import shaka from 'shaka-player';
import {
Env,
AudioTrack,
BaseMediaSourceAdapter,
Error,
Expand Down Expand Up @@ -398,17 +399,24 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
//Need to call this again cause we are uninstalling the VTTCue polyfill to avoid collisions with other libs
shaka.polyfill.installAll();
this._shaka = new shaka.Player();
// This will force the player to use shaka UITextDisplayer plugin to render text tracks.
if (this._config.useShakaTextTrackDisplay) {
this._shaka.setVideoContainer(Utils.Dom.getElementBySelector('.playkit-subtitles'));
}
this._setTextDisplayer();
this._maybeSetFilters();
this._maybeSetDrmConfig();
this._maybeBreakStalls();
this._shaka.configure(this._config.shakaConfig);
this._addBindings();
}

_setTextDisplayer() {
// This will force the player to use shaka UITextDisplayer plugin to render text tracks.
if (this._config.useShakaTextTrackDisplay) {
this._shaka.setVideoContainer(Utils.Dom.getElementBySelector('.playkit-subtitles'));
if (Env.isSmartTV) {
document.querySelector('.shaka-text-container').style.fontsize = '4.4vmin';
}
}
}

_clearStallInterval(): void {
if (this._stallInterval) {
clearInterval(this._stallInterval);
Expand Down

0 comments on commit f224a1e

Please sign in to comment.