[mpv] increase stream delay and slow down when buffering
This commit is contained in:
parent
6c6f769b64
commit
352d20ab18
|
@ -11,6 +11,7 @@ opts.read_options(settings, "catch_up")
|
|||
|
||||
|
||||
local catch_up = false
|
||||
local paused_for_cache = false
|
||||
local catch_up_timeout = 1
|
||||
local catchup_until = settings.catchup_until
|
||||
|
||||
|
@ -19,9 +20,16 @@ function catchup_loop()
|
|||
local remaining = mp.get_property_number("demuxer-cache-duration", 0)
|
||||
|
||||
if remaining < catchup_until then
|
||||
mp.set_property("speed", 1.00)
|
||||
if paused_for_cache then
|
||||
mp.set_property("speed", 1.00 - (settings.speed_up - 1.00))
|
||||
else
|
||||
mp.set_property("speed", 1.00)
|
||||
end
|
||||
else
|
||||
mp.set_property("speed", settings.speed_up)
|
||||
paused_for_cache = false
|
||||
if mp.get_property_number("speed") < settings.speed_up then
|
||||
mp.set_property("speed", settings.speed_up)
|
||||
end
|
||||
end
|
||||
|
||||
if catch_up then
|
||||
|
@ -68,6 +76,17 @@ function on_load()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function on_pause_for_cache(name, value)
|
||||
if value then
|
||||
update_catch_up_until(1)
|
||||
paused_for_cache = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
mp.observe_property("paused-for-cache", "bool", on_pause_for_cache)
|
||||
|
||||
mp.register_event('file-loaded', on_load)
|
||||
|
||||
mp.add_key_binding("P", "catch_up", catchup)
|
||||
|
|
Loading…
Reference in a new issue