@UnstableApi
public final class CastParams


Contains Cast configuration options.

Options contained in this class can be passed to initialize in order to set up the Cast configuration as part of initialization, or to change the Cast configuration after initialization has completed.

Options set in this class take precedence over Cast options, such as DefaultCastOptionsProvider, or Manifest-provided Cast options. However, options not set in this class (modeled using null) fall back to Manifest-provided options, if available, or DefaultCastOptionsProvider options otherwise.

See also
initialize

Summary

Nested types

@UnstableApi
public final class CastParams.Builder

Builder for CastParams.

Constants

static final CastParams

Public methods

@Nullable String

Returns the Cast receiver application ID, or null if not set.

@Nullable Boolean

Returns whether to enable the remote to local feature, or null if not set.

@Nullable Boolean

Returns whether to show system output switcher when clicking on the cast button, or null if not set.

Constants

DEFAULT

public static final CastParams DEFAULT

Public fields

receiverApplicationId

public final @Nullable String receiverApplicationId

remoteToLocalEnabled

public final @Nullable Boolean remoteToLocalEnabled

showSystemOutputSwitcherOnCastButtonClick

public final @Nullable Boolean showSystemOutputSwitcherOnCastButtonClick

Public methods

getReceiverApplicationId

public @Nullable String getReceiverApplicationId()

Returns the Cast receiver application ID, or null if not set.

If not set, the receiver application ID defaults to the one set in the Manifest-provided Cast options if provided, or the one set in DefaultCastOptionsProvider otherwise.

getRemoteToLocalEnabled

public @Nullable Boolean getRemoteToLocalEnabled()

Returns whether to enable the remote to local feature, or null if not set.

If not set, the "remote to local enabled" config defaults to the one set in the Manifest-provided Cast options if provided, or the one set in DefaultCastOptionsProvider otherwise.

getShowSystemOutputSwitcherOnCastButtonClick

public @Nullable Boolean getShowSystemOutputSwitcherOnCastButtonClick()

Returns whether to show system output switcher when clicking on the cast button, or null if not set.

This configuration is ignored on devices running API level 36 or older, and the cast button always launches the in-app device picker. On devices running API level 37 or newer, the value set by the application is respected, but the default value (the value used when the application doesn't call setShowSystemOutputSwitcherOnCastButtonClick) depends on the target SDK, and on the way the app configures Cast options:

  • For applications using Manifest-provided Cast options (as opposed to calling initialize), the default value is false.
  • For applications using initialize whose target SDK is 36 or older, the default value is false.
  • For applications using initialize whose target SDK is 37 or newer, the default value is true.