Skip to content

Commit

Permalink
fix(cxl-ui): cxl-jw-player handle tracks which are improperly formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
anoblet committed Oct 7, 2024
1 parent 64b4d4b commit 1ce7168
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ export function BaseMixin(BaseClass) {
const { file } = chapters.length > 0 ? chapters[0] : '';
const response = await (await fetch(file)).text();
return parseSync(response);
let result = [];
try {
result = parseSync(response);
} catch (e) {
console.error(e);
}
return result;
}
async _getMedia() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ export function TranscriptMixin(BaseClass) {
});
}

return tracks;
const filteredTracks = tracks.map((track) => {
track.data.text = track.data.text.replace("<v ->", "").replace("</v>", "");

return track;
});

return filteredTracks;
}

_onCaptionClick(e) {
Expand Down

0 comments on commit 1ce7168

Please sign in to comment.