I made a media player that plays basically everything that is planned for it through a text file. The player can also play the same clip on multiple computers (PCs). The problem is synchronization. The same video starts to play on each of the machines, but they go out for about 400 ms, which looks like crap, and if the sound sounds even worse.
I am currently doing the following:
One machine is configured as a master, and all other machines are configured as slaves. The wizard decides which item will be played. It expects messages from each of the slaves, when all the slaves are connected (or after a timeout), it passes the identifier of the file element to be reproduced. Then all the machines start playing this file.
What I also tried:
I thought file download time could be the main factor affecting the timing mismatch, so I added code to do the following.
The wizard still decides which file to play. It waits for connection messages from each slave (or timeout) and passes the identifier of the file element to play. All machines start playing this file, but immediately pause it. Then the master again waits for the finished message from each of the slaves. As soon as all subordinates responded, the master sends a game message to all subordinates. Then all the machines continue the file.
This, unfortunately, did not improve the problem. Now I'm sure that the timing mismatch is due to network latency. How can I compensate for this? Or perhaps determine the delay for each slave?
winsock.
.