feat: set uncached ranges as early as possible (#244)

This commit is contained in:
christoph-heinrich
2022-09-23 13:02:42 +02:00
committed by GitHub
parent 01cf36081d
commit 3b2a2f300f

View File

@@ -4267,9 +4267,13 @@ mp.observe_property('osd-dimensions', 'native', function(name, val)
end)
mp.observe_property('display-hidpi-scale', 'native', create_state_setter('hidpi_scale', update_display_dimensions))
mp.observe_property('demuxer-via-network', 'native', create_state_setter('is_stream', function()
set_state('uncached_ranges', state.is_stream and state.duration and {0, state.duration} or nil)
Elements:trigger('dispositions')
end))
mp.observe_property('cache-buffering-state', 'native', function(_, buffering_state)
if buffering_state and buffering_state == 0 and not state.uncached_ranges and state.duration then
set_state('uncached_ranges', {{0, state.duration}})
end
end)
mp.observe_property('demuxer-cache-state', 'native', function(prop, cache_state)
local cached_ranges = cache_state and cache_state['seekable-ranges'] or {}
local uncached_ranges = nil