Combination of multiple servers and applications to provide WebTorrent-based video streaming in the browser. Videos are synced together and chat is provided to allow the audience to comment as they watch together!
The project was initially inspired by nickreboot.com (RIP), which streamed 90’s Nickelodeon shows 24/7, and offered a chatroom for viewers.
Since NR heavily utilized Flash (for most of its lifespan), I was interested in recreating a modernized version of the site.
As bandwidth is an issue for streaming, I was interested in finding a technical solution around having to pay for content servers or a cloud service. WebTorrent seemed like the perfect fit.
Quick Technical Overview
The entire system is based around the WebTorrent library, allowing us to distribute files and stream them as if they were regular torrents! The audience can download the file as they watch, then seed to new viewers that join later. The WebTorrent ecosystem has packages for WebRTC compatible DHT and https://github.com/webtorrent/bittorrent-tracker servers, as well.
Remote Control node script reads content from a specified local directory, creates torrents when requested, and then initially seeds those torrents.
Diet WBtv uses WebTorrent to connect and consume the stream. As the video plays, the backend syncs each audience member’s stream to the same timestamp.
Initially, a more amibitous viewing site was put together at WaybackTV, but my eyes were bigger than my stomach. As a result, I created Diet WBtv as an MVP.
Along with the hosting script comes an assistant IRC bot named
Remote Control. RC handles stream-related functions such as rewinding or voting for what’s next, as well as basic IRC commands (such as opping or muting chatters).
The idea to use an IRC bot instead of implenting controls into the site UI is to keep users chatting. By avoiding the mouse entirely, the user doesn’t lose focus of what the audience is saying, and the user remains engaged.
RC will offer a few random choices when a video is about to end. Users can vote (via IRC) what plays next, and that’s how the queue is decided.
It took a long time to get the base concept working, but once it did, it was super fun. A few problems remain:
- WebRTC is fickle. In some tests, everything will work perfectly. The next run, nothing will connect. This could also be the fact the code is pretty rough.
- On DWBtv, changing videos sometimes don’t change for all users. Using the big red
Refreshbutton usually works, but is also unreliable. Again, the code is pretty rough.
- Realistically I should just rewrite DWBtv all together.
Also, It’s a Death Ray
While there are some ‘good’ applications for this sort of project (such as online classes), realistically it can quickly go outside legal boundaries. As a result, I don’t attempt or intend to make this project anything more than just something glued together so my friends and I can watch videos together.
That said, it IS a pretty fun project to talk about and work on.