The Tech Behind Chatroulette
Internet sensation Chatroulette uses Flash Player 10's peer-to-peer ability and Wowza Media Server to power its random, anonymous video chatting
Learn more about the companies mentioned in this article in the Sourcebook:
From international newspapers to television shows, plenty has been said about what goes on on Chatroulette—some of which is funny, some of which is bizarre, and some of which is, well, perverted. But what about the technology behind the site, which allows anyone with a webcam to randomly and anonymously interact with a never-ending series of people?
While it looks like an incredibly simple site, Chatroulette (warning: may be NSFW) wasn't built in a day. It took months of hard and persistent work. More surprising, though, it was done singlehandedly by a 17-year-old Russian kid still in high school.
That kid is Andrey Ternovsky, and he's now on the West Coast talking with potential investors and enjoying his trip abroad. While he won't discus the possibility of selling the site, he's happy to talk about how he created it.
Chatroulette was born out of Ternovsky's curiosity and some experiments with controlling webcams remotely. A friend suggested that it would be cool to video chat with random people, and when Ternovsky couldn’t find a site like that he decided to create one.
Coding wasn't Ternovsky's strong suit, and he couldn't afford to hire anyone to create the site for him, so he started by learning Java and ActionScript. He thought about building his site on Flash Media Server, but found it too complicated and "too damn expensive." Open source Red5 was also too complicated. He wanted something that would work out of the box. The answer was a combination of Flash Player 10's peer-to-peer ability and the Wowza Media Server.
Unfortunately, Ternovsky didn't have the money for Wowza, either, so he cheated a little and used a pirated version with a cracked serial number. Once Wowza was running, it almost immediately crashed. Even though he wasn't running a licensed copy, Ternovsky decided to ask the company for support. He was sure they would check his license, but, to his surprise, they didn't.
"I used a pirated version, but I still got it fixed," says Ternovsky.
Help came from a guy named Charlie, whom Ternovsky thought worked in Wowza support. He was actually Charlie Good, the company's co-founder and CTO. Good created a patch for Ternovsky, which resolved one problem, but then another crept up. And another. And another. The constant connecting and disconnecting on Chatroulette, as well as the thousands of new streams created every moment, put Wowza through some extreme tests. In all, Good created four patches and the two exchanged between 200 and 300 e-mails by the time the site was running smoothly.
"His application exercises our software in new and different ways," says Good.
When a user tries to make a connection with Chatroulette, the site first tries to make a peer-to-peer connection using Flash 10. If it doesn't succeed in three seconds, it relies on Wowza. The two systems are used about equally, since many users don't meet Flash 10's technical requirements. Ternovsky is now giving notes to Adobe's developers to help them improve the new feature.
Ternovsky did make good on that pirated copy, by the way, and purchased a Wowza license once his site was a viral success. He offered the company back pay, but Good's team decided the promotion they'd get was worth more.
"We realize that a lit bit of piracy is actually okay," says Good, since it allows for some experimentation.
Even though Good's fifth connection on Chatroulette showed him a man committing a disgusting act (no, not that one; something worse), he believed early on in Ternovsky's work.
"I told my wife, I think this guy's got something," says Good.
Chatroulette now gets 1 million unique users every day, with the U.S., France, Germany, the U.K., Canada, Turkey, and China providing the most users. Only one country has never tried the site, says Ternovsky: Chad.
In the future, Ternovsky would like to add games to the site, such as chess, to give people another way to interact. He's also working on a full-screen version, although he's unsure how much bandwidth it will take. While the next version of the site is still undecided, after his current round of meetings in California, it seems unlikely that Ternovsky will be working on those changes alone.