Cast Application Framework (CAF) Receiver Overview

Receiver Application

A receiver application is an HTML5/JavaScript application that runs on the receiver device, such as a Chromecast. The receiver application performs the following functions:

  • Provides an interface to display the app's content on the TV.
  • Handles messages from the sender application to control content on the receiver device.
  • Handles custom messages from the sender application that are application-specific.

The CAF Receiver provides additional functionality.

CAF Receiver SDK

CAF Receiver SDK is a major upgrade from the current Receiver v2 SDK. Improvements focus on significantly reducing the amount of code required to implement a receiver app, while making Cast more reliable to maintain. This was done by implementing all common use cases into CAF.

The resulting improvements in reliability and performance benefit both existing receiver apps that you upgrade as well as new receiver apps. Moving forward, your app will automatically benefit from new features such as Google Assistant.

CAF Receiver SDK also comes with a built-in media player, which provides a seamless and easy playback experience. It also provides the same flexibility as before, allowing your own player UI that can intercept and override messages and methods to execute your custom business logic.

CAF Receiver Features Overview

Queueing

Queueing is a major feature introduced as part of CAF Receiver. The earlier Receiver v2 implementation carries a basic sender-initiated queue while the new queueing implementation in CAF Receiver introduces receiver-implemented queueing.

Queueing provides the following features:

  • Support of Google's cloud queue implementation so an externally stored and created queue can be directly loaded into Cast devices.
  • Mechanisms that allows pagination of items in the queue rather than loading everything at once, solving our v2 message size limit issue.
  • Support for new messaging such as going to the next item, the previous item, fetching a window of items, as well as getting media information related to a set of queue items.
  • Better integration with the Cast eco-system such as Google Home through new queueing data.
  • An easy to use QueueManager API that allows insertion, removal, and update of queue items.

Event handling

The CAF Receiver SDK allows your receiver app to handle player events. The event handler takes a cast.framework.events.EventType parameter (or an array of these parameters) that specifies the event that should trigger the listener.

Message interception

CAF Receiver SDK allows your receiver app to intercept messages and execute custom code at that point of interception. Message interception can be especially useful if you want do things like customizing the load request data.

Ad Breaks

The CAF Receiver SDK supports embedding ads within a given media stream; it provides two ways to incorporate ad breaks to the receiver: client-side and server-side stitching using breaks and break clips.

Audio tracks

Audio track selection in the new CAF Receiver SDK has an AudioTracksManager class that simplifies and streamlines track selection, giving you more control and better access to properties, such as name, URL and language.

Closed captions (subtitles)

Closed caption track selection in the new CAF Receiver SDK has a TextTracksManager class that simplifies and streamlines track selection, giving you more control and better access to properties, such as name, URL and language (much like Audio track selection).

Custom messages

Message exchange is the key interaction method for receiver applications. A sender can send a message to the receiver and vice versa. A receiver application may choose to listen for messages on a specified namespace. It is then up to any connected senders wishing to communicate on that namespace to use the appropriate protocol.

Styling the player

The CAF Receiver SDK provides a built-in player UI. In order to use the built-in player UI you need to add cast-media-player element to your HTML. CSS-like styling allows setting various things including background-image, splash-image, font family and other things. This functionality allows for better branding and overall customization.

Custom UI Data Binding

Custom UI data binding allows you to use your own custom UI element and use the PlayerDataBinder class to bind the UI to the player state. The binder also supports sending events for data changes, if the app does not support data binding.

Content preload

CAF Receiver supports preloading of media items after the current playback item in the queue. The preload operation pre-downloads several segments of the upcoming items. Preloading will work for HLS and Smooth streaming content by default. For regular MP4 video and audio files such as MP3, those will not be preloaded, as Cast devices support one media element only and cannot be used to preload while an existing content item is still playing.

Next Step

Go to Create basic CAF Receiver.