j-holub / Node-MPV

A NodeJs Module for MPV Player
https://www.npmjs.com/package/node-mpv
MIT License
116 stars 73 forks source link

Added already_running option to listen to an existing mpv process (re… #53

Closed AxelTerizaki closed 4 years ago

AxelTerizaki commented 5 years ago

This refs #33

AxelTerizaki commented 5 years ago

To comment further...

My use case was that my app is used to manipulate mpv on a computer, and a similar app runs on a server on the net to allow people outside of the wifi network to participate. The app on the net serves as a proxy to node-mpv by listening to the socket and sending it over to the local app that runs the real mpv (with node-mpv too)

Not sure if this makes sense for you, but it should allow people to hook node-mpv to an already running mpv process as long as mpv's IPC server is listening in. To do that, they have to use the already_running option flag and set it to true.

Since I'm using a new option, I don't believe this impacts normal use.

AxelTerizaki commented 5 years ago

As expected, the module crashes when trying to connect to a non-existing socket (suppose already_running is set to true, but no mpv is running at the moment, it thinks mpv has crashed.

I'm not sure how the error handling on this could be improved to be honest, I'm not familiar enough with node-mpv's code to decide what would be best.

AxelTerizaki commented 5 years ago

I need to look into the code more closely but I believe this is used as a flag to tell if the process is running and needs to bre restarted or not.

j-holub commented 4 years ago

I know this is super super old, is this ready to be merged or still a wip?

AxelTerizaki commented 4 years ago

I'm currently not using this code at all since the reason I added it was an issue in Karaoke Mugen that I postponed eternally, but according to my comment I had tested it and it worked.

Up to you if you merge it or not, it's not super important to me at the moment, but I think @sir-kain wanted that for his use case.

j-holub commented 4 years ago

Implemented this myself, still thanks for the effort you put into this :) always appreciate your help