Skip to content

Commit eef5293

Browse files
committed
osc.lua: fix duration when it becomes available
After recent changes OSC become defunct when duration is updated during playback. Fixes: 02491a3
1 parent 4c220ff commit eef5293

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

player/lua/osc.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ local state = {
338338
playlist_count = 0,
339339
playlist_pos_1 = 0,
340340
duration = nil,
341+
has_duration = false,
341342
pause = false,
342343
volume = 0,
343344
mute = false,
@@ -3203,7 +3204,11 @@ observe_cached("chapter-list", function ()
32033204
request_init()
32043205
end)
32053206
observe_cached("duration", function ()
3206-
if state.chapter_list[1] and state.slider_element then
3207+
local has_duration = state.duration ~= nil and state.duration > 0
3208+
if has_duration ~= state.has_duration then
3209+
state.has_duration = has_duration
3210+
request_init()
3211+
elseif state.chapter_list[1] and state.slider_element then
32073212
update_slider(state.slider_element)
32083213
request_tick()
32093214
end

0 commit comments

Comments
 (0)