I have devices thay play video files from their local disk basing on a pre-defined playlist (every device plays exactly the same movie in the same order, every device knows in advance what videos will be played and what is their duration). There is no master device, every one is equal (there is a server though, but it's only used for downloading the video files for the first time and it can be in an entirely different network, and it doesn't do any video playback).
The devices are all exactly the same (the entire hardware is identical and the OS (linux) also) I'm using a custom video player based on GStreamer library (in Qt).
I want to synchronize the video playback between all these devices in the same local area network (over UDP packets). I'm trying to find the best solution for my circumstances. I tried doing it so that the devices periodically send an "i am alive" packet over UDP broadcast, and before starting the video playback they send a "i am ready" packet with a predefined number that is periodically decremented by other devices (so if one device loses power for example, the number will go down to 0, if it comes back there will be a re-synchronization). If all devices are ready, then they all start playing. There are some small differences, but it's acceptable.
Here are my main points regarding the synchronization:
- I cannot use an NTP-synced clock, because the devices often work in a cut-off network that has no access to any NTP server. Even if they had, I think NTP is not a good way to do this (not really that synced). This also prevents me from using any sort of timestamps, since they can be totally different on every device (they have an RTC module, but in case the battery goes low there will be differences)
- I can pause/seek the video as needed, but I'd rather not seek the video during playback because that would produce a weird effect.
- In case any device goes behind (or gets restarted), videos need to be re-synchronized
- I cannot do video streaming (I tried already, it produces many other problems such as artifacts and doesn't really produce a perfect sync)
- There is no (at least there shouldn't be) any visible gap between the videos, they are played one after one in a seamless loop.
- There is no audio involved, so it doesn't need to be synced.
What are your ideas on achieving this?