Use more robust elapsed/remaining times retrieval and handling

This commit is contained in:
Tomas Sardyha
2020-04-03 23:53:07 +02:00
parent 2ac458f04d
commit 9db7dfc80b

View File

@@ -563,13 +563,13 @@ function render_seekbar(seekbar)
end
-- Elapsed time
local elapsed_seconds = mp.get_property_native("time-pos")
local elapsed_seconds = mp.get_property_native("playback-time")
ass:new_event()
ass:append("{\\blur0\\bord0\\shad0\\1c&H"..options.color_background.."\\fn"..config.font.."\\fs"..seekbar.font_size.."\\clip("..foreground_coordinates..")")
ass:append(ass_opacity(math.min(options.seekbar_opacity + 0.1, 1), seekbar.opacity))
ass:pos(seekbar.spacing, fay + (seekbar.size / 2))
ass:an(4)
ass:append(mp.format_time(elapsed_seconds))
ass:append(mp.format_time(elapsed_seconds or 0))
ass:new_event()
ass:append("{\\blur0\\bord0\\shad1\\1c&H"..options.color_foreground.."\\4c&H"..options.color_background.."\\fn"..config.font.."\\fs"..seekbar.font_size.."\\iclip("..foreground_coordinates..")")
ass:append(ass_opacity(math.min(options.seekbar_opacity + 0.1, 1), seekbar.opacity))
@@ -584,7 +584,7 @@ function render_seekbar(seekbar)
ass:append(ass_opacity(math.min(options.seekbar_opacity + 0.1, 1), seekbar.opacity))
ass:pos(display.width - seekbar.spacing, fay + (seekbar.size / 2))
ass:an(6)
ass:append("-"..mp.format_time(remaining_seconds))
ass:append("-"..mp.format_time(remaining_seconds or 0))
ass:new_event()
ass:append("{\\blur0\\bord0\\shad1\\1c&H"..options.color_foreground.."\\4c&H"..options.color_background.."\\fn"..config.font.."\\fs"..seekbar.font_size.."\\iclip("..foreground_coordinates..")")
ass:append(ass_opacity(math.min(options.seekbar_opacity + 0.1, 1), seekbar.opacity))