Sync Youtube on High
Whenever in a party in hostel room, one phone or a laptop speaker is not enough, but we have so many android devices lying around these days, so why not make something that uses them all to do something cool, we searched for any app that does that but they either have too many requirements, or don't work.
What it does
Sync Youtube on High is an Android app that allows users to play a single Youtube video in sync across multiple devices therefore allowing them to behave as multiple monitors for the same while also getting an extraordinary sound effect.
And since we are using the trnql sdk which is based on location, the devices need not be on the same WiFi, connected via Bluetooth, or even in the same country. One can listen to music or watch videos with their family members, even when not together and still share the love. And since it uses Youtube, which is global, one doesn't even have to worry about copying the song on all devices.
The app is so simple to use, that even a person with no idea of Bluetooth can use it.
And if that's not enough for you, we have something for the lonely folks out there, it also suggests videos to play based on the weather and activity context signals from trnql sdk, now put this on while you are jogging, driving etc and the best song recommended for that.
We also analyzed the error in playing the videos, most of the times its about 2-3ms, but sometimes because of difference in network latency it can go up to 30-40ms, but that too sounds really amazing, as the min time to hear echo for average person is about 100ms.
How it works
- All the people interested start the app
- One of them becomes a server and chooses a host name
- He searches for a video to be played or chooses one from the suggestions based on his activity or weather outside, like if its raining outside, romantic songs
- He chooses the video from the search results
- Others now join him by clicking his name on the home screen, or anyone else for that matter.
- All the devices first play any ads(if any), buffer the video and click the play button to advertise they are ready to play.
- Once the server sees all people are ready or buffered, he can click on the play button.
- A cool countdown starts on FAB on all devices.
- Blast off !! Also, At all moment everyone can see the status of other people, whether they are searching or buffering or reading.
How we built it
It is built using the trnql Android SDK, Youtube SDK and the Android SDK. It requires no additional server thanks to clever usage of trnql SDK. The main algorithm for it to work is that the device before playing gets the current time from the global NTP server and sets its play time in its payload in the trnql smart people API, and when the others read it, they set their clock to play the video at the same time. So theoretically if the devices are in different time-zones the app would work. The app also first intelligently buffers the video sufficiently and set its state, so that there are no issues even on slow internet connection.
Showing the music recommendations based on weather and activity was a piece of cake, thanks to the trnql APIs.
Challenges we ran into
Playing the video at the same time was the biggest problem for us (well but that's what all the fuss is about). We solved it by using NTP and adding device states and sufficient gaps for network and bandwidth delays.
Accomplishments that we're proud of
- Syncing the video across so many devices.
What we learned
- Lots new Android concepts, and material design.
- trnql, especially smart people
How NTP works and how we get same time across all devices.
What's next for Youtube on High
Top Priority - Supporting Android M.
Features for pausing/resuming videos
Joining the server after video has started
Better recommendations for activity