Skip to content

Commit

Permalink
fix(TizenVideo): clean ssa props from subtitles text
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Oct 25, 2024
1 parent 1f5af01 commit 95b42a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/TizenVideo/TizenVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var ERROR = require('../error');
var getTracksData = require('../tracksData');
var createAVPlay = require('./AVPlay');

var SSA_DESCRIPTORS_REGEX = /^\{(\\\w+\d+)+\}/;

function TizenVideo(options) {
options = options || {};

Expand Down Expand Up @@ -50,10 +52,12 @@ function TizenVideo(options) {
async function renderSubtitle(duration, text) {
if (disabledSubs) return;
var now = await getProp('time');
var cleanedText = text.replace(SSA_DESCRIPTORS_REGEX, '');

// we ignore custom delay here, it's not needed for embedded subs
lastSub = {
duration: duration,
text: text,
text: cleanedText,
now: now,
};
if (subtitleTimeout) {
Expand All @@ -69,7 +73,7 @@ function TizenVideo(options) {
subtitlesElement.style.opacity = subtitlesOpacity;

var cueNode = document.createElement('span');
cueNode.innerHTML = text;
cueNode.innerHTML = cleanedText;
cueNode.style.display = 'inline-block';
cueNode.style.padding = '0.2em';
cueNode.style.fontSize = Math.floor(size / 25) + 'vmin';
Expand Down

0 comments on commit 95b42a9

Please sign in to comment.