CastOptions

  • CastOptions provides configuration parameters for initializing the CastContext.

  • An instance of CastOptions is created using the CastOptions.Builder.

  • CastOptions includes methods to retrieve various configuration settings like CastMediaOptions, launch options, receiver application ID, and supported namespaces.

  • There are also options to control session behavior, such as enabling a reconnection service, resuming saved sessions, and stopping the receiver application.

public classCastOptions extendsObject
implementsParcelable

Configuration parameters for initializing theCastContext. TheCastOptions.Builder is used to create an instance ofCastOptions, and so contains the corresponding setter methods.

Nested Class Summary

class CastOptions.BuilderA builder to create an instance of CastOptions which is used to initialize theCastContext

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Public Method Summary

CastMediaOptions
getCastMediaOptions()
Returns the CastMediaOptions that is used to configure a media session.
boolean
getEnableReconnectionService()
Returnstrue if ReconnectionService should be enabled when needed to better handle session recovery.
LaunchOptions
String
getReceiverApplicationId()
Returns the cast receiver application ID.
boolean
getResumeSavedSession()
Returnstrue if the saved session should be resumed if it was dropped unexpectedly.
boolean
getStopReceiverApplicationWhenEndingSession()
Returnstrue if the receiver application should be stopped when the session is ended by the user.
List<String>
getSupportedNamespaces()
Returns the list of supported cast namespaces.
double
getVolumeDeltaBeforeIceCreamSandwich()
This method is deprecated. Google Play services discontinued updates for Jelly Bean (API levels 16, 17 & 18) since July 2021. This method will be removed in the next release.

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface android.os.Parcelable
abstract int
describeContents()
abstract void
writeToParcel(Parcel arg0, int arg1)

Public Methods

publicCastMediaOptionsgetCastMediaOptions()

Returns theCastMediaOptions that is used to configure a media session.

public booleangetEnableReconnectionService()

Returnstrue ifReconnectionService should be enabled when needed to better handle session recovery.

public LaunchOptionsgetLaunchOptions()

Returns theLaunchOptions.

publicStringgetReceiverApplicationId()

Returns the cast receiver application ID. This ID is used in discovering supported receivers, and launching an application when starting a new session.

public booleangetResumeSavedSession()

Returnstrue if the saved session should be resumed if it was dropped unexpectedly. Returnsfalse if the saved session should not be resumed in this case.

public booleangetStopReceiverApplicationWhenEndingSession()

Returnstrue if the receiver application should be stopped when the session is ended by the user. Returnsfalse if the receiver application should not be stopped in this case.

publicList<String>getSupportedNamespaces()

Returns the list of supported cast namespaces.

public doublegetVolumeDeltaBeforeIceCreamSandwich()

This method is deprecated.
Google Play services discontinued updates for Jelly Bean (API levels 16, 17 & 18) since July 2021. This method will be removed in the next release.

Returns the amount of receiver device volume to increase or decrease when the physical volume key is pressed on an Android device older than ICE CREAM SANDWICH. The SDK will call this method to obtain the volume delta when CastContext.onDispatchVolumeKeyEventBeforeJellyBean(KeyEvent) is called. The return value is not used on Android devices running ICE CREAM SANDWICH or newer.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.