Sometimes there are wonderful moments in technology like this:
I’m sitting in my living room listening to music on Google play, cast to an audio only Chromecast in my living room (no TV attached).
Jordann sees an album cover of the song I cast on my phone and asks what it is. “It looks like Pandora opening her box”, I say.
"Who is Pandora"?
I take out my phone and say, “Okay Google.” Pause. “The story of Pandora for kids.”
A second later I have search results with a YouTube video.
I click the video and cast it to the TV room across the house for her to watch.
Sometimes it’s difficult to get a decent overview of a new development technology. Chromecast development can look daunting at first glance, but it’s actually remarkably simple. After playing with it on and off for a couple of weeks here’s my summary of Chromecast development:
- There is an API that lets you build native Android and iOS applications that interact with Chromecast.
- There is an API for websites and web applications, but it is through a Chrome extension. To be clear, you must have the Chrome extension installed in order for a website to interact with Chromecast. Obviously this requires Chrome (sorry, Konquerer fans).
- Mobile Chrome does not support extensions, so it is not possible to write mobile websites with custom Chromecast integration.
- Google is slowly and experimentally introducing Chromecast buttons in video embeds. You cannot interact with them programmatically, but these buttons do provide a basic level of casting to a web site (even mobile).
A Chromecast application can have two parts:
This is written as either a native mobile app or a desktop web application (with the Chromecast extension installed).
For example, you might write a native mobile app that aggregates videos from the web about video games, and contains buttons to play, pause or rewind the video. Or you might write an app that is not video related at all, and just casts text or photos.
Generally speaking, the receiver app does not render videos directly. Instead, it sends bits of data, such as URLs to the receiver app, which in turn takes care of the rendering.
For example, you might show a video game video on the screen and perhaps overlay the video with a caption about the video game. In some cases receiver apps do nothing more than play a video, in which case there are a few default apps you can use to save you the coding trouble.
I love how young mobile is. This is a great way to explore mobile visualization.
For anyone wondering about the basic principal behind base conversion, here’s a really simple example.
var num = 32;
var base = 2;
var convertedNum = '';
// Keep looping until num is 0:
// Keep sticking num % base at the beginning of the final string:
convertedNum = String(num % base) + convertedNum;
// Keep trimming down num by dividing it by base:
num = Math.floor(num /= base);
} while (num > 0);
print(convertedNum); // Output should be "100000", which is binary for 32. Yay.
This only works with bases up till 9, but it explains the basic concept pretty well.
This so justifies my dislike of single line curly braces.