Closed steeley closed 2 years ago
player.pause = True
pauses, player.pause = False
unpauses. If you actually want to close the window use player.terminate()
, but then you will have to create a new MPV()
instance the next time you want to play something.
thanks, it works now. I'm just playing audio (no video) and not wanting to use a gui.
The player does not have a field pause
, I don't know where this is coming from. I have the same problem for video playback, but this solution does not work.
I can start a player( I'm just using audio) and it works fine, but cannot see how to stop. This code plays the file and prints the time, but it just keeps on playing after the sleep interval.
`import mpv import time
player = mpv.MPV() player.play('babylon.wav')
@player.property_observer('time-pos') def time_observer(_name, value): print('Now playing at {:.2f}s'.format(value))
sleep(5) player.stop() player.wait_for_playback()`