1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 15:52:25 +00:00

osc.lua: observe playlist-count instead of playlist property

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: https://github.com/mpv-player/mpv/issues/15264
This commit is contained in:
llyyr 2024-11-05 18:26:30 +05:30 committed by sfan5
parent 91d4e6f937
commit 168fb56fe8

View File

@ -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)