Skip to content

Commit

Permalink
Treat captions that are wider than expected as middle aligned
Browse files Browse the repository at this point in the history
Issue: #3534

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178364353
  • Loading branch information
ojw28 committed Dec 12, 2017
1 parent 44a8245 commit fede9c3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,10 @@ public Cue build() {
// The number of empty columns after the end of the text, in the same range.
int endPadding = SCREEN_CHARWIDTH - startPadding - cueString.length();
int startEndPaddingDelta = startPadding - endPadding;
if (captionMode == CC_MODE_POP_ON && Math.abs(startEndPaddingDelta) < 3) {
// Treat approximately centered pop-on captions are middle aligned.
if (captionMode == CC_MODE_POP_ON && (Math.abs(startEndPaddingDelta) < 3 || endPadding < 0)) {
// Treat approximately centered pop-on captions as middle aligned. We also treat captions
// that are wider than they should be in this way. See
// https://github.com/google/ExoPlayer/issues/3534.
position = 0.5f;
positionAnchor = Cue.ANCHOR_TYPE_MIDDLE;
} else if (captionMode == CC_MODE_POP_ON && startEndPaddingDelta > 0) {
Expand Down

0 comments on commit fede9c3

Please sign in to comment.