Skip to content

Commit 39d8053

Browse files
committed
fix current video's timepos not being set correctly
some videos with an embedded time stamp in their URL override the start=+<timepos> argument of loadfile, so we have set the timepos after the video is loaded
1 parent 9103443 commit 39d8053

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

selectformat.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ end
983983
-- this function is a modified version of mpv-reload's reload_resume()
984984
-- https://github.com/4e6/mpv-reload, commit 1a6a938
985985
function reload_resume()
986-
local pos = mp.get_property("time-pos")
986+
local timepos = mp.get_property("time-pos")
987987
local duration = mp.get_property_native("duration")
988988
local plcount = mp.get_property_number("playlist-count")
989989
local plpos = mp.get_property_number("playlist-pos")
@@ -993,8 +993,14 @@ function reload_resume()
993993
playlist[i] = mp.get_property("playlist/" .. i .. "/filename")
994994
end
995995

996-
if pos and isnum(duration) and duration >= 0 then
997-
reload(url, pos)
996+
if timepos and isnum(duration) and duration >= 0 then
997+
local set_time_pos
998+
set_time_pos = function(t)
999+
mp.set_property("time-pos", timepos)
1000+
mp.unregister_event(set_time_pos)
1001+
end
1002+
mp.register_event("file-loaded", set_time_pos)
1003+
reload(url, timepos)
9981004
else
9991005
reload(url, nil)
10001006
end

0 commit comments

Comments
 (0)