heisters / node-omxplayer-sync

Synchronize omxplayer instances over a network using OSC
15 stars 5 forks source link

network interface problem and zeroconf #3

Open diegofromparis opened 7 years ago

diegofromparis commented 7 years ago

Hi, I test this script with 4 raspberry Pi 2 and only a switch (no router) I auto run the script at boot with PM2

The script with this method "speech" on random IP

This way some time I have 2 or 3 PI synchronized. Connecting to a router I have full sync over 4 PI after restarting node script.

So over http://player.local I get 4 raspberry that doesn't view each other on the same network or ip range

Same behaviour without Wifi (zero conf and other on static IP) and disabling avahi (zeroconf) disable too mdns so players.local can't be reached anymore and script doesn't synchronise at all

Is there a solution to force the communication on a specific network interface and to force to use a specific ip range (Zeroconf is the best way but i don't know if broacast adress is available this way so static IP can be a config waste of time but with previsible result) ?

I have tried to force the braodcast adress to static range (192.168.1.255) and to zero conf range (169.254.x.255) in config file of the node script without success !

Is PI time need to be in sync with access to the net or a ntp server ? or is it video time code based ?

Many thanks, Diego

heisters commented 7 years ago

I'm not entirely sure, but without a router I don't think the PIs will be able to route packets to each other. They can assign themselves static IPs, but those IPs mean nothing to the other nodes on the network. This problem is at the lowest level of the TCP/IP stack, so I don't think zeroconf will really be able to address it. I could be wrong--it's been awhile since I've been working actively on this. If you have any examples of using zeroconf or something like that without a router, I can try to help you work through it.

If it works with a router, why not just use a router? In the past, I've used really cheap wireless, 4-port netgear routers. The PIs plug into the router (for reliable, cheap, and fast connection), while the wireless allows you to access the web interface from your phone/tablet. You can see a photo of the setup here.

Time sync works off of the master player's local time, so there's no need for access to an NTP server, or to have a synchronized clock.

diegofromparis commented 7 years ago

Thanks for your advice, I noticed some strange effect because without router (only a switch) the pis aren't in sync but not totally (they seek at start to a delayed frame and the web interface display this delay delay and act as it was in sync, showing every pis and ). Strange.

I have tried many setup, and you're right that's work only with a router (but the router can be connected after the switch so I will try my last chance to configure a raspi to act as a router, if anybody have an idea or tricks ?)

I have another question, how to force some pi to be elected in priority as the master ? It's because this one have to play the sound of the video and I want to avoid sound interrupt when seeking on this one ?

heisters commented 7 years ago

Good question. I believe the first PI to start up will become master automatically, and other nodes should follow it. However, this won't be stable or predictable for permanent installations. Pull requests are welcome.