Command and Control (CaC) Tool

The Command and Control (CaC) Tool is a functional web sender for developers to test and debug a Web Receiver application.

Developers can use the CaC Tool to:

  • Launch a Web Receiver app on a Cast-enabled device and send a load request to start media playback.
  • Simulate voice commands sent by Google Assistant to the Web Receiver.
  • Capture logs from Cast Debug Logger and control the Web Receiver debug overlay.

Launch Web Receiver app

There are two ways to launch your Web Receiver with the CaC Tool:

  1. To start a new Cast session:

    1. Open the CaC Tool, enter your Web Receiver App ID and click the SET APP ID button.
    2. Click on the Cast button and select a device to launch the Web Receiver on a remote Cast-enabled device.

  2. To join an existing Cast session:

    1. Get the running Cast session ID by using the following codes:

      From the Web Receiver side, use the following method to get session ID in the Chrome Remote Debugger console:

      cast.framework.CastReceiverContext.getInstance().getApplicationData().sessionId;
      

      Or to get the session ID from a connected Web Sender, use the following method:

      cast.framework.CastContext.getInstance().getCurrentSession().getSessionId();
      
    2. Enter the session ID in the CaC Tool and click the RESUME button.

When the CaC Tool is connected to the Web Receiver app, the Cast button appears with a filled frame shape. The Web Receiver app ID and session ID are also displayed at the top of the tool.

Load media

Load media from either your sender app or the CaC Tool.

Sender app

To start media playback on your Web Receiver, cast your sender app to the same Cast-enabled device and send a load request from your sender app to the Web Receiver.

CaC Tool

The CaC Tool also provides multiple ways to send a load request to the Web Receiver app:

Load by entity (voice casting)

When users initiate media playback through Google Assistant, Google Assistant uses Command and Control (CaC) messages to send user credentials and entity to your Web Receiver.

The CaC Tool simulates voice casting and sends a load request with credentials and entity.

Load by content

The CaC Tool can also simulate your app sending a load request with Content ID or Content Url.

When a media playback starts, the CaC Tool receives Media Status messages from your Web Receiver app and displays them on the MEDIA STATUS tab.

Custom Load Request

If you would like to test your receiver using your own Load Request objects, use the Custom Load Request field under the LOAD MEDIA tab. First, select the type of request from the Select Request Type radio buttons and then copy-paste or build your own JSON object.

Test voice commands

The CaC Tool also simulates voice commands sent by Google Assistant to your Web Receiver app. You can test if the media commands that your app supported are working properly. Non-supported media commands must be handled with appropriate error type and error reasons.

Inspect and control Cast Debug Logger

If your Web Receiver app enables Cast Debug Logger, the CaC Tool captures the log messages and controls the Web Receiver debug overlay.

Use the following buttons to control the Web Receiver and log messages:

  • Web Receiver App ID
    • Clear Cache and Stop Web Receiver - Reload the Web Receiver app and stop casting
  • Web Receiver Debug Overlay
    • Show - Toggle the debug overlay on the Web Receiver
    • Clear - Clear log messages on the Web Receiver debug overlay
  • Log Message Controls
    • Insert Message - Insert comments or dividers to the log area
    • Download Log - Save log messages
    • Clear Log - Clear log messages on the log area
  • Log Messages
    • Custom Tags - Click the checkbox to filter log messages

Following tags might appear under the Custom Tags. These are added by the CaC Tool to show and filter important logs or messages pertaining to the debugging session:

  • MEDIA - Messages successfully sent over the Media namespace
  • MEDIA-ERROR - Error occurred while sending, or in response to messages sent over the Media namespace
  • CAC - Messages successfully sent over the CAC namespace
  • CAC-ERROR - Error occurred while sending, or in response to messages sent over the CAC namespace
  • PLAYING - Log displaying the result when the What’s Playing button is clicked in the CaC Tool
  • USER - Log displaying custom message entered by User with Insert Message button in CaC Tool

Test Cast Connect

To test Cast Connect, perform the following steps before establishing a session:

  1. Enter the Receiver App ID associated with your Cast Connect-enabled receiver and click Set App ID.
  2. Click on Show Android TV Options button.
  3. Check androidReceiverCompatible checkbox. If your receiver doesn’t require Launch Credentials to be set, or you want to test what happens in case it is not set, you can stop here and continue to Step 5.
  4. (Optional) Enter the Launch Credentials and click on the Set Launch Credentials button in order to set the launch credentials for the Cast Connect session.
  5. Start a cast session by clicking on the Cast icon in the header or through the Cast menu in your Chrome browser.

Your Android TV application should now launch on your device.