Chromecast ********** Chromecast support is implemented as a plugin that must be installed and enabled separately. This plugin doesn't implement the Chromecast sender API itself. Instead, it contains utility classes for serializing and deserializing "PlayerConfiguration" (https://players.castlabs.com/react-native/1.4.2/docs/sdk-api/interfaces/PlayerConfiguration/) when communicating with the Chromecast receiver. For a comprehensive solution, we recommend using the react-native-google-cast (https://github.com/react-native-google-cast/react-native-google-cast) library. It provides the full Chromecast sender API, giving you complete flexibility for adding Chromecast support. Setup ===== First, install the "@castlabs/react-native-prestoplay-chromecast" package: npm install @castlabs/react-native-prestoplay-chromecast Next install (https://react-native-google-cast.github.io/docs/getting-started/installation) and set up (https://react-native-google-cast.github.io/docs/getting-started/setup) the "react-native-google-cast" library in the project. Start casting ============= Convert an instance of "PlayerConfiguration" (https://players.castlabs.com/react-native/1.4.2/docs/sdk-api/interfaces/PlayerConfiguration/) to the MediaLoadRequest (https://react-native-google-cast.github.io/docs/api/interfaces/medialoadrequest) type and then load it on the receiver using the remote media client (https://react-native-google-cast.github.io/docs/api/classes/remotemediaclient). You can adjust a newly created MediaLoadRequest (https://react-native-google-cast.github.io/docs/api/interfaces/medialoadrequest) , by adding additional metadata or other custom data. For example: //... import { ChromecastSerializer } from "@castlabs/react-native-prestoplay-chromecast"; import { useRemoteMediaClient } from "react-native-google-cast"; const mediaLoadRequest = ChromecastSerializer.toMediaLoadRequest(playerConfiguration); // Add your custom data to the `mediaLoadRequest.mediaInfo.customData` object const castMediaClient = useRemoteMediaClient(); await castMediaClient.getClient().loadMedia(mediaLoadRequest); //... Alternatively, a "Player" (https://players.castlabs.com/react-native/1.4.2/docs/sdk-api/classes/Player/) instance can be converted to the MediaLoadRequest (https://react-native-google-cast.github.io/docs/api/interfaces/medialoadrequest) type. In this case, the MediaLoadRequest will maintain the lastest player state, such as the current position and selected audio track. For example: import { ChromecastSerializer } from "@castlabs/react-native-prestoplay-chromecast"; import { useRemoteMediaClient } from "react-native-google-cast"; //... const mediaLoadRequest = ChromecastSerializer.toMediaLoadRequest(player); const castMediaClient = useRemoteMediaClient(); await castMediaClient.getClient().loadMedia(mediaLoadRequest); //... Resume playback =============== Once the Chromecast session is stopped, playback can be resumed on the device. The resumed playback will maintain the latest receiver state, such as the current position and selected audio track. For example: import { ChromecastDeserializer } from "@castlabs/react-native-prestoplay-chromecast"; import { useMediaStatus } from "react-native-google-cast"; //... const castMediaStatus = useMediaStatus(); const playerConfiguration = ChromecastDeserializer.toPlayerConfiguration(castMediaStatus); player.open(playerConfiguration); //... Note: A complete example of Chromecast integration is available as source code in the example app on the Castlabs Download Portal (https://downloads.castlabs.com/browse/packages/prestoplay-rn/)