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

Wrong Player Version detected #3

Closed wendelb closed 7 years ago

wendelb commented 7 years ago

Hi there,

I wanted to use your npm package in my new project. Apparently the code that detects the mpv version doesn't work with my build.

$ mpv --version
mpv git-0a81fe1 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on Mon Oct 17 15:49:16 UTC 2016
ffmpeg library versions:
   libavutil       55.32.100
   libavcodec      57.61.103
   libavformat     57.52.100
   libswscale      4.1.100
   libavfilter     6.64.100
   libswresample   2.2.100
ffmpeg version: N-82007-g1a9513b

I aquired this build using the debian buildscripts (used to create deb-packages) created by the mpv team. As you can see, there is no UNKNOWN in the version string. Therefore your lib is trying to find a major and a minor version for comparison.

The output.substring(start,end) will be '0a81fe1 (C) 2000' in this case. parseInt on that will fail on that.

I haven't actually installed your lib yet, but tried the detection script via node REPL. Starting mpv using the old parameter only issues a warning, so I think this will work fine. It would be nice for the library to handle this case (or having an option to override ipcCommand).

Thanks Bernhard

j-holub commented 7 years ago

Heyho,

thanks for the Issue. I haven't run into that Problem yet, that's why it isn't handled yet.

So I guess if I find neither UNKNOWN nor a version number I could just use the old command.

I like you're idea about being able to override the ipcCommand.

I'll look into it as soon as possible but within this week.

j-holub commented 7 years ago

I fixed the issue. When the module finds the version number as "NaN" it uses the old deprecated command "--input-unix-socket".

I also added the possibility to set the ipcCommand by hand using the options object.

This should fix your Problem.