Skip to content

Commit

Permalink
TextDisplayer: enable showing captions in multiple lines
Browse files Browse the repository at this point in the history
Set css style white-space to 'pre', so that when the captions text
contains a line break '\n', the captions will display in seperate lines.

Change-Id: I623d48ab2bbd82bb9dd3f2565c723d6ce35285e1
  • Loading branch information
michellezhuogg committed Mar 19, 2019
1 parent af3f93d commit f1c11e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/text_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ shaka.ui.TextDisplayer = class {
const captionsStyle = captions.style;
const panelStyle = this.textContainer_.style;

// Set white-space to 'pre' to enable showing line breaks in the text.
captionsStyle.whiteSpace = 'pre';
captions.textContent = cue.payload;
captionsStyle.backgroundColor = cue.backgroundColor;
captionsStyle.color = cue.color;
Expand Down

0 comments on commit f1c11e4

Please sign in to comment.