python-mpv icon indicating copy to clipboard operation
python-mpv copied to clipboard

python-mpv not playing

Open jdauthre opened this issue 7 years ago • 4 comments
trafficstars

Hi, using python 3.7 on High Sierra (mac). Have installed mpv , python-mpv and adlib, tried running the test script:

import mpv player = mpv.MPV(ytdl=True) player.play('/Applications/thehandle/Japaneasy.mp4')

I get no errors but it just runs through (via idle) and exits without playing anything I am assuming if it wasnt able to access the various requirements an error would show up.( I am new to this ). I got it all working in Windows, and was hoping to replicate it in osx. Any ideas?

Many thanks

jdauthre avatar Oct 15 '18 16:10 jdauthre

Hmm, are you running this from an interactive shell or as a script? If you're running this as a script you need to add player.wait_for_playback() at the end. Otherwise python will exit right after mpv started playing, taking down mpv in the process.

If it still doesn't work, you can try debugging with

player = mpv.MPV(log_handler=print, loglevel='debug') # For log levels see man mpv.

jaseg avatar Oct 16 '18 00:10 jaseg

Many Thanks will try that

jdauthre avatar Oct 16 '18 09:10 jdauthre

I am now getting some errors (I did fiddle with the locations of the dependencies earlier), so with the script: import mpv player = mpv.MPV(ytdl=True) player.play('/Applications/thehandle/Japaneasy.mp4') player = mpv.MPV(log_handler=print, loglevel='debug') player.wait_for_playback()

I get runtime errors: output.txt I noticed you mentioned there is a problem with osx around the event logic, but it seemed it was about qt which I am not using.

jdauthre avatar Oct 16 '18 14:10 jdauthre

That runtime error is caused by mpv geting a log-handler option it doesn't know. The log_handler parameter to the MPV constructor is supposed to be caught by that constructor and not passed through to MPV. Are you sure you are using a recent version of python-mpv?

jaseg avatar Nov 10 '19 15:11 jaseg