mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 04:46:07 -08:00
fix(overlay): poll cheap playback state in the open subtitle sidebar (#290)
This commit is contained in:
1 parent
7108e086ba
commit
a6d96e9966
14 files changed
+286
-108
No files matched your search
@@ -55,6 +55,7 @@ import type {
|
||||
SubtitleData,
|
||||
SubtitleMiningContext,
|
||||
SubtitlePosition,
|
||||
SubtitleSidebarPlaybackState,
|
||||
SubtitleSidebarSnapshot,
|
||||
SubtitleRendererStyleConfig,
|
||||
SubtitleStyleConfig,
|
||||
@@ -477,6 +478,7 @@ export interface ElectronAPI {
|
||||
getCurrentSubtitleRaw: () => Promise<string>;
|
||||
getCurrentSubtitleAss: () => Promise<string>;
|
||||
getSubtitleSidebarSnapshot: () => Promise<SubtitleSidebarSnapshot>;
|
||||
getSubtitleSidebarPlaybackState: () => Promise<SubtitleSidebarPlaybackState>;
|
||||
copySubtitleSidebarSelection: (text: string) => Promise<void>;
|
||||
getSubtitleSidebarOpen: () => Promise<boolean>;
|
||||
getPlaybackPaused: () => Promise<boolean | null>;
|
||||
|
||||
+13
-3
@@ -226,15 +226,25 @@ export interface SubtitleData {
|
||||
endTime?: number | null;
|
||||
}
|
||||
|
||||
export interface SubtitleSidebarSnapshot {
|
||||
/**
|
||||
* Per-tick sidebar state, served from main's cached state without mpv round-trips. When
|
||||
* `sourceKey` or `cuesRevision` differs from the last full snapshot's, the renderer fetches a
|
||||
* new `SubtitleSidebarSnapshot`.
|
||||
*/
|
||||
export interface SubtitleSidebarPlaybackState {
|
||||
sourceKey: string | null;
|
||||
cues: SubtitleCue[];
|
||||
currentTimeSec?: number | null;
|
||||
/** Bumps whenever main swaps in a different parsed cue array. */
|
||||
cuesRevision: number;
|
||||
currentTimeSec: number | null;
|
||||
currentSubtitle: {
|
||||
text: string;
|
||||
startTime: number | null;
|
||||
endTime: number | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SubtitleSidebarSnapshot extends SubtitleSidebarPlaybackState {
|
||||
cues: SubtitleCue[];
|
||||
config: SubtitleSidebarSnapshotConfig;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user