mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Use data url
This commit is contained in:
parent
2ecfe57a2e
commit
eaf62c92a7
1 changed files with 16 additions and 2 deletions
|
@ -148,12 +148,26 @@ export function createCastingStateProvider(
|
||||||
|
|
||||||
let captions = null;
|
let captions = null;
|
||||||
|
|
||||||
if (state.source?.caption?.url) {
|
if (state.source?.caption?.id) {
|
||||||
|
let captionIndex: number | undefined;
|
||||||
|
const linkedCaptions = state.meta?.captions;
|
||||||
|
const captionId = state.source?.caption?.id;
|
||||||
|
let trackContentId = "";
|
||||||
|
|
||||||
|
if (linkedCaptions) {
|
||||||
|
linkedCaptions.forEach((caption, index) => {
|
||||||
|
if (!captionIndex && captionId.includes(caption.langIso))
|
||||||
|
captionIndex = index;
|
||||||
|
});
|
||||||
|
if (captionIndex) {
|
||||||
|
trackContentId = linkedCaptions[captionIndex].url;
|
||||||
|
}
|
||||||
|
}
|
||||||
const subtitles = new chrome.cast.media.Track(
|
const subtitles = new chrome.cast.media.Track(
|
||||||
1,
|
1,
|
||||||
chrome.cast.media.TrackType.TEXT
|
chrome.cast.media.TrackType.TEXT
|
||||||
);
|
);
|
||||||
subtitles.trackContentId = state.source?.caption?.url;
|
subtitles.trackContentId = trackContentId;
|
||||||
subtitles.trackContentType = "text/vtt";
|
subtitles.trackContentType = "text/vtt";
|
||||||
subtitles.subtype = chrome.cast.media.TextTrackType.SUBTITLES;
|
subtitles.subtype = chrome.cast.media.TextTrackType.SUBTITLES;
|
||||||
subtitles.name = "Subtitles";
|
subtitles.name = "Subtitles";
|
||||||
|
|
Loading…
Reference in a new issue