From f2f24d528f71e59c81d6172c24da2f412ca18d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Thu, 10 Mar 2022 22:11:50 +0100 Subject: [PATCH] fix(ttml): Center subtitles by default (#4023) Closes: https://github.com/shaka-project/shaka-player/issues/4015 --- 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_(