calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.46k stars 235 forks source link

Remove player state information from the playlist. #87

Closed awused closed 11 years ago

awused commented 11 years ago

This is a suggestion/improvement.

I'd recommend splitting all the information relating to the player state out of the playlist. It's unnecessary to send a complete copy of the playing video's playlist entry with every single mediaUpdate frame, since Cytube cannot play videos that aren't on the playlist.

My suggestion is to just outright cut everything out of mediaUpdate except currentTime and paused. Since the playlist and playlistIdx are already available to the client they'll still have all the information they need. This also stops currentTime (and any state information added later) that is only relevant for the currently playing video from cluttering up the playlist.

awused commented 11 years ago

Perhaps I was a little mistaken, there is one case (people in the room, a video is playing, and someone deletes the entire playlist) where a video not on the playlist can be played.

I think you'd be better off including a special frame, like Synchtube's old cm - changeMedia frame. It was for when the video being played wasn't on the playlist. This will cover the odd cases where a video is playing with an empty playlist. It would also allow you to take streams off the playlist, and add a "play now" button for videos/streams. I really don't think livestreams, twitch.tv streams, live youtube streams, and the like belong on the playlist. It creates the possibility of the playlist looping back onto them, which isn't good when they have unknown length or could be offline.

calzoneman commented 11 years ago

The livestream issue should be fixed by a feature I intend to implement which allows videos to be temporary (autoremove after playing).

calzoneman commented 11 years ago

I tried the easy fix to this when I added temp videos, but it caused a race condition with the various player APIs (if the embedded player didn't load before you got the changeMedia packet, you were stuck staring at a blank video). I can probably solve this by adding some sort of "I'm ready" action on the client's part, I just need to set aside time to work on it.