Streams, Peerflix, and node-webkit

2014-10-31 00:00:00 +0000 by Alex R. Young

Recently a web service called Joker has been in the technology press. It's a web application that downloads torrents based on magnet URIs, and allows users to stream video content and fast forward to any point in the video. Of course, it's already been taken down, and it didn't always work as well as my description sells it, but it was an interesting experiment all the same.

I remember being completely astounded that Popcorn Time was built with JavaScript. Porpcorn Time is a web application that runs in a desktop wrapper so you can use it in Mac OS, Windows, and even Android. The pirates know what they're doing: cross-platform support from day one with a cool interface that integrates data from web services like IMDB.

Two things make Popcorn Time possible: node-webkit-builder and peerflix.

node-webkit-builder makes it easy to build cross-platform desktop apps with node-webkit:

node-webkit is an app runtime based on Chromium and node.js. You can write native apps in HTML and JavaScript with node-webkit. It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.

peerflix will stream torrents from a magnet link to a HTTP server that video players like VLC can connect to. It's based on torrent-stream, a Node stream torrent client that has a friendly API.


torrent-stream uses lots of small modules to do the job. For example, magnet-uri can parse magnet URIs, and peer-wire-swarm is a swarm implementation.

Reading through these modules is like a showcase of Node's stream API. Academically they're fascinating, despite the obvious grey market connotations.

Which brings me to the TV/movie/music "PVR"-like applications. Media cataloguing doesn't have to be for pirated content: I have lots of DRM-free music, video, and books that could be presented in a better way. Combining my music purchases from Amazon, Apple, and Google into a cool desktop media browser powered by Node with a friendly RESTful API would be really fun and useful.

There's actually a node-webkit apps list, but I haven't yet found my perfect Node-powered media browser. Let me know if you've made your own Node media browser (or anything similar) and I'll check it out!