0

I'm used to use Play with MPV Chrome extension on Arch linux which works also on MacOS. The problem is it isn't working as service for me on MacOS.

If I start directly play-with-mpv in terminal, the server is listening on port 7521 and I can run youtube video in MPV with right click inside Chrome.

If I start play-with-mpv as LauncherAgents service with proper plist it starts, listens but does nothing.. right inside Chrome on Play with MPV does nothing.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>play.with.mpv</string>
    <key>RunAtLoad</key>
    <true/>
    <key>Program</key>
    <string>/Users/e/Library/Python/3.7/bin/play-with-mpv</string>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>

Port listening

Python    2673              e    3u  IPv4 0x51d94fea3b0e559f      0t0    TCP *:7531 (LISTEN)

Content of the play-with-mpv server launcher

#!/usr/local/opt/python/bin/python3.7

# -*- coding: utf-8 -*-
import re
import sys

from server import start

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(start())

I also tried to put play-with-mpv inside Users & Groups > Login items with the same result as in LaunchAgents.

play.with.mpv.plist is located at ~/Library/LaunchAgents/play.with.mpv.plist

Tried also load it via launchctl

launchctl load ~/Library/LaunchAgents/play.with.mpv.plist

While direct calling play-with-mpv in terminal the request is working and mpv pops out

http://localhost:7531/?play_url=https://www.youtube.com/watch?v=BoY1TNKO-bY

but as a running service that address is unaccessible and does nothing. Weird is I can ping localhost at port 7531, is up and running and listening.

I'm very new in MacOS so please be patient with me :) Thanks

UPDATE

as for now this is partly working (added PATH and full python3.7 path)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/Users/e/Library/Python/3.7/bin:/usr/local/bin</string>
    </dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>play.with.mpv</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/python3.7</string>
        <string>/Users/e/Library/Python/3.7/bin/play-with-mpv</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/tmp/play.with.mpv.stderr</string>
    <key>StandardOutPath</key>
    <string>/tmp/play.with.mpv.stdout</string>
</dict>
</plist>

BUT there's still something unordinary. The video is dropping frames (around 3-4/s). If I run that same video directly from terminal with eg; mpv https://www.youtube.com/watch?v=BoY1TNKO-bY or by running the play-with-mpv server manually, the video is running fine, zero dropped frames.

  • Where dot you put the idt and what commands did you use to load it? – Mark Dec 23 '18 at 14:39
  • updated in original post.. load / unload with launchctl.. tried alo with automator – 5ulo Dec 23 '18 at 18:43
0

Got it working. Here's the full solution:

Plist: ~/Library/LaunchAgents/play.with.mpv.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/Users/e/Library/Python/3.7/bin:/usr/local/bin</string>
    </dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>play.with.mpv</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/python3</string>
        <string>/Users/e/Library/Python/3.7/bin/play-with-mpv</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/tmp/play.with.mpv.stderr</string>
    <key>StandardOutPath</key>
    <string>/tmp/play.with.mpv.stdout</string>
</dict>
</plist>

Mind the PATH to python3 - find it with which python3 and the play-with-mpv python script!

Load plist:

launchctl load ~/Library/LaunchAgents/play.with.mpv.plist

mpv config in ~/.config/mpv/mpv.conf

video-sync=display-resample

if this does not help, try this instead

opengl-early-flush=no

That video-sync parameter was the key - not a single dropped frame anymore.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .