Hide

Debugging

To bring up the debugger for a particular Google Cast device, use the Chrome Remote Debugger as follows.

To debug Cast apps on an Android TV device, see Android TV: Debugging.

To debug on a Chromecast device, do the following:

  1. Register your application and Google Cast device on the Google Cast SDK Developer Console.

    Both the application and device must be registered in order for you to perform debugging.

  2. Start your sender application and cast to the Google Cast device to load the receiver app for debugging.
  3. In the Chrome browser, enter the IP address of the device (eg. a Chromecast) on port 9222.
    http://RECEIVER-IP-ADDRESS:9222

    The browser must be running on a computer connected to the same network as the receiver device.

    To get the IP address of a particular Google Cast device, use the Chromecast setup application:

    • On a device connected to the same network as the receiver device, in the Chromecast setup application, select the settings for the Chromecast with the IP address you want.
    • The setup app for each platform has slightly different behavior, but finding the IP address is trivial on all flavors of the setup app.

  4. Run the debugger for your app.

    The debugger will load with an initial page showing two options for starting a debugging session:

    • Click the link, Remote Debugging (App Engine).

      Use this link to debug on a non-Chrome browser. You may have to click the shield icon in the URL field to enable scripts.

    • Copy the URL text starting with chrome-devtools://devtools/remote/serve_rev..., open a new tab, and paste the URL text into the URL field in Chrome.
  5. In the Chrome Remote Debugger console, enable debug logging, by entering the following:

    cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);

    Full DOM manipulation is supported as well as the full Chrome JavaScript REPL (console), which will allow you to tinker with the running Google Cast Receiver application. When your receiver is torn down (lifecycle ended), the debugger will become inactive with a warning message along the top. At this point you cannot interact with the debugger. You must restart the receiver app and then reload the remote debugger URL to restart debugging.

Breakpoints

You can add manual breakpoints to your code by using debugger; within your receiver code.

Local Caching

Use window.location.reload(true); to perform a forced reload that flushes the cache of the receiver application.

Preserving logs between sessions

You can preserve the logs between sessions by clicking the gear icon within the debugger and checking the box next to “Preserve log upon navigation”.