Skip to content

Commit

Permalink
Merge pull request #111 from Samillion/dev_osconseek_refactor
Browse files Browse the repository at this point in the history
refactor: don't show osc on start when osc_on_seek=yes
  • Loading branch information
Samillion authored Oct 26, 2024
2 parents b526f82 + c6e0d6f commit 3cb9293
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions modernz.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2757,12 +2757,24 @@ mp.observe_property("chapter-list", "native", function(_, list)
request_init()
end)

local last_time = -1 -- last known playback time
local new_file_flag = false -- flag to detect new file starts
mp.observe_property("playback-time", "native", function(_, time)
if time == nil or time < last_time then
new_file_flag = true
elseif time and time > 1 then
new_file_flag = false
end
last_time = time or 0
request_tick()
end)
mp.observe_property("seeking", "native", function(_, seeking)
reset_timeout()
if seeking and user_opts.osc_on_seek then
mp.commandv("script-message-to", "modernz", "osc-show")
if seeking and user_opts.osc_on_seek and not new_file_flag then
show_osc()
end
end)

mp.observe_property("fullscreen", "bool", function(_, val)
state.fullscreen = val
state.marginsREQ = true
Expand All @@ -2789,7 +2801,6 @@ end)
mp.observe_property("display-fps", "number", set_tick_delay)
mp.observe_property("demuxer-cache-state", "native", cache_state)
mp.observe_property("vo-configured", "bool", request_tick)
mp.observe_property("playback-time", "number", request_tick)
mp.observe_property("osd-dimensions", "native", function()
-- (we could use the value instead of re-querying it all the time, but then
-- we might have to worry about property update ordering)
Expand Down

0 comments on commit 3cb9293

Please sign in to comment.