Skip to content

Commit

Permalink
feat(WebVTT): Add support to auto position (#5532)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Aug 25, 2023
1 parent 0056c0a commit a8f7c41
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/text/vtt_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit a8f7c41

Please sign in to comment.