Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
content.data = data;
eventBus.trigger(Events.TTML_TO_PARSE, content);
const imsc1doc = fromXML(content.data, function (msg) {
errorMsg = msg;
}, metadataHandler);
eventBus.trigger(Events.TTML_PARSED, {ttmlString: content.data, ttmlDoc: imsc1doc});
const mediaTimeEvents = imsc1doc.getMediaTimeEvents();
for (i = 0; i < mediaTimeEvents.length; i++) {
let isd = generateISD(imsc1doc, mediaTimeEvents[i], function (error) {
errorMsg = error;
});
if (isd.contents.some(topLevelContents => topLevelContents.contents.length)) {
//be sure that mediaTimeEvents values are in the mp4 segment time ranges.
startTime = (mediaTimeEvents[i] + offsetTime) < startTimeSegment ? startTimeSegment : (mediaTimeEvents[i] + offsetTime);
endTime = (mediaTimeEvents[i + 1] + offsetTime) > endTimeSegment ? endTimeSegment : (mediaTimeEvents[i + 1] + offsetTime);
if (startTime < endTime) {
captionArray.push({
start: startTime,
end: endTime,
type: 'html',
cueID: getCueID(),
isd: isd,
images: images,