fix(overlay): preserve visible state across playlist item transitions (#124)

This commit is contained in:
2026-06-12 23:38:54 -07:00
committed by GitHub
parent 33e767458f
commit 1158be5b39
3 changed files with 62 additions and 0 deletions
@@ -0,0 +1,4 @@
type: fixed
area: overlay
- Kept the visible overlay active while mpv advances to the next playlist item, even when the next episode loads after the warm transition delay.
+12
View File
@@ -51,6 +51,15 @@ function M.create(ctx)
return reason == "reload" or reason == "redirect"
end
local function has_next_playlist_item()
local playlist_count = mp.get_property_number("playlist-count")
local playlist_pos = mp.get_property_number("playlist-pos")
if type(playlist_count) ~= "number" or type(playlist_pos) ~= "number" then
return false
end
return playlist_count > 0 and playlist_pos >= 0 and playlist_pos < playlist_count - 1
end
local function clear_pending_visible_overlay_hide()
local timer = state.pending_visible_overlay_hide_timer
if timer and timer.kill then
@@ -63,6 +72,9 @@ function M.create(ctx)
local resolve_auto_start_visible_overlay_enabled
local function hide_visible_overlay_after_end_file()
if has_next_playlist_item() then
return
end
if state.visible_overlay_requested == true and not resolve_auto_start_visible_overlay_enabled() then
return
end
+46
View File
@@ -69,6 +69,12 @@ local function run_plugin_scenario(config)
if name == "osd-height" then
return config.osd_height or 720
end
if name == "playlist-count" then
return config.playlist_count
end
if name == "playlist-pos" then
return config.playlist_pos
end
return nil
end
@@ -627,6 +633,46 @@ do
)
end
do
local scenario = {
process_list = "",
defer_timeouts = true,
option_overrides = {
binary_path = binary_path,
auto_start = "yes",
auto_start_visible_overlay = "yes",
auto_start_pause_until_ready = "yes",
socket_path = "/tmp/subminer-socket",
},
input_ipc_server = "/tmp/subminer-socket",
path = "/media/slow-episode-01.mkv",
media_title = "Slow Episode 1",
playlist_count = 2,
playlist_pos = 0,
files = {
[binary_path] = true,
},
}
local recorded, err = run_plugin_scenario(scenario)
assert_true(recorded ~= nil, "plugin failed to load for slow warm playlist visibility scenario: " .. tostring(err))
fire_event(recorded, "file-loaded")
recorded.script_messages["subminer-autoplay-ready"]()
fire_event(recorded, "end-file", { reason = "eof" })
fire_pending_timeouts(recorded)
scenario.path = "/media/slow-episode-02.mkv"
scenario.media_title = "Slow Episode 2"
scenario.playlist_pos = 1
fire_event(recorded, "file-loaded")
assert_true(
count_control_calls(recorded.async_calls, "--hide-visible-overlay") == 0,
"slow playlist advance should preserve visible overlay state while the next episode is pending"
)
assert_true(
count_start_calls(recorded.async_calls) == 1,
"slow playlist visibility reuse should not issue another --start command"
)
end
do
local scenario = {
process_list = "",