Google Chromecast

Introduction to development

Davor Jerbić

August, 2014

JavaScript Zagreb Meetup

Talk overview

  • Device and features
  • Why Chromecast?
  • How does it work?
  • Developing receiver apps
  • Example
  • Future
  • QA

The Device

  • Developed by Google
  • Announced and went to market on July 24, 2013
  • Costs only 35$
  • Runs web applications, primarily built for multimedia streaming

Hardware

  • Model H2G2-42
  • Armada 1500-mini system on a chip
  • Hardware codec decoding
  • 1080p HDMI output supporting CEC
  • WiFi
  • 512 Mb of RAM
  • 2 Gb of flash storage

Software

  • "a simplified version of Chrome OS"
  • Acts as a single Chrome tab
  • SKD available for:
    • Android 2.3+
    • iOS 6.0+
    • Chrome 28+
  • SDK went public on February 3, 2014

"Chromecast cast button icon" by Google, Inc. - https://developers.google.com/cast/docs/downloads. Licensed under Creative Commons Attribution 3.0 via Wikimedia Commons

Why Chromecast?

  • Everybody else is doing it! :)
  • Ongrowing widespreadness
  • Additional feature to your app that users will embrace and appreciate
  • Easy (cheap) development

How does it work?

  • mDNS is used for device discovery
  • Sender devices (i.e. Android, iOS or Chrome client) instruct receiver (Chromecast) to open specific URL where application is hosted
  • Sender and receiver apps communicate using WebSockets
  • These operations are abstracted with Chromecast receiver and sender APIs
  • Once ran, receiver app is able to communicate over the Internet without sender

And security?

  • Sender device must be in the same WiFi as the receiver
  • Chromecast application is run inside the Chrome browser so all security contrains apply, just as they apply on a regular web page

Implementing the receiver

  • API provides simple mechanisms for asynchronous communication
  • //www.gstatic.com/cast/sdk/libs/receiver/
    /2.0.0/cast_receiver.js
  • cast.receiver.CastReceiverManager
    • Singleton that manages connected senders and message buses
  • cast.receiver.CastMessageBus
    • Manages messages for a specific namespace

Implementing the receiver

  • cast.receiver.CastChannel
    • Manages messages for a specific sender and namespace
  • cast.receiver.MediaManager
    • Used to handle media messages
    • Last class in the API!

Chrome is underneath!

  • Apps are run in (almost) latest version of  Chrome browser
    • All the ugly things related to the web application development are gone!
  • Debugging is easy
    • Chrome developer tools are available at Chromecast's IP at port 9222

Problems?

  • It is still a new technology, there are known issues
  • Chromecast is weak
    • Use native CSS animations!
  • Cross-origin requests
    • Server side must implement CORS

Example

How to start?

  • Create a Google developer account (5$ fee)
  • Register your application on Google Cast SDK Developer Console
  • Whitelist your Chromecast for testing during development
  • Publish when done!

Future

  • Users' controlling devices will no longer need to be connected to the same Wi-Fi network as the Chromecast
  • "Backdrop" feature will incorporate a user-personalized feed of content into the Chromecast's home screen
  • Usage in fields other than multimedia

Thank you!

Questions?

Sources:

https://developers.google.com/cast/

http://robtweed.wordpress.com/2014/04/05/chromecast-understanding-its-potential/

http://en.wikipedia.org/wiki/Chromecast

Chromecast

By djerbic

Chromecast

  • 1,922