google-cast
Options for the Google Cast extension that configures the receiver and load request
Adds the Google Cast extension to the player’s media. It renders nothing — place it inside the player as a sibling of the media element, and pair it with a CastButton. See Cast to AirPlay and Chromecast for the complete setup.
Import
pnpm add @videojs/react @videojs/google-castpnpm add @videojs/html @videojs/google-castimport { GoogleCast } from '@videojs/react/extensions/google-cast';import '@videojs/html/extensions/google-cast';Or load it from the CDN:
<script type="module" src="https://cdn.jsdelivr.net/npm/@videojs/cdn@10.0.0-beta.32/extensions/google-cast.js"></script>Anatomy
<GoogleCast /><google-cast></google-cast>Options
| Prop | Type | Description |
|---|---|---|
receiver |
string |
Cast receiver application ID. Defaults to Google’s Default Media Receiver (CC1AD845) |
src |
string |
Source URL loaded on the receiver. Defaults to the source the browser is playing |
contentType |
string |
MIME type of the Cast source. When unset, the receiver infers it from the URL |
streamType |
'on-demand' | 'live' |
Stream type reported to the receiver. Falls back to the player’s stream type |
customData |
object |
Custom data sent to the receiver with each load request |
| Attribute | Property | Description |
|---|---|---|
receiver |
receiver |
Cast receiver application ID. Defaults to Google’s Default Media Receiver (CC1AD845) |
src |
src |
Source URL loaded on the receiver. Defaults to the source the browser is playing |
content-type |
contentType |
MIME type of the Cast source. When unset, the receiver infers it from the URL |
stream-type |
streamType |
Stream type reported to the receiver. Falls back to the player’s stream type |
| — | customData |
Custom data sent to the receiver with each load request |
customData takes an object, so it’s a property only, with no matching attribute.
When the Cast src is an HLS playlist, Video.js detects the segment format and sets the receiver’s hlsSegmentFormat and hlsVideoSegmentFormat load-request fields. The Default Media Receiver plays HLS natively, so no extra receiver setup is needed.