cleaned up

This commit is contained in:
Felix Boehme 2023-09-01 15:03:10 +02:00
parent eaf62c92a7
commit 04f67df289
No known key found for this signature in database
GPG Key ID: 7EB0603E4E9642EA

View File

@ -151,14 +151,16 @@ export function createCastingStateProvider(
if (state.source?.caption?.id) {
let captionIndex: number | undefined;
const linkedCaptions = state.meta?.captions;
const captionId = state.source?.caption?.id;
const captionLangIso = state.source?.caption?.id.slice(7);
let trackContentId = "";
if (linkedCaptions) {
linkedCaptions.forEach((caption, index) => {
if (!captionIndex && captionId.includes(caption.langIso))
for (let index = 0; index < linkedCaptions.length; index += 1) {
if (captionLangIso === linkedCaptions[index].langIso) {
captionIndex = index;
});
break;
}
}
if (captionIndex) {
trackContentId = linkedCaptions[captionIndex].url;
}