Closed andykais closed 4 years ago
Hey there,
it is not yet possible, but it shouldn't be difficult to implement. The thing you would have to take care of, is that you make sure that mpv is started with the --input-ipc-server=/path/to/your/socket.sock
flag. This will create a UNIX socket over which other programs/scripts (in this case node-mpv) can communicate with that mpv instance.
This is what happens when you start node-mpv. It spawns mpv with the flag and keeps the communication alive.
I don't think it would be too difficult to implement a way, that the script does not start a new mpv instance, but connects to an existing one.
Are you using version 1 or 2?
I'll +1 this as I'm currently working on some kind of proxy of mpv to be able to pilot it from another computer running node-mpv.
Basically an option in node-mpv would tell it not to start mpv and instead listen on an already existing unix socket.
If I can find a way I'll offer a pull request, but my other one should be merged before that, I believe. (I'm not too familiar with how PR works or how I can submit multiple PRs for different stuff)
I know it has been ages, but it's finally implemented. Node-MPV automatically detects where an instance of mpv is running on the specified socket and hooks into it. auto restarting does not work, I was looking into ways to do it, and there might be a way but I ran into issues. I might add that later. But if Node-MPV is hooking into a running instance of mpv and that instance crashes or is quit, I don't think it's Node-MPV's responsibility to start a new instance.
Anyways, let me your thoughts, maybe you got some ideas to improve this behaviour
Hi, wondering if I have already started mpv from the command line if there is a way to control that instance with this library
This would be for an IOT device where I would rather run this library as a daemon, controlling any and all mpv instances from behind the scenes