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
@@ -162,12 +162,15 @@ function M.create(ctx)
|
||||
and not (state.overlay_running and state.auto_play_ready_signal_seen == true)
|
||||
end
|
||||
|
||||
-- A warm playlist advance keeps the already-ready overlay window, and the app only reports
|
||||
-- readiness when content first loads, so a restarted spinner would never clear (#315).
|
||||
local function should_show_overlay_loading_osd()
|
||||
return (
|
||||
resolve_overlay_loading_osd_enabled()
|
||||
or (resolve_auto_start_enabled() and resolve_auto_start_visible_overlay_enabled())
|
||||
)
|
||||
and not state.suppress_ready_overlay_restore
|
||||
and not (state.overlay_running and state.overlay_content_ready_seen == true)
|
||||
end
|
||||
|
||||
local function start_overlay_when_socket_ready(generation, media_identity, same_media_loaded, attempt)
|
||||
@@ -311,6 +314,7 @@ function M.create(ctx)
|
||||
process.stop_overlay_loading_osd()
|
||||
clear_pending_visible_overlay_hide()
|
||||
state.auto_play_ready_signal_seen = false
|
||||
state.overlay_content_ready_seen = false
|
||||
state.current_media_identity = nil
|
||||
state.current_media_title = nil
|
||||
state.pending_reload_media_identity = nil
|
||||
|
||||
@@ -46,7 +46,12 @@ function M.create(ctx)
|
||||
process.hold_auto_play_ready_gate()
|
||||
end)
|
||||
mp.register_script_message("subminer-overlay-loading-ready", function()
|
||||
process.stop_overlay_loading_osd()
|
||||
process.mark_overlay_content_ready()
|
||||
end)
|
||||
-- Sent when the app dismisses loading while its overlay window has no content (hidden mid-load,
|
||||
-- or a replaced window).
|
||||
mp.register_script_message("subminer-overlay-loading-dismissed", function()
|
||||
process.mark_overlay_content_not_ready()
|
||||
end)
|
||||
mp.register_script_message("subminer-stats-toggle", function()
|
||||
if opts.osd_messages then
|
||||
|
||||
@@ -282,6 +282,19 @@ function M.create(ctx)
|
||||
clear_overlay_loading_osd_deadline()
|
||||
end
|
||||
|
||||
-- Handles the app's subminer-overlay-loading-ready message.
|
||||
local function mark_overlay_content_ready()
|
||||
state.overlay_content_ready_seen = true
|
||||
stop_overlay_loading_osd()
|
||||
end
|
||||
|
||||
-- Handles subminer-overlay-loading-dismissed: the app's current overlay window has no content
|
||||
-- (hidden mid-load, or a replaced window), so earlier readiness no longer applies.
|
||||
local function mark_overlay_content_not_ready()
|
||||
state.overlay_content_ready_seen = false
|
||||
stop_overlay_loading_osd()
|
||||
end
|
||||
|
||||
local function start_overlay_loading_osd()
|
||||
if state.overlay_loading_osd_active then
|
||||
return
|
||||
@@ -741,6 +754,7 @@ function M.create(ctx)
|
||||
|
||||
state.overlay_running = false
|
||||
state.auto_play_ready_signal_seen = false
|
||||
state.overlay_content_ready_seen = false
|
||||
subminer_log("error", "process", "Overlay start failed after retries: " .. reason)
|
||||
stop_overlay_loading_osd()
|
||||
show_osd("Overlay start failed")
|
||||
@@ -795,6 +809,7 @@ function M.create(ctx)
|
||||
state.overlay_running = false
|
||||
state.texthooker_running = false
|
||||
state.auto_play_ready_signal_seen = false
|
||||
state.overlay_content_ready_seen = false
|
||||
stop_overlay_loading_osd()
|
||||
disarm_auto_play_ready_gate()
|
||||
show_osd("Stopped")
|
||||
@@ -934,6 +949,7 @@ function M.create(ctx)
|
||||
state.overlay_running = false
|
||||
state.texthooker_running = false
|
||||
state.auto_play_ready_signal_seen = false
|
||||
state.overlay_content_ready_seen = false
|
||||
state.suppress_ready_overlay_restore = false
|
||||
state.force_ready_overlay_restore = true
|
||||
disarm_auto_play_ready_gate({ resume_playback = false })
|
||||
@@ -957,6 +973,7 @@ function M.create(ctx)
|
||||
if not success or (result and result.status ~= 0) then
|
||||
state.overlay_running = false
|
||||
state.auto_play_ready_signal_seen = false
|
||||
state.overlay_content_ready_seen = false
|
||||
subminer_log(
|
||||
"error",
|
||||
"process",
|
||||
@@ -1035,6 +1052,8 @@ function M.create(ctx)
|
||||
disarm_auto_play_ready_gate = disarm_auto_play_ready_gate,
|
||||
start_overlay_loading_osd = start_overlay_loading_osd,
|
||||
stop_overlay_loading_osd = stop_overlay_loading_osd,
|
||||
mark_overlay_content_ready = mark_overlay_content_ready,
|
||||
mark_overlay_content_not_ready = mark_overlay_content_not_ready,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ function M.new()
|
||||
auto_play_ready_osd_timer = nil,
|
||||
auto_play_ready_signal_seen = false,
|
||||
auto_play_ready_initial_pause_ownership_consumed = false,
|
||||
-- The running overlay has reported its content ready at least once; warm playlist advances
|
||||
-- reuse that window, so they must not restart the loading spinner (#315).
|
||||
overlay_content_ready_seen = false,
|
||||
overlay_loading_osd_active = false,
|
||||
overlay_loading_osd_timer = nil,
|
||||
overlay_loading_osd_deadline = nil,
|
||||
|
||||
Reference in new issue
Block a user