Skip to content

Commit

Permalink
address comments 1
Browse files Browse the repository at this point in the history
  • Loading branch information
semarche committed Mar 5, 2024
1 parent 618f304 commit 0b9b2fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,8 @@ export default class Player extends FakeEventTarget {
if (textTrackDisplaySetting) {
const textDisplaySettings: any = Utils.Object.mergeDeep({}, textTrackDisplaySetting, {
position: 'auto',
align: textStyle?.textAlign || 'center' // overwrite cue align for if native text-tracks uses
// align - backward compatibility || new caption alignment API || default value
align: textTrackDisplaySetting?.align || textStyle?.textAlign || 'center'
});
this.setTextDisplaySettings(textDisplaySettings);
}
Expand Down Expand Up @@ -1713,10 +1714,8 @@ export default class Player extends FakeEventTarget {
}

private _resetCustomSubtitleStyles(): void {
const sheet = this._getSubtitleStyleSheet();
while (sheet.cssRules.length) {
sheet.deleteRule(0);
}
const element = Utils.Dom.getElementBySelector(`.${this._playerId}.${SUBTITLES_STYLE_CLASS_NAME}`);
element?.remove();
}

private _applyCustomSubtitleStyles(): void {
Expand All @@ -1737,7 +1736,7 @@ export default class Player extends FakeEventTarget {
sheet.insertRule(`#${this._playerId} .shaka-text-container > * { ${this._textStyle.toCSS()} }`, 0);
}
} catch (e) {
Player._logger.error(e.message);
Player._logger.error(`Failed to add custom text style: ${e.message}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/track/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class Track {
private static _langComparer(inputLanguages: [string, (string | undefined)], trackLang: string, equal?: boolean): boolean {
//first check is there is a complete match
for(const language of inputLanguages) {
if(language?.trim() !== "") {
if(language?.trim() !== '') {
if (equal) {
if(this._isLangEqual(language, trackLang))
return true;
Expand Down

0 comments on commit 0b9b2fa

Please sign in to comment.