mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-19 20:22:05 +00:00
include delay in copy/paste subtitle feature
This commit is contained in:
parent
35312114be
commit
04b6368a1d
1 changed files with 9 additions and 0 deletions
|
|
@ -231,6 +231,7 @@ export function PasteCaptionOption() {
|
|||
const { t } = useTranslation();
|
||||
const setCaption = usePlayerStore((s) => s.setCaption);
|
||||
const setCustomSubs = useSubtitleStore((s) => s.setCustomSubs);
|
||||
const setDelay = useSubtitleStore((s) => s.setDelay);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
|
|
@ -269,6 +270,13 @@ export function PasteCaptionOption() {
|
|||
id: parsedData.id,
|
||||
});
|
||||
setCustomSubs();
|
||||
|
||||
// Set delay if included in the pasted data, otherwise reset to 0
|
||||
if (parsedData.delay !== undefined) {
|
||||
setDelay(parsedData.delay);
|
||||
} else {
|
||||
setDelay(0);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to paste subtitle:", err);
|
||||
setError(err instanceof Error ? err.message : "Failed to paste subtitle");
|
||||
|
|
@ -394,6 +402,7 @@ export function CaptionsView({
|
|||
isHearingImpaired: v.isHearingImpaired,
|
||||
source: v.source,
|
||||
encoding: v.encoding,
|
||||
delay,
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue