Closed Luni-4 closed 3 years ago
You can't seek before the file is loaded. As an alternative, consider passing the start
option to either the MPV object or to MPV.loadfile
.
Yep, you're right, I inverted the lines:
import mpv
player = mpv.MPV(ytdl=False, osc=True, loglevel="info", log_handler=print)
player.play('/path/to/file.mkv')
player.seek("00:01:14.0", "absolute", "exact")
player.wait_for_playback()
but I get the same error.
Instead, the start
option inside the MPV
object works, but unfortunately I need the seek
function
I think this is the duplicate of GH-79. Maybe we should have a context manager whose __enter__
waits for basic properties to initialize and __exit__
calls wait_for_playback
, but I'm not sure which mpv properties should be considered as basic.
Thank you @McSinyx! I tried the solution described in the duplicate issue and now it works perfectly! :)
I'm on
Ubuntu 20.10
withpython-mpv 0.5.2
. When I try to launch this script:I get the following error:
Am I doing something wrong? Thanks in advance for your help! :)