# 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](../../guides/casting.md)

## Import

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

The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/presets.md) 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`](./player-controller.md) 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);
}
```