Namespace: system

  • The cast.framework.system namespace provides classes and enumerations for handling system-related events and data within a Cast receiver application.

  • Classes like ApplicationData, Sender, and SystemVolumeData describe various system components and states.

  • Events such as ReadyEvent, SenderConnectedEvent, and SystemVolumeChangedEvent are dispatched by cast.framework.CastReceiverContext to notify the application of system changes.

  • Enumerations define possible values for device capabilities, disconnect reasons, event types, launch methods, message types, and system states like standby and visibility.

  • The DeviceCapabilities enumeration provides information about the capabilities of the Cast-enabled device and connected display.

Classes

Enumerations

DeviceCapabilities

static

string

Describes the capabilities of the current setup, which is made up of the Cast-enabled device and, where applicable, the display device it is connected to.

Value

AUDIO_ASSISTANT

string

Audio Assistant support. Examples of Cast-enabled devices with Audio Assistant support include the Google Home and the Google Home Mini.

BLUETOOTH_SUPPORTED

string

Bluetooth support.

DISPLAY_SUPPORTED

string

Display output support. Examples of Cast-enabled devices with display support include Chromecast and Cast TVs. Examples of Cast-enabled devices that lack display support include Chromecast Audio and Google Home.

HI_RES_AUDIO_SUPPORTED

string

High-resolution audio (up to 24-bit / 96KHz) support.

IS_DV_SUPPORTED

string

Dolby Vision support.

IS_HDR_SUPPORTED

string

HDR video support.

CAST_LITE_ONLY

string

Whether this device is running on an audio-only platform. Some APIs may not be fully supported on such platforms.

DPAD_INPUT_SUPPORTED

string

Whether this device supports an input mechanism, such as an unlocking DPAD.

TOUCH_INPUT_SUPPORTED

string

Touch input support. Examples of Cast-enabled device that support touch input include Google Nest Hub and Google Nest Hub Max.

IS_GROUP

string

If the device is a virtual device and represents a group target rather than a physical device.

IS_DEVICE_REGISTERED

string

When set to true, this flag indicates that the Cast device is registered in the Cast Developer Console

IS_CBCS_SUPPORTED

string

When set to true, this flag indicates that the CBCS scheme (SAMPLE-AES) is supported.

IS_DOLBY_ATMOS_SUPPORTED

string

When set to true, this flag indicates that Dolby Atmos is supported through audio passthrough.

DeviceInformation

static

string

Constants for the valid keys in cast.framework.CastReceiverContext.DeviceInformationObj.

Value

MODEL_NAME

string

The name of the device model (ex: Google TV Streamer, Nest Hub, Nest Mini, etc.) if known. 'unknown' if not known.

BRAND_NAME

string

The name of the device brand (ex: Google, LG, Sony, etc.) if known. A blank string if not known.

OS_NAME

string

The name of the device OS (ex: Android, Fuchsia, Linux, etc.) if known. A blank string if not known, or 'not Cast' if this is not a Cast device.

OS_VERSION

string

The version of the device OS (ex: 14.0, etc.) if known. A blank string if not known.

ENVIRONMENT

string

The type of environment the device is inside (ex: home, automotive, plane, hotel, etc.) if known. Typically 'home' for most devices.

DEVICE_ID

string

The unique ID of the receiver device, if known. Will be the same value as the Cast Receiver ID exposed by the Sender SDK. A blank string if not known.

METADATA_FROM_FIRMWARE

string

Whether the device information was provided by the firmware.

DisconnectReason

static

string

Represents the reason for a disconnect.

Value

REQUESTED_BY_SENDER

string

Connection close was actively requested by the sender application (usually triggered by the user).

ERROR

string

There was a protocol error.

UNKNOWN

string

It is unknown if the sender requested to disconnect gracefully by calling close() (most likely it didn't, but the 'close' message could have been lost). This typically happens when there is a network timeout, when the sender application crashes, or when the sender OS closes the socket.

EventType

static

string

System events dispatched by cast.framework.CastReceiverContext.

Value

READY

string

Fired when the system is ready.

SHUTDOWN

string

Fired when the application is terminated.

SENDER_CONNECTED

string

Fired when a new sender has connected.

SENDER_DISCONNECTED

string

Fired when a sender has disconnected.

ERROR

string

Fired when there is a system error.

SYSTEM_VOLUME_CHANGED

string

Fired when the system volume has changed.

VISIBILITY_CHANGED

string

Fired when the visibility of the application has changed (for example after a HDMI input change or when the TV is turned off or on and the Cast device is externally-powered). Note that this API has the same effect as the 'webkitvisibilitychange' event raised by the browser. This is provided as the cast.framework.CastReceiverContext API for convenience and to avoid a dependency on a webkit-prefixed event.

STANDBY_CHANGED

string

Fired when the standby state of the TV has changed. This event is related to the cast.framework.system.EventType.VISIBILITY_CHANGED event, because if the TV is in standby mode, the visibility will be false.

Visibility states are more granular than standby states (because visibility also includes TV channel selection) but are not reliably detected in all TVs. Standby can be used in those cases because most TVs implement it.

MAX_VIDEO_RESOLUTION_CHANGED

string

FEEDBACK_STARTED

string

Fired when the system starts to create a feedback report.

LaunchedFrom

static

string

This represents what type of request launched the receiver.

Value

UNKNOWN

string

The launch owner could not be determined.

DIAL

string

App was launched by a DIAL request.

CAST

string

App was launched by a Cast V2 request.

CLOUD

string

App was launched by assistant request (for example, by a Google Assistant command).

MessageType

static

string

Types of custom messages.

Value

STRING

string

Messages are free-form strings. The application is responsible for encoding/decoding the information transmitted.

JSON

string

Messages are JSON-encoded. The underlying transport will use a JSON- encoded string.

StandbyState

static

string

This represents the current standby state reported by the platform. It may be UNKNOWN if the Cast platform is unable to determine the state.

Value

STANDBY

string

NOT_STANDBY

string

UNKNOWN

string

SystemState

static

string

This represents the current system state.

Value

NOT_STARTED

string

The application has not been requested to start yet.

STARTING_IN_BACKGROUND

string

Application is starting but is not visible to the user.

STARTING

string

Application is starting.

READY

string

Application is in the foreground and is ready to send and receive messages.

STOPPING_IN_BACKGROUND

string

Application is stopping while in the background.

STOPPING

string

Application is stopping.

VisibilityState

static

string

This represents the current visibility state reported by the platform. It may be UNKNOWN if the Cast platform is unable to determine the visibility state.

Value

VISIBLE

string

NOT_VISIBLE

string

UNKNOWN

string

Properties

DeviceCapabilities

static

string

Describes the capabilities of the current setup, which is made up of the Cast-enabled device and, where applicable, the display device it is connected to.

Value

AUDIO_ASSISTANT

string

Audio Assistant support. Examples of Cast-enabled devices with Audio Assistant support include the Google Home and the Google Home Mini.

BLUETOOTH_SUPPORTED

string

Bluetooth support.

DISPLAY_SUPPORTED

string

Display output support. Examples of Cast-enabled devices with display support include Chromecast and Cast TVs. Examples of Cast-enabled devices that lack display support include Chromecast Audio and Google Home.

HI_RES_AUDIO_SUPPORTED

string

High-resolution audio (up to 24-bit / 96KHz) support.

IS_DV_SUPPORTED

string

Dolby Vision support.

IS_HDR_SUPPORTED

string

HDR video support.

CAST_LITE_ONLY

string

Whether this device is running on an audio-only platform. Some APIs may not be fully supported on such platforms.

DPAD_INPUT_SUPPORTED

string

Whether this device supports an input mechanism, such as an unlocking DPAD.

TOUCH_INPUT_SUPPORTED

string

Touch input support. Examples of Cast-enabled device that support touch input include Google Nest Hub and Google Nest Hub Max.

IS_GROUP

string

If the device is a virtual device and represents a group target rather than a physical device.

IS_DEVICE_REGISTERED

string

When set to true, this flag indicates that the Cast device is registered in the Cast Developer Console

IS_CBCS_SUPPORTED

string

When set to true, this flag indicates that the CBCS scheme (SAMPLE-AES) is supported.

IS_DOLBY_ATMOS_SUPPORTED

string

When set to true, this flag indicates that Dolby Atmos is supported through audio passthrough.

DeviceInformation

static

string

Constants for the valid keys in cast.framework.CastReceiverContext.DeviceInformationObj.

Value

MODEL_NAME

string

The name of the device model (ex: Google TV Streamer, Nest Hub, Nest Mini, etc.) if known. 'unknown' if not known.

BRAND_NAME

string

The name of the device brand (ex: Google, LG, Sony, etc.) if known. A blank string if not known.

OS_NAME

string

The name of the device OS (ex: Android, Fuchsia, Linux, etc.) if known. A blank string if not known, or 'not Cast' if this is not a Cast device.

OS_VERSION

string

The version of the device OS (ex: 14.0, etc.) if known. A blank string if not known.

ENVIRONMENT

string

The type of environment the device is inside (ex: home, automotive, plane, hotel, etc.) if known. Typically 'home' for most devices.

DEVICE_ID

string

The unique ID of the receiver device, if known. Will be the same value as the Cast Receiver ID exposed by the Sender SDK. A blank string if not known.

METADATA_FROM_FIRMWARE

string

Whether the device information was provided by the firmware.

DisconnectReason

static

string

Represents the reason for a disconnect.

Value

REQUESTED_BY_SENDER

string

Connection close was actively requested by the sender application (usually triggered by the user).

ERROR

string

There was a protocol error.

UNKNOWN

string

It is unknown if the sender requested to disconnect gracefully by calling close() (most likely it didn't, but the 'close' message could have been lost). This typically happens when there is a network timeout, when the sender application crashes, or when the sender OS closes the socket.

EventType

static

string

System events dispatched by cast.framework.CastReceiverContext.

Value

READY

string

Fired when the system is ready.

SHUTDOWN

string

Fired when the application is terminated.

SENDER_CONNECTED

string

Fired when a new sender has connected.

SENDER_DISCONNECTED

string

Fired when a sender has disconnected.

ERROR

string

Fired when there is a system error.

SYSTEM_VOLUME_CHANGED

string

Fired when the system volume has changed.

VISIBILITY_CHANGED

string

Fired when the visibility of the application has changed (for example after a HDMI input change or when the TV is turned off or on and the Cast device is externally-powered). Note that this API has the same effect as the 'webkitvisibilitychange' event raised by the browser. This is provided as the cast.framework.CastReceiverContext API for convenience and to avoid a dependency on a webkit-prefixed event.

STANDBY_CHANGED

string

Fired when the standby state of the TV has changed. This event is related to the cast.framework.system.EventType.VISIBILITY_CHANGED event, because if the TV is in standby mode, the visibility will be false.

Visibility states are more granular than standby states (because visibility also includes TV channel selection) but are not reliably detected in all TVs. Standby can be used in those cases because most TVs implement it.

MAX_VIDEO_RESOLUTION_CHANGED

string

FEEDBACK_STARTED

string

Fired when the system starts to create a feedback report.

LaunchedFrom

static

string

This represents what type of request launched the receiver.

Value

UNKNOWN

string

The launch owner could not be determined.

DIAL

string

App was launched by a DIAL request.

CAST

string

App was launched by a Cast V2 request.

CLOUD

string

App was launched by assistant request (for example, by a Google Assistant command).

MessageType

static

string

Types of custom messages.

Value

STRING

string

Messages are free-form strings. The application is responsible for encoding/decoding the information transmitted.

JSON

string

Messages are JSON-encoded. The underlying transport will use a JSON- encoded string.

StandbyState

static

string

This represents the current standby state reported by the platform. It may be UNKNOWN if the Cast platform is unable to determine the state.

Value

STANDBY

string

NOT_STANDBY

string

UNKNOWN

string

SystemState

static

string

This represents the current system state.

Value

NOT_STARTED

string

The application has not been requested to start yet.

STARTING_IN_BACKGROUND

string

Application is starting but is not visible to the user.

STARTING

string

Application is starting.

READY

string

Application is in the foreground and is ready to send and receive messages.

STOPPING_IN_BACKGROUND

string

Application is stopping while in the background.

STOPPING

string

Application is stopping.

VisibilityState

static

string

This represents the current visibility state reported by the platform. It may be UNKNOWN if the Cast platform is unable to determine the visibility state.

Value

VISIBLE

string

NOT_VISIBLE

string

UNKNOWN

string

Abstract types

DeviceCapabilitiesObj

static

Describes the object returned by getDeviceCapabilities

See also
cast.framework.system.DeviceCapabilities

DeviceInformationObj

static

Describes the object returned by getDeviceInformation

See also
cast.framework.system.DeviceInformation