Skip to content

Commit

Permalink
fix: subtitles line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Jan 19, 2024
1 parent c368992 commit cdbcef3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TizenVideo/TizenVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function TizenVideo(options) {

function renderSubtitle(duration, text) {
if (disabledSubs) return;

// we ignore custom delay here, it's not needed for embedded subs
lastSub = {
duration: duration,
Expand All @@ -60,9 +61,10 @@ function TizenVideo(options) {

subtitlesElement.style.bottom = offset + '%';
var cueNode = document.createElement('span');
cueNode.innerHTML = text;
cueNode.innerHTML = text.replaceAll('<br>', '\n');
cueNode.style.display = 'inline-block';
cueNode.style.padding = '0.2em';
cueNode.style.whiteSpace = 'pre-wrap';
cueNode.style.fontSize = Math.floor(size / 25) + 'vmin';
cueNode.style.color = textColor;
cueNode.style.backgroundColor = backgroundColor;
Expand Down
1 change: 1 addition & 0 deletions src/withHTMLSubtitles/withHTMLSubtitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function withHTMLSubtitles(Video) {
subtitlesRenderer.render(cuesByTime, videoState.time + delay).forEach(function(cueNode) {
cueNode.style.display = 'inline-block';
cueNode.style.padding = '0.2em';
cueNode.style.whiteSpace = 'pre-wrap';
cueNode.style.fontSize = Math.floor(size / 25) + 'vmin';
cueNode.style.color = textColor;
cueNode.style.backgroundColor = backgroundColor;
Expand Down

0 comments on commit cdbcef3

Please sign in to comment.