Chromecast – Debug your custom receiver application and a few tips

September 13, 2014

Chromecast is quickly gaining popularity as a device of choice to stream content to TVs. So naturally we started working on adding Chromecast to our repertoire. When we started the setup process, we quickly realized that the relevant information was scattered across different places. The process of enabling debug mode itself required combining information from various sources. We are giving all relevant information below.

Here are the steps for whitelisting the device for debugging your receiver app –

  1. Sign-in to https://cast.google.com/u/2/publish/#/devices and then add your device using its serial number. The serial number is written on the back of the device.
  2. Install the Chromecast setup app in your PC/Mac/Smart-Phone and follow the steps as mentioned in https://cast.google.com/chromecast/setup/.
  3. IMPORTANT – While setting up the device, select the option “Send this Chromecast’s serial number when checking for updates”. This will turn on the Debug mode.
  4. In the setting page, you will find the device IP (<Device-IP>). Use port 9222 to access the console logs. In your browser, open http://<Device-IP>:9222/ to see the console logs of the receiver applications.

Caveat – This debugging will not work on Firefox(v 31.0) browser (as Firefox does not support innerText() method and Google used innerText() method in their main receiver app). All other browsers we tested on, (e.g. IE, Chrome, Opera and Safari) are rendering this properly.

  1. ENJOY Debugging…..

Publishing customer receiver app over HTTPS –

If you are writing any custom receiver, you need to put that in a web-server which can be accessed over HTTPS. When developing an app, an SSL certificate signed by a CA may not be available. In such cases, Chromecast will give an error.

To avoid this error, use your Google drive to publish your custom receiver app. Then access your app over HTTPS.

 

Customer receiver app to support HLS stream

Before even trying to play an HLS stream on Chromecast, first check the HTTP headers coming from the HLS server. If there is no “Access-Control-Allow-Origin: *” HTTP header present, the stream will not play in Chromecast. Simple way to check the header is to run a “curl –i” command.

Remember that, “Access-Control-Allow-Origin: *” HTTP header is MUST. CORS.xml or crossdomain.xml or crossdomainaccesspolicy.xml will not help…. Each HTTP packet must have the header “Access-Control-Allow-Origin: *”.