Syncplay / syncplay

Client/server to synchronize media playback on mpv/VLC/MPC-HC/MPC-BE on many computers
http://syncplay.pl/
Apache License 2.0
2.11k stars 214 forks source link

Project IINA Support #144

Closed jurplel closed 6 years ago

jurplel commented 6 years ago

I'm seeing Mac development on the horizon, and this is my favorite player for Mac. I figured since it was MPV based, it would be easy to support. https://lhc70000.github.io/iina/

albertosottile commented 6 years ago

Just a preliminary question, do you know if it is possible to control IINA via terminal, as for mpv? I installed it on my system via cask, but did not find any CLI for it.

jurplel commented 6 years ago

I'm not actually sure, but I found some relevant issues that might help answer your question. https://github.com/lhc70000/iina/issues/875 https://github.com/lhc70000/iina/issues/58 https://github.com/streamlink/streamlink-twitch-gui/issues/480 Looking like that's a no but in progress https://github.com/lhc70000/iina/issues/898

albertosottile commented 6 years ago

Yep, according to the roadmap it has to be implemented yet. I am afraid that until they do that, we have no way to interact with IINA and add support for Syncplay. I guess we just have to wait and then try to adjust our mpv module accordingly.

jurplel commented 6 years ago

I don't suppose any of these pages would be useful? https://github.com/lhc70000/iina/wiki/MPV-Options-and-Properties https://github.com/lhc70000/iina/wiki/Use-youtube-dl-with-IINA https://github.com/lhc70000/iina/wiki/Use-SVP-with-IINA

albertosottile commented 6 years ago

I already read those, as far as I understood there is no way to control the player status after IINA is launched from the command line...

jurplel commented 6 years ago

Okay, thanks for your time.

albertosottile commented 6 years ago

Thank you, maybe you could comment again when they release a functional CLI for IINA.

Et0h commented 6 years ago

If it doesn't support terminal (which is what Syncplay currently uses for mpv) does it at least support the mpv JSON IPC protocol ?

albertosottile commented 6 years ago

From here: https://github.com/lhc70000/iina/wiki/Use-SVP-with-IINA it seems that it does, by adding an option in IINA's preferences. I just tried it and obtained a reasonable answer: echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpvsocket {"data":499.749000,"error":"success"}

So it should be possible to control IINA with this JSON IPC interface. Unfortunately, the effort required would be much higher than just adjusting the code in mpv.py .

Maybe we could ask @Hamuko to help, it seems that his Sopu client uses JSON IPC to control mpv (https://github.com/Hamuko/Sopu/blob/master/sopu/mediaplayer.py)

Et0h commented 6 years ago

I don't use OSX so it'd definitely need someone to take it up not just to port it over but also to maintain it.

jurplel commented 6 years ago

CLI is on the way it seems https://github.com/lhc70000/iina/pull/1181

albertosottile commented 6 years ago

Great, let's wait for a release. In the meantime, @etoh do we use any --no-* option in mpv.py?

Et0h commented 6 years ago

@jeep70 Great news! 👍

@alby128 We use "no-osd set" to set properties without affecting the OSD, but we don't make use of any command line options which start with --no. Depending on your definition, you could say --input-terminal=no (which we use in Syncplay) is equivalent to --no-input-terminal, but if the problem comes from using the --no prefix style to set variables then that doesn't happen (unless someone manually sets up a --no command in Syncplay player arguments).

On Windows, the default command line options are: ['--force-window', '--idle', '--hr-seek=always', '--keep-open', '--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin', '--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n</SyncplayUpdateFile>', '--terminal=yes']

Et0h commented 6 years ago

https://github.com/lhc70000/iina/pull/1181 seems to have been merged into the develop branch. Is the IINA develop branch working properly with Syncplay @jeep70 (assuming you change the Syncplay code to detect IINA as mpv)?

Et0h commented 6 years ago

If IINA is now compatible with Syncplay then to add support from Syncplay's side a developer would need to do something like:

  1. Create icon and list it in Py2exe,
  2. Create /players/iina.py which is a subclass of NewMpvPlayer and ensure relevant constants are put in constants.py
  3. Reference the player in other Syncplay code so it shows up and knows where to find the player executable.

See https://github.com/Syncplay/syncplay/commit/88113d8e1587edf8316c90884e2b84ea0217a9df and https://github.com/Syncplay/syncplay/commit/117a45b7cbec34c6ba3c0c8407166e18994269da for examples of this being done for MPC-BE.

However, adding support also means testing it and then maintaining compatibility in future versions of the player so I suggest only a dev who regularly uses Syncplay with IINA and is willing to be the long-term IINA lead works on adding initial IINA support to Syncplay.

jurplel commented 6 years ago

I can't seem to get syncplay to work from the git - I'm using python2 to open the client and it crashes with global name GraphicalUI is not defined after pressing run syncplay (unmodified code and using stock mpv). I also tried building it with py2app but that just crashes the same way

albertosottile commented 6 years ago

There is something wrong either in the version you downloaded or in your python environment. Please check if you have twisted, appnope, and pyobjc installed. If you are not sure, just run pip2 install twisted appnope pyobjc.

jurplel commented 6 years ago

That worked, but using IINA doesn't work with syncplay it seems. I changed the code a little so that every path was accepted for mpv, but it just becomes completely unresponsive after going to the server window. Selecting a file in IINA doesn't do anything. Quitting IINA results in this dialog box screen shot 2017-12-10 at 2 24 27 pm This is with the built develop branch of IINA. Terminal Log:


2017-12-10 14:19:41.057 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:41.057 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:42.586 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:42.586 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:43.465 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:43.465 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:46.753 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:46.753 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:48.020 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:48.020 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:50.615 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:50.615 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:52.003 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:52.003 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:55.371 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:55.371 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:58.171 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
2017-12-10 14:19:58.171 Python[8544:967879] +[NSSegmentedCell(StaticMethods) _image_state_for_visual_state:style:trackingMode:]: Unknown NSSegmentVisualState 0
objc[8544]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff97964a70) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x1264cacd8). One of the two will be used. Which one is undefined.
2017-12-10 14:22:05.406 Python[8544:967879] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
2017-12-10 14:23:57.162 IINA[8570:986310] MPV log: [vd] warn: Falling back to software decoding.```
Et0h commented 6 years ago

@jeep70 If you run Syncplay in --debug mode is there anything interesting in the Syncplay<->IINA communication? Have you tried Syncplay in both NewMpvPlayer and OldMpvPlayer modes by changing the run static method in MpvPlayer (mpv.py)?

jurplel commented 6 years ago

Just running it in debug mode didn't seem to do anything different, but when i switched the mode check in the run method, I got a different result.

https://hastebin.com/mequgifoni

Everything after modalSession has been exited prematurely showed up after i force quitted IINA. Pretty much everything else is the same. This is what happens when I try using iina-cli

https://hastebin.com/konajasebe

I can't seem to open up the app bundle in syncplay. It should be noted that all of the above shows up immediately and i do not have to do anything to IINA for that to happen.

Et0h commented 6 years ago

Sorry I can't be of any more assistance in figuring this out. Maybe you could try and get an IINA dev to join the effort.

Et0h commented 6 years ago

Syncplay already supports mpv and VLC. If IINA ever adds support for Syncplay then please update this issue, but until then I'm going to consider this matter on pause. Unfortunately I don't have the macOS or programming knowledge to make progress on this, and it would need a dedicated lead to ensure things work from both the IINA and Syncplay side.

jurplel commented 6 years ago

That's reasonable. Thank you for entertaining the idea.

albertosottile commented 3 years ago

Syncplay 1.6.7 will add support for IINA. The first beta of this release is avaliable here: https://github.com/Syncplay/syncplay/releases/tag/v1.6.7-Beta1. Any feedback would be truly appreciated!

jurplel commented 3 years ago

Awesome!