General

Chromecast SDK: Introduction

Chromecast SDK: Getting Started

With the Chromecast’s open SDK i thought it would be good to look into it. There are 2 components;

  1. The Caster application. This application sends the video to the receiver. Google has changed how the new SDK works slightly from what you may see on Youtube or Netflix today. For instance, this SDK requires that the Chromecast device be selected from the Chrome Extension. You cannot list out the Chromecast devices on your own and allow for selection. This i think makes no sense, it detracts from the experience personally.
  2. The Receiver. You may not need this at all. The default receiver is what you see when the Chromecast is plugged in. You will only need to create a new one if A) you are playing DRM video or B) you want a very custom receiver experience. The code i have written uses the default receiver.

Developing a Caster

I found that the API was pretty easy to work with but there were things missing like Chrome extension detection. Without this the code flips out on say, Safari. I am providing a API wrapper i wrote to help make things easier. Please expand it and modify it.

chromecast wrapper JS

This is how to use it:

     // Instantiate the Object
     var chromecast = new Chromecast();

     // The Object will trigger a callback when everything is set up and a extension is available. (works, Safari, Opera, IE, Ect)
     $(chromecast).on('chromecast_availablity', function(event, payload){
if(payload.status == "available"){
          // chromecast.loadMedia('');
        }
      });

      // Load a video, this video works and is Big Buck Bunny...
      chromecast.loadMedia('http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4');

      // Issue playback commands to it
      chromecast.play();
      chromecast.pause();
      chromecast.stop();
      chromecast.seek();

Findings

  • There was not a lot of clear documentation.
  • Lack of self awareness. If you linked to the google cast js from Safari it blew up.
  • Rigid implementation, we should be able to iterate through the available players.

Developing a Receiver

First off, you need to start with a developer account at Google to register devices and create a new application. Go here, Google Development Center. Early warning, Google will charge you $5.00 for this privilege.  After signing in you will need to register a new app and a new device.

  1. Create a new App. Pick if you would like to create the receiver (the app the chromecast knows about) or use a pre made one that you can style.
  2. Have your Chromcast Device serial number handy. It is a 12 digit alphanumeric combo on the underside of the device. Warning: They made it nearly impossible to read. Grey text on black 2pt font and they crammed the letters together)

Since i have not built a receiver i will digress to Google here.

Standard

One thought on “Chromecast SDK: Introduction

  1. It’s hard to find your articles in google. I found it on 19
    spot, you should build quality backlinks , it will help you to
    get more visitors. I know how to help you, just type in google – k2 seo tips

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>