What Does Chromecast SDK?

Google Chromecast It is much more than a device to make multimedia streaming. The possibilities that opens Chromecast SDK are quite spacious. Despite this, at present, the number of applications that support Chromecast is reduced, based basically send a photo or video to the TV, no more. And the worst, when you get used, you miss at fault that some applications do not provide support. Still missing apps that exploit the potential of the Chromecast.
Simplifying the Chromecast components, We can say that it is a device with an HDMI connector and a WiFi interface that is running a version of Chrome OS and Chrome browser, but without support at the moment for WebGL and Chrome Native Client (NaCL), would be awesome if they add it. With all this, his power resides in collaboration with Android (also iOS) applications that integrate Chromecast SDK.
The fundamental principle applications that implement the Chromecast features is that they are totally transparent to users who do not have such a device. I.e., only if we are connected to a WiFi network with an available Chromecast send button shows / interact with it. To carry out this ‘discovery’ automatic DIAL (Discover And Launch Protocol) and UPnP protocol is used, it makes multicast within the network to make the network connected devices that respond if they are available.

Components of an application that uses the SDK Chromecast

The reproduction of the Chromecast control carried out by a sender (mobile device or a computer) and the receiver (TV set) is which reproduces the content. Due to the limitations of hardware, CPU and GPU, applications that make receivers have to be as light as possible. Chromecast supports a single concurrent streaming of audio or video, and multiple audio tracks using WebAudio API. There are different recommendations at the level of UI and usability for both components to have a design consisting of apps.

Implementation of the Sender (application that sends content to Chromecast)

To implement a sender app should do so integrated in Android, iOS, or Chrome application.
Focusing on what are the applications Android We need a minimum Gingerbread (minSDK version 9). Chromecast SDK is integrated into the library of Google Play Services, which includes other utilities such as, for example, the Push Notification service. Also requires the libraries of compatibility (android-support-v7-appcompat and android-support-v7-mediarouter), essential to manage chromecast button and integrate them into the actionbar.
Without going into too many details of implementation, the Chromecast SDK allows us to:

  • Add Chromecast Cast button in our application. In general, on the action bar, or on the player that we use in our application.
  • ‘Discover’ and select the device Chromecast that we want to send streaming, in the event that you have more than one with information concerning each one (unique identifier).
  • Launch and boot the Chromecast connected to our interaction with our application flow.
  • Management of the session and the interactions with the player the Chromecast, pausing, ahead or any audio or video selection.
  • Create notifications to go by sending to the device information of the streaming of the Chromecast notification bar.
  • From Android 4.1 we can implement the lock screen to display playback information.
  • The volume control through buttons hardware controlling the streaming mobile device.

Implementation of the Receiver (application that runs on the Chromecast)

The part of the application that executes in the Chromecast receiver we can implement it using HTML5/JavaScript. The purpose of this application is to provide an interface that displays the content on television and manages the interactions you receive from the control device. Google puts at your disposal its Media Player with its API library to interact.
The interface displayed in the Chromecast can be one Basic with a pre-defined style. Components already created by Google specifically for streaming audio or video. Can be modified both in colours and branding via CSS.
If we want to make things more customized out of the basic controls of a media player must create a Custom Receiver using the API JavaScript from the Receiver. This allows us more versatility, offering more elements on screen.

Life cycle and communication between the device Android and Chromecast

The cycle of life to launch an application to our TV via Chromecast consists of the following steps:

  • Home of our application, in which we have the Sender responsible for communication with the device Chromecast app. Through self-discovery our Sender App enables Chromecast button in the application.
  • Subsequently, should select the device in particular that we want to use as a receiver, in the case that there are more than one will be shown a drop-down with the Chromecast, also more compatible devices like the Samsung Smart TV can appear in the YouTube app.
  • When we have selected the device starts your application receiving (Receiver App) showing the interface that we have implemented in the TV screen. If, for example, have launched a video appears on display the loading of the content and then play starts. At this point both the Sender App and Receiver App are connected so that we can control our Android device the Chromecast until it is disconnected.

Media formats supported by Chromecast

  • Image formats: BMP, GIF, PNG, JPEG, WEBP
  • Streaming protocols: MP4, WebM
  • Streaming protocols for Adaptive bitrate: MPEG-DASH, SmoothStreaming, HTTP LIve Streaming (HLS)
  • Video codec: H.264 Level 4.1, 4.2 and 5, VP8
  • Audio codec: AAC-LC, CELT/Opus, MP3, HE-AAC, Vorbis
  • Implementations of subtitles: TTML, WebVTT, CEA-608