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 - 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
72 lines
2.2 KiB
Lua
72 lines
2.2 KiB
Lua
local M = {}
|
|
|
|
function M.create(ctx)
|
|
local mp = ctx.mp
|
|
local opts = ctx.opts
|
|
local process = ctx.process
|
|
local ui = ctx.ui
|
|
local state = ctx.state
|
|
|
|
local function register_script_messages()
|
|
mp.register_script_message("subminer-start", function(...)
|
|
process.start_overlay_from_script_message(...)
|
|
end)
|
|
mp.register_script_message("subminer-stop", function()
|
|
process.stop_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-toggle", function()
|
|
process.toggle_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-hidden", function()
|
|
process.record_visible_overlay_visibility(false)
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-shown", function()
|
|
process.record_visible_overlay_visibility(true)
|
|
end)
|
|
mp.register_script_message("subminer-managed-subtitles-loading", function()
|
|
state.skip_managed_subtitle_rearm_once = true
|
|
state.app_managed_playback_pending = true
|
|
end)
|
|
mp.register_script_message("subminer-menu", function()
|
|
ui.show_menu()
|
|
end)
|
|
mp.register_script_message("subminer-options", function()
|
|
process.open_options()
|
|
end)
|
|
mp.register_script_message("subminer-restart", function()
|
|
process.restart_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-status", function()
|
|
process.check_status()
|
|
end)
|
|
mp.register_script_message("subminer-autoplay-ready", function()
|
|
process.notify_auto_play_ready()
|
|
end)
|
|
mp.register_script_message("subminer-autoplay-hold", function()
|
|
process.hold_auto_play_ready_gate()
|
|
end)
|
|
mp.register_script_message("subminer-overlay-loading-ready", function()
|
|
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
|
|
mp.osd_message("Stats: press ` (backtick) in overlay", 3)
|
|
end
|
|
end)
|
|
mp.register_script_message("subminer-reload-session-bindings", function()
|
|
ctx.session_bindings.reload_bindings()
|
|
end)
|
|
end
|
|
|
|
return {
|
|
register_script_messages = register_script_messages,
|
|
}
|
|
end
|
|
|
|
return M
|