suggested changes

This commit is contained in:
frost768 2023-04-02 18:14:03 +03:00
parent 495222eb10
commit 156b693460
2 changed files with 8 additions and 3 deletions

View File

@ -6,6 +6,7 @@ export enum MWStreamType {
export enum MWCaptionType {
VTT = "vtt",
SRT = "srt",
UNKNOWN = "unknown",
}
export enum MWStreamQuality {
@ -20,7 +21,7 @@ export enum MWStreamQuality {
export type MWCaption = {
needsProxy?: boolean;
url: string;
type?: MWCaptionType;
type: MWCaptionType;
langIso: string;
};

View File

@ -3,7 +3,7 @@ import {
parseSubtitles,
subtitleTypeList,
} from "@/backend/helpers/captions";
import { MWCaption } from "@/backend/helpers/streams";
import { MWCaption, MWCaptionType } from "@/backend/helpers/streams";
import { Icon, Icons } from "@/components/Icon";
import { FloatingCardView } from "@/components/popout/FloatingCard";
import { FloatingView } from "@/components/popout/FloatingView";
@ -47,7 +47,10 @@ export function CaptionSelectionPopout(props: {
const text = await result.text();
parseSubtitles(text); // This will throw if the file is invalid
controls.setCaption(id, blobUrl);
// sometimes this doesn't work, so we add a small delay
setTimeout(() => {
controls.closePopout();
}, 100);
}
);
@ -107,6 +110,7 @@ export function CaptionSelectionPopout(props: {
const customSubtitle = {
langIso: "custom",
url: URL.createObjectURL(e.target.files[0]),
type: MWCaptionType.UNKNOWN,
};
setCaption(customSubtitle, false);
}}