You can add synchronized playback to Embedded YouTube videos with two simple steps.
First, initialize a VideoSync object with a room name and a user name.
Then, all you have to do is bind two of VideoSync's methods to two event callbacks in your standard YouTube embed code.
Voilà, you now have synchronized YouTube videos!
YouTube's iframe API allows you to bind callbacks to state events of the embedded YouTube player. When you initialize VideoSync, you bind VideoSync methods to the
onReady event and the
onStateChange event. When important state change events occur, they are published through the PubNub Global RealTime Network, and then other VideoSync clients will act accordingly. If you'd like to learn more about how VideoSync works, check out the annotated source and the more detailed README.