In most cases, runmpv is supposed to quit immediatelly after a new video was started. But if runmpv is used to synchronise several instances of mpv on different machines - runmpv keeps running as long as mpv instance exists. That is needed to watch mpv and signal sync server that video is paused or started.
If user starts another video, then another instance of runmpv starts and keeps working until mpv quits. That leads to tens instances of runmpv running in background, controlling the same instance of mpv. And one instance is enough.
So probably if mpv is already open, then runmpv should only signal it to start playing a new video and then quit. Existing runmpv instance will take care of watching mpv.
Deciding if runmpv should quit or run in background, based on mpv socket or pipe existance might be not such a good an idea, though. Because runmpv might crash some time after starting. Maybe runmpv should open it's own controlling socket after starting, so that other instances of runmpv could use it to check if there's runmpv instance running.
In most cases, runmpv is supposed to quit immediatelly after a new video was started. But if runmpv is used to synchronise several instances of mpv on different machines - runmpv keeps running as long as mpv instance exists. That is needed to watch mpv and signal sync server that video is paused or started.
If user starts another video, then another instance of runmpv starts and keeps working until mpv quits. That leads to tens instances of runmpv running in background, controlling the same instance of mpv. And one instance is enough.
So probably if mpv is already open, then runmpv should only signal it to start playing a new video and then quit. Existing runmpv instance will take care of watching mpv.
Deciding if runmpv should quit or run in background, based on mpv socket or pipe existance might be not such a good an idea, though. Because runmpv might crash some time after starting. Maybe runmpv should open it's own controlling socket after starting, so that other instances of runmpv could use it to check if there's runmpv instance running.