Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ local state = {
osc_chapterlist_warned = false,
osc_playlist_warned = false,
osc_tracklist_warned = false,
last_hover_possec = nil,
}

local logo_lines = {
Expand Down Expand Up @@ -1028,6 +1029,18 @@ local function render_elements(master_ass)
local sliderpos = get_slider_value(element)
local tooltiplabel = element.slider.tooltipF(sliderpos)

if element == state.slider_element then
local dur = mp.get_property_number("duration", 0)
if dur > 0 then
local possec = sliderpos * dur / 100
-- Only update if it changed by more than 0.1s to prevent lag
if not state.last_hover_possec or math.abs(state.last_hover_possec - possec) > 0.1 then
mp.set_property_native("user-data/osc/hovered-time", possec)
state.last_hover_possec = possec
end
end
end

local an = slider_lo.tooltip_an

local ty
Expand Down Expand Up @@ -1063,6 +1076,12 @@ local function render_elements(master_ass)
ass_append_alpha(elem_ass, slider_lo.alpha, 0)
elem_ass:append(tooltiplabel)

else
-- clear hover time when mouse leaves the slider
if element == state.slider_element and state.last_hover_possec ~= nil then
mp.set_property_native("user-data/osc/hovered-time", nil)
state.last_hover_possec = nil
end
end
end

Expand Down Expand Up @@ -3024,6 +3043,7 @@ set_time_styles(true, true)
set_tick_delay("display_fps", mp.get_property_number("display_fps"))
visibility_mode(user_opts.visibility, true)
update_duration_watch()
mp.set_property_native("user-data/osc/hovered-time", nil)

set_virt_mouse_area(0, 0, 0, 0, "input")
set_virt_mouse_area(0, 0, 0, 0, "window-controls")
Expand Down
Loading