bkochendorfer/BuddyTube — pull request #1 by drtangible (2013-06-01 21:28:27+00:00)
Title: Fix issue where multiple users weren't being synced with 'master' connection.

A lot of code up in hurr, and the process works a bit differently than how this was previously working. All of the video playing / queueing logic is now on the server, and everything is synced from there as well.

Right now:

- First connection is marked as the 'master'.
- Airhorn video is played whenever there's nothing in the queue.
- When a video is in the queue, it'll get popped off and played next.
- The next video is kicked off whenever the video on the 'master' connection finishes.

This commit fixes a couple issues:

- Some users weren't being synced when multiple users connected.
- Videos are popped off the queue after being played.
- Finally introduces the rap air horn.

Remaining issues:

- When the 'master' connection leaves, other users won't get any more videos after their current one finishes.

- Think it makes sense to just treat the oldest connection as 'master'. That way, if the current master leaves, the next user becomes the new `master`, and subsequent videos will by synced from his connection.

PS -- Probably broke some stuff.