# Remote Playback

Remote playback state and actions for the player store

Controls remote playback to devices like Chromecast (Chromium) and AirPlay (Safari). Exits fullscreen before initiating a remote playback session.

- [Cast to AirPlay and Chromecast](https://videojs.org/docs/framework/html/guides/casting)

## Import

```ts
import { remotePlaybackFeature } from '@videojs/html';
```

The `liveVideoFeatures` and `videoFeatures` [feature bundles](https://videojs.org/docs/framework/html/guides/presets) include this feature.

## API Reference

### State

| Property | Type | Description |
| --- | --- | --- |
| `remotePlaybackState` | `'disconnected' \| 'connecting' \| 'connected'` | Current remote playback connection state. |
| `remotePlaybackAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | Whether remote playback can be requested on this platform. |

### Actions

| Action | Type | Description |
| --- | --- | --- |
| `toggleRemotePlayback` | `() => Promise<void>` | Toggle the remote playback connection. |

### Selector

Pass `selectRemotePlayback` to [`PlayerController`](https://videojs.org/docs/framework/html/reference/api/player-controller) to subscribe to remote playback state. Returns `undefined` if the remote playback feature is not configured.

**cast-button.ts**

```ts
import { createPlayer, UIElement, selectRemotePlayback } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';

const { PlayerController } = createPlayer({ features: videoFeatures });

class CastButton extends UIElement {
  readonly #remotePlayback = new PlayerController(this, selectRemotePlayback);
}
```

---

HTML documentation: https://videojs.org/docs/framework/html/llms.txt
All documentation: https://videojs.org/llms.txt
