Chromecast Communication Protocol

The sample receiver and sender applications use Google's media namespace to send play, pause, seek, start, and other events between the sender and receiver. We use Google's cast media commands, which create media status objects in the receiver code. The receiver publishes to the Ooyala message bus to set closed captions and send additional player state information to the sender. You can use your own sender application with the Ooyala receiver application as long as you set up the communication protocol to handle events.

The namespace used in the sender and receiver Ooyala Chromecast Integration applications is x-urn:cast:ooyala.

Sender → Receiver

Upon connecting to the receiver, the sender creates a media session that loads the required video via the MediaInfo object with the video embed code. When the video is loaded, the sender gets a media object from the receiver which is used to communicate with the receiver. The sender also gets messages through the Ooyala namespace message bus from the receiver to control closed captions and update the state of its control widgets.

The sender receives media status updates implicitly to know whether or not the media session is alive, the state of the player, etc. Sender commands to control the player have callbacks that can be used for notifications about changes in media status.

Receiver → Sender

All events are processed through the MediaManager object. When you call commands on the receiver, methods on MediaManager are called, such as MediaManager.onPlay, MediaManager.onSeek, etc. Look at the comments in https://github.com/ooyala/chromecast-sample-receiver/blob/master/receiver_custom.html for a detailed breakdown of events communicated with the MediaManager object.

Was this article helpful?