Skip to content

Commit

Permalink
osc.lua: observe playlist-count instead of playlist property
Browse files Browse the repository at this point in the history
Observing playlist property with "native" type is too expensive for
larger playlists, and we only observe this property to
activate/deactivate next/prev buttons on the osc. We actually only need
to know if the playlist-count has changed, nothing else.

Fixes: #15264
  • Loading branch information
llyyr authored and sfan5 committed Nov 6, 2024
1 parent 91d4e6f commit 168fb56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ end
mp.register_event("shutdown", shutdown)
mp.register_event("start-file", request_init)
mp.observe_property("track-list", "native", request_init)
mp.observe_property("playlist", "native", request_init)
mp.observe_property("playlist-count", "native", request_init)
mp.observe_property("chapter-list", "native", function(_, list)
list = list or {} -- safety, shouldn't return nil
table.sort(list, function(a, b) return a.time < b.time end)
Expand Down

0 comments on commit 168fb56

Please sign in to comment.