tomasklaen / uosc

Feature-rich minimalist proximity-based UI for MPV player.
GNU Lesser General Public License v2.1
1.79k stars 68 forks source link

Timeline not rendered when opening a YouTube video in paused state #982

Closed FichteFoll closed 1 month ago

FichteFoll commented 1 month ago

When opening a video that needs time to load, such as a YouTube video,and you pause that video before it can start playing, uosc 5.4.0 doesn't show the timeline anymore – neither on hover, nor when flashing or toggling it. Everything else renders fine. One way to cause it to properly render is resizing the window, as is seeking of course.

I suspect this is a caching issue where the update of the video length doesn't reach the timeline component and does not cause it to re-evaluate its render data or similar.

tomasklaen commented 1 month ago

Timeline doesn't render when either duration or time are nil. No idea why resizing a window would have an effect on that.

If this worked before, the only commit I suspect might be causing the issue is #969 by @po5.

FichteFoll commented 1 month ago

My assumption is that resizing the window causes some properties to be re-read, at which point it sees that whatever was nil before (duration probably) is now not nil anymore and the timeline can be rendered again.

tomasklaen commented 1 month ago

Does this fix it for you?

diff --git a/src/uosc/main.lua b/src/uosc/main.lua
index 7765572..acad20f 100644
--- a/src/uosc/main.lua
+++ b/src/uosc/main.lua
@@ -451,8 +451,8 @@ function update_fullormaxed()
 end

 function update_duration()
-   state.duration = state._duration and ((state.rebase_start_time == false and state.start_time)
-       and (state._duration + state.start_time) or state._duration)
+   set_state('duration', state._duration and ((state.rebase_start_time == false and state.start_time)
+       and (state._duration + state.start_time) or state._duration))
    update_human_times()
 end
FichteFoll commented 1 month ago

Yes, I am 100% unable to reproduce with this patch for a video I had about 70% fail rate before.

tomasklaen commented 1 month ago

Cool. The fix is already in the commit above (dc7c822).