From fb3df376f6e4381cd2ef0263e8a775a0d43a5727 Mon Sep 17 00:00:00 2001 From: Alvaro Velad Date: Thu, 10 Mar 2022 07:40:41 +0100 Subject: [PATCH] fix(ttml): Subtitles are not centered by default --- lib/text/ttml_text_parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/text/ttml_text_parser.js b/lib/text/ttml_text_parser.js index 83f48bd312..de34a05241 100644 --- a/lib/text/ttml_text_parser.js +++ b/lib/text/ttml_text_parser.js @@ -544,8 +544,10 @@ shaka.text.TtmlTextParser = class { cue.textAlign = Cue.textAlign[align.toUpperCase()]; } else { - // Default value is START: https://bit.ly/32OGmvo - cue.textAlign = Cue.textAlign.START; + // Default value is START in the TTML spec: https://bit.ly/32OGmvo + // But to make the subtitle render consitent with other players and the + // shaka.text.Cue we use CENTER + cue.textAlign = Cue.textAlign.CENTER; } const displayAlign = TtmlTextParser.getStyleAttribute_(