– Movies on the couch… on the internet

Some History is a project I’ve been kicking around (and prototyping off and on) for over a year. It is, at its heart, and like many great projects, an attempt to solve a personal problem. But it’s also a problem I think that many people have, even if they don’t know it yet.

A bit of background: during the summer of 2008, knowing that I was soon to move to New York City for graduate school, I quit my job and took a ten week roadtrip. I drove all over the United States crashing on friends’ couches and gorging myself on social interaction. I watched a lot of DVDs that summer, with literally dozens of people. Movies, TV shows, anything that looked even remotely interesting. And it was fun. A lot of fun. It turns out that watching things with your friends is incredibly enjoyable in a whole different way from watching things alone. Of course, I already knew this because I’d spent years watching stuff with my close friend Nikki in Alabama, and things were always more fun that way.

But that trip inevitably ended, and I packed up my tiny apartment and moved into an even tinier apartment (because, hello, New York City). While I was still settling into life in the big city it dawned upon me that all that fun I’d had watching stuff with people, and especially with those specific people, was a thing of the past. Who was I going to get to watch under-appreciated kids shows in New York? (Though, to be fair, in a city like New York the problem is more finding them.)

Still, the experience was compelling enough that I wanted to find a way to repeat it, and given the explosion in internet technologies it seemed like the sort of thing that technology could help with. The first thing I tried was the most slap-dash. I talked to some friend via instant messaging and we figured out what we wanted to watch that was available on YouTube. Then we set up a chat room and tried to hit play all at once. Rather predictably this resulted in coordination problems: no one hit play at exactly the same time, and things only got worse when we tried to pause so someone could answer the phone or run grab a drink.

It struck me that timing and coordination are, in fact, things that computers do extremely well. So it seemed obvious that software should handle coordination so that people can focus on watching and talking.

Thus was born The first prototype was built on the open-source Flash player Flowplayer, but since I’m not a Flash programmer the rest of the system was in HTML and JavaScript, and it was hard getting the two to play well together. So I put the project on the back burner.

And while it simmered away, getting a couple of semi-successful tests, a whole bunch of browsers released versions with support for the HTML5 video tag. Which is when it dawned on me that this is what I had been waiting for. With the ability to write the entire thing in a single environment, I started over, which led us to where things stand now.

The Tech Stuff

The technologies that run the current system are:

  • HTML5 video, specifically the Ogg-Theora implementations in Firefox and Chrome
  • AJAX, with a terrible inefficient 1-second polling interval to keep each client synchronized with the server
  • PHP, to handle the server-side interface with the database
  • MySQL, mediated through PHP to handle all the dynamic data storage and retrieval

AJAX polling is obviously not the most efficient way to manage this sort of tight synchronization, and there are actually a number of huge headaches that have to be managed by using it, but it’s effective and avoids Flash. (And it sets the stage for migration to web-sockets whenever they manage to take off.)

One of the other things that drove the current, inefficient design was a desire to avoid running a server-side timing process to synchronize users to. What the system does instead is pick a single user and on every AJAX polling action sends that user’s current video timestamp (along with whatever other information needs to be sent such as chat messages or system messages) to the server, and other users get that timestamp as a synchronization target every time they poll. It’s messy and latency becomes an issue, but it works.

Which, really, is what matters. It works.


One Response to “ – Movies on the couch… on the internet”

  1. going here says:

    I’ve read some good stuff here. Certainly worth bookmarking for revisiting. I surprise how a lot effort you put to make the sort of wonderful informative site.

Leave a Reply