Skip to content

Commit

Permalink
fix(FEC-12991): Left-positioned captions are centered on Firefox (#704)
Browse files Browse the repository at this point in the history
issue: we override the positionAlign on VTTCue with no excepted values, so Firefox ignores other values and keep its default value - 'auto'
fix: changed the configuration to use the excepted values, (and keep the old ones for backward compatibility)

solves: FEC-12991
  • Loading branch information
JonathanTGold committed Mar 6, 2023
1 parent e79d961 commit 0edfc96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ var config = {
> lineAlign: string, // ['start', 'center', 'end']
> align: string, // ['start', 'center', 'end', 'left', 'right']
> position: number, //[0 .. 100]
> positionAlign: string, // ['start', 'center', 'end']
> positionAlign: string, // ['line-left', 'center', 'line-right']
> snapToLines: boolean, // [true, false]
> vertical: string, //['', 'lr', 'rl']
> size: number //[0 .. 100]
Expand Down
2 changes: 2 additions & 0 deletions src/track/text-track-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,13 +664,15 @@ class CueStyleBox extends StyleBox {
switch (align) {
case 'start':
case 'left':
case 'line-left':
textPos = cue.position;
break;
case 'center':
textPos = cue.position - cue.size / 2;
break;
case 'end':
case 'right':
case 'line-right':
textPos = cue.position - cue.size;
break;
}
Expand Down

0 comments on commit 0edfc96

Please sign in to comment.