mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 04:46:07 -08:00
fix(plugin): keep loading OSD off on warm playlist advance (#317)
* fix(plugin): keep loading OSD off on warm playlist advance - Track overlay_content_ready_seen when the app sends subminer-overlay-loading-ready - Skip restarting the "Overlay loading" spinner for an overlay that already reported ready, so it no longer times out into "Overlay did not become ready" (#315) - Reset the flag on stop, restart, start failure and shutdown - Add start-gate tests for warm and not-yet-ready playlist advances * fix(plugin): only report overlay ready once content has loaded Hide paths dismissed the loading OSD with subminer-overlay-loading-ready, which the plugin now remembers to skip the spinner on later playlist files. A hide before the overlay had content would wrongly mark it ready. The app now sends ready only when the overlay window content is ready, and a new stop-only subminer-overlay-loading-dismissed message otherwise. * fix(plugin): resync overlay readiness on dismissal and mpv connect A dismissal now clears the plugin's readiness flag, since the app sends it only while its overlay window has no content (e.g. a replaced window). On mpv (re)connect the app resends subminer-overlay-loading-ready when the overlay already has content, so a ready signal lost while mpv was away, or sent before this mpv's plugin existed, still reaches the plugin. * refactor(main): pass overlay readiness handler directly
This commit is contained in:
1 parent
b99409bbcd
commit
848a6c4021
13 files changed
+309
-9
No files matched your search
@@ -153,6 +153,7 @@ function makeDeps(recorder: Recorder): PlaybackAssemblyDeps {
|
||||
),
|
||||
requestAppQuit: spy('requestAppQuit', noop),
|
||||
maybeStartOverlayLoadingOsd: spy('maybeStartOverlayLoadingOsd', noop),
|
||||
reportOverlayContentReadyToPlugin: spy('reportOverlayContentReadyToPlugin', noop),
|
||||
flushQueuedMpvOsdNotifications: spy('flushQueuedMpvOsdNotifications', noop),
|
||||
refreshMpvSessionBindings: spy('refreshMpvSessionBindings', resolved),
|
||||
ensureImmersionTrackerStarted: spy('ensureImmersionTrackerStarted', noop),
|
||||
@@ -212,7 +213,7 @@ test('createPlaybackAssembly does not call its deps while constructing', () => {
|
||||
assert.deepEqual(recorder.names(), []);
|
||||
});
|
||||
|
||||
test('mpv connection starts the loading OSD and flushes queued OSD notifications before session work', () => {
|
||||
test('mpv connection starts the loading OSD, resends overlay readiness, and flushes queued OSD notifications before session work', () => {
|
||||
const { recorder, emit } = setup();
|
||||
|
||||
emit('connection-change', { connected: true });
|
||||
@@ -221,7 +222,11 @@ test('mpv connection starts the loading OSD and flushes queued OSD notifications
|
||||
const osdIndex = names.indexOf('maybeStartOverlayLoadingOsd');
|
||||
assert.ok(osdIndex >= 0);
|
||||
assert.deepEqual(recorder.calls[osdIndex]?.args, []);
|
||||
assert.ok(osdIndex < names.indexOf('flushQueuedMpvOsdNotifications'));
|
||||
assert.ok(osdIndex < names.indexOf('reportOverlayContentReadyToPlugin'));
|
||||
assert.ok(
|
||||
names.indexOf('reportOverlayContentReadyToPlugin') <
|
||||
names.indexOf('flushQueuedMpvOsdNotifications'),
|
||||
);
|
||||
assert.ok(
|
||||
names.indexOf('flushQueuedMpvOsdNotifications') < names.indexOf('refreshMpvSessionBindings'),
|
||||
);
|
||||
|
||||
@@ -205,6 +205,7 @@ export interface PlaybackAssemblyDeps {
|
||||
) => SubtitlePrefetchService;
|
||||
requestAppQuit: () => void;
|
||||
maybeStartOverlayLoadingOsd: OverlayNotificationsRuntime['maybeStartOverlayLoadingOsd'];
|
||||
reportOverlayContentReadyToPlugin: OverlayNotificationsRuntime['reportOverlayContentReadyToPlugin'];
|
||||
flushQueuedMpvOsdNotifications: OverlayNotificationsRuntime['flushQueuedMpvOsdNotifications'];
|
||||
refreshMpvSessionBindings: () => Promise<void>;
|
||||
ensureImmersionTrackerStarted: () => void;
|
||||
@@ -589,6 +590,7 @@ export function createPlaybackAssembly(deps: PlaybackAssemblyDeps) {
|
||||
},
|
||||
onMpvConnected: () => {
|
||||
deps.maybeStartOverlayLoadingOsd();
|
||||
deps.reportOverlayContentReadyToPlugin();
|
||||
deps.flushQueuedMpvOsdNotifications();
|
||||
secondarySubtitleTrackController.scheduleRefresh(0);
|
||||
void deps.refreshMpvSessionBindings();
|
||||
|
||||
Reference in new issue
Block a user