mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-22 04:46:07 -08:00
fix(mpv): reset per-file state when a same-file reload skips the path clear (#323)
mpv only sends the latest value of an observed property, and only after its IPC thread has handled queued commands and events. A same-file `loadfile replace` can therefore arrive with no `path=null`, so path comparisons see no change, the autoplay gate stays released for that path and drops every ready signal, and playback stays paused. Track an `end-file` that mpv has not followed with a different path. If it is still pending at `file-loaded`, replay the clear and read the path back, so consumers see the same sequence as any other load. `file-loaded` waits for the reply so plugins can read their media snapshot during the event. Fixes #320
This commit is contained in:
1 parent
8e29cb3c55
commit
1c50d249e0
4 files changed
+167
-11
No files matched your search
@@ -142,6 +142,7 @@ export class MpvIpcClient implements MpvClient {
|
||||
private hasConnectedOnce = false;
|
||||
private socketErrorWarnedForDisconnect = false;
|
||||
public currentVideoPath = '';
|
||||
private awaitingPathChangeAfterEndFile = false;
|
||||
public currentMediaTitle: string | null = null;
|
||||
public currentTimePos = 0;
|
||||
public currentSubStart = 0;
|
||||
@@ -489,10 +490,15 @@ export class MpvIpcClient implements MpvClient {
|
||||
autoLoadSecondarySubTrack: (path: string) => {
|
||||
this.autoLoadSecondarySubTrack(path);
|
||||
},
|
||||
getCurrentVideoPath: () => this.currentVideoPath,
|
||||
setCurrentVideoPath: (value: string) => {
|
||||
this.currentVideoPath = value;
|
||||
this.currentMediaTitle = null;
|
||||
},
|
||||
getAwaitingPathChangeAfterEndFile: () => this.awaitingPathChangeAfterEndFile,
|
||||
setAwaitingPathChangeAfterEndFile: (value: boolean) => {
|
||||
this.awaitingPathChangeAfterEndFile = value;
|
||||
},
|
||||
emitSecondarySubtitleVisibility: (payload) => {
|
||||
this.emit('secondary-subtitle-visibility', payload);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user