# Fullscreen

Fullscreen state and actions for the player store

Controls fullscreen mode. Tries the container element first, falls back to the media element.

## Import

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

The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/presets.md) include this feature.

## API Reference

### State

| Property | Type | Description |
| --- | --- | --- |
| `fullscreen` | `boolean` | Whether fullscreen mode is currently active. |
| `fullscreenAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | Whether fullscreen can be requested on this platform. |

### Actions

| Action | Type | Description |
| --- | --- | --- |
| `requestFullscreen` | `() => Promise<void>` | Enter fullscreen mode. Tries container first, falls back to media element. |
| `exitFullscreen` | `() => Promise<void>` | Exit fullscreen mode. |
| `toggleFullscreen` | `() => Promise<void>` | Toggle fullscreen mode. |

### Selector

Pass `selectFullscreen` to [`PlayerController`](./player-controller.md) to subscribe to fullscreen state. Returns `undefined` if the fullscreen feature is not configured.

**fullscreen-button.ts**

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

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

class FullscreenButton extends UIElement {
  readonly #fullscreen = new PlayerController(this, selectFullscreen);
}
```

### Screen orientation

Add [`features.orientationLock`](./feature-orientation-lock.md) to lock screen orientation while fullscreen is active. Unsupported browsers and rejected lock requests are ignored, so iOS Safari continues to use its normal fullscreen behavior.

The feature locks to `landscape` unless the provider sets another Screen Orientation API type.

```html
<my-player orientation-lock-type="portrait">
  <video src="/video.mp4"></video>
</my-player>
```

See [Orientation lock](./feature-orientation-lock.md) for the player setup.