From a8f7c41b0744f707fdebb6246ef2c9b6ebabc998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 25 Aug 2023 06:52:07 +0200 Subject: [PATCH] feat(WebVTT): Add support to auto position (#5532) --- lib/text/vtt_text_parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/text/vtt_text_parser.js b/lib/text/vtt_text_parser.js index 863be3853c..58e9620923 100644 --- a/lib/text/vtt_text_parser.js +++ b/lib/text/vtt_text_parser.js @@ -793,7 +793,7 @@ shaka.text.VttTextParser = class { cue.size = Number(results[1]); } else if ((results = // eslint-disable-next-line max-len - /^position:([\d.]+)%(?:,(line-left|line-right|middle|center|start|end))?$/ + /^position:([\d.]+)%(?:,(line-left|line-right|middle|center|start|end|auto))?$/ .exec(word))) { cue.position = Number(results[1]); if (results[2]) { @@ -897,8 +897,10 @@ shaka.text.VttTextParser = class { cue.positionAlign = Cue.positionAlign.LEFT; } else if (align == 'line-right' || align == 'end') { cue.positionAlign = Cue.positionAlign.RIGHT; - } else { + } else if (align == 'center' || align == 'middle') { cue.positionAlign = Cue.positionAlign.CENTER; + } else { + cue.positionAlign = Cue.positionAlign.AUTO; } }