Skip to content

Instantly share code, notes, and snippets.

@stutstev
Last active December 2, 2024 14:18
Show Gist options
  • Save stutstev/95caf9dc23d1daefc2f02cf542ac556c to your computer and use it in GitHub Desktop.
Save stutstev/95caf9dc23d1daefc2f02cf542ac556c to your computer and use it in GitHub Desktop.
-- description : continuously reattempts playback of mpv streams upon network errors.
-- author : char101 (github.com/char101)
function check_stream()
local prev_pos = 0
local time_pos = mp.get_property_number('time-pos')
if time_pos == prev_pos then
mp.commandv('loadfile', mp.get_property('path'), 'replace')
end
prev_pos = time_pos
end
mp.add_periodic_timer(5, check_stream)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment