Skip to content

Commit

Permalink
Fix TTML positioning and cue externs (#594)
Browse files Browse the repository at this point in the history
A number of TextTrackCue properties were not included in the externs and caused VTT default values to be used instead.  When converting TTML tts:origin values, we need to set VTTCue.snapToLines to false to indicate that cue.line is a percentage value.
  • Loading branch information
birme authored and joeyparrish committed Nov 16, 2016
1 parent 465206b commit 1288111
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions externs/texttrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ TextTrackCue.prototype.positionAlign;

/** @type {string} */
TextTrackCue.prototype.lineAlign;


/** @type {number|null|string} */
TextTrackCue.prototype.line;


/** @type {string} */
TextTrackCue.prototype.vertical;


/** @type {boolean} */
TextTrackCue.prototype.snapToLines;
6 changes: 6 additions & 0 deletions lib/media/ttml_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ shaka.media.TtmlTextParser.addStyle_ = function(
cue.position = Number(results[1]);
cue.line = Number(results[2]);
}
// A boolean indicating whether the line is an integer
// number of lines (using the line dimensions of the first
// line of the cue), or whether it is a percentage of the
// dimension of the video. The flag is set to true when lines
// are counted, and false otherwise.
cue.snapToLines = false;
}
}

Expand Down

0 comments on commit 1288111

Please sign in to comment.