-1

Is it possible to make so that the video played at the same time on two computers ?

If the video lagged on one side, then the other must wait.

Sauron
  • 143
  • 2
  • 6
  • 2
    Possible duplicate of [How to play YouTube videos in sync on multiple clients?](http://stackoverflow.com/questions/8423091/how-to-play-youtube-videos-in-sync-on-multiple-clients) – GSerg May 10 '17 at 22:14
  • 1
    Yes. Now where is your code? – Obsidian Age May 10 '17 at 22:14

1 Answers1

1

You'll need to keep track of where each user is in the video. To get the current position:

var currentPos = document.getElementById("myVideo").currentTime;

And post them to your server for each user's session. Then, keep comparing the two times and if one gets over a few seconds ahead, send a pause command to the one that is ahead.

The specifics of how to do this will depend strongly on your server-side setup and how you're maintaining sessions for users.

Vexen Crabtree
  • 339
  • 3
  • 16