# Go fullscreen and lock orientation

Present the player fullscreen with custom controls intact, and lock screen orientation on mobile.

> **Note**
>
> Using a pre-built [skin](https://videojs.org/docs/framework/react/guides/skins)? It already includes the controls shown here. You may still need the media or player setup in this guide. The component examples are for building your own player UI from individual [components](https://videojs.org/docs/framework/react/guides/ui-components).

## Recommended approach

Add a [FullscreenButton](https://videojs.org/docs/framework/react/reference/components/fullscreen-button) inside the player container. When element fullscreen is supported, it presents the whole container, including controls, captions, and overlays. On iPhone Safari, it uses the native video presentation instead.

**App.tsx**

```tsx
import { Container, createPlayer, FullscreenButton } from '@videojs/react';
import { Video, videoFeatures } from '@videojs/react/video';

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

export default function BasicUsage() {
  return (
    <Player>
      <Container className="media-container">
        <Video src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4" autoPlay muted playsInline loop />
        <FullscreenButton
          className="media-fullscreen-button"
          render={(props, state) => <button {...props}>{state.fullscreen ? 'Exit Fullscreen' : 'Fullscreen'}</button>}
        />
      </Container>
    </Player>
  );
}
```

**App.css**

```css
.media-container {
  position: relative;
}

.media-container video {
  width: 100%;
}

.media-fullscreen-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding-block: 8px;
  padding-inline: 20px;
  color: black;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 9999px;
  backdrop-filter: blur(10px);
}
```

## How it works

The [fullscreen feature](https://videojs.org/docs/framework/react/reference/api/feature-fullscreen) tracks fullscreen state and provides the actions:

- `isFullscreen` is `true` while the player is fullscreen, from any path — your button, native controls, or the platform presentation.
- `fullscreenAvailability` is `'available'`, `'unavailable'`, or `'unsupported'`. It starts as `'unavailable'`, then settles to `'available'` or `'unsupported'` when the feature attaches to a media component.
- `requestFullscreen()` and `exitFullscreen()` change the presentation. When the Fullscreen API is available, requests target the player container. Otherwise they fall back to the media element’s native presentation.

Fullscreen and picture-in-picture are exclusive: requesting fullscreen exits an active picture-in-picture presentation first.

Style fullscreen state through the container’s `:fullscreen` pseudo-class, the button’s `data-fullscreen` attribute, or `isFullscreen` in player state.

The built-in button hides when `fullscreenAvailability` is not `'available'`. Use the same check for custom controls and handle rejected requests. When the attached media has no supported fullscreen method, the action resolves without changing the presentation.

## Availability and constraints

- Fullscreen requests must come from a user gesture; browsers reject requests outside one.
- iPhone Safari has no element Fullscreen API. The player falls back to the video’s native fullscreen presentation, which shows the system player UI instead of your custom controls. iPads support element fullscreen.
- Orientation locking requires the Screen Orientation API with lock support — in practice, Android browsers in fullscreen. iOS doesn’t support programmatic orientation lock.
- Inside iframes, fullscreen needs `allow="fullscreen"` on the embedding iframe.

## Common variations

### Lock orientation while fullscreen

Add `orientationLockFeature` to lock screen orientation while the player is fullscreen. It isn’t part of `videoFeatures`, so the preset `VideoPlayer` doesn’t include it. It locks to `landscape` by default and unlocks on exit.

The preset has a fixed feature list, so build the player yourself with [`createPlayer`](https://videojs.org/docs/framework/react/reference/api/create-player):

```tsx
import { Container, createPlayer, FullscreenButton, orientationLockFeature } from '@videojs/react';
import { Video, videoFeatures } from '@videojs/react/video';

const { Player } = createPlayer({
  features: [...videoFeatures, orientationLockFeature],
});

export default function App() {
  return (
    <Player>
      <Container>
        <Video src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4" muted playsInline />
        <FullscreenButton>Fullscreen</FullscreenButton>
      </Container>
    </Player>
  );
}
```

To lock to something other than `landscape`, set `orientationLockType` on the player. See the [orientation lock feature](https://videojs.org/docs/framework/react/reference/api/feature-orientation-lock) reference for details.

### Double-click to toggle

Use the `Gesture` component — the packaged skins ship this exact binding. Keep the button as the accessible path; gestures are a pointer-only shortcut.

```tsx
import { Gesture } from '@videojs/react';

<Gesture type="doubletap" action="toggleFullscreen" region="center" />
```

With left, center, and right double-tap bindings for the same pointer type, `region="center"` covers the middle third, as in the on-demand video skins. A center-only double-tap binding covers the whole surface. See [Add keyboard shortcuts and gestures](https://videojs.org/docs/framework/react/guides/keyboard-shortcuts) for region behavior.

## Troubleshooting

### The fullscreen button doesn’t render

The button hides while `fullscreenAvailability` is `'unavailable'` or `'unsupported'`. Wait for media attachment, check browser support, and confirm that an embedding iframe permits fullscreen with `allow="fullscreen"`.

### The fullscreen request is rejected

Call the action directly from a click handler and check that an embedding iframe permits fullscreen with `allow="fullscreen"`. Handle the returned promise’s rejection. To detect unsupported fullscreen, check `fullscreenAvailability`; an unsupported request can resolve without entering fullscreen.

### Custom controls disappear in fullscreen on iPhone

Expected: iPhone Safari uses the native video presentation, which replaces custom UI with system controls. Design mobile controls assuming this fallback.

### Orientation doesn’t lock

Orientation lock works in fullscreen on Android browsers; iOS doesn’t support it. Confirm `orientationLockFeature` is in your feature list.

## Related pages

### Components

- [FullscreenButton](https://videojs.org/docs/framework/react/reference/components/fullscreen-button): Accessible fullscreen toggle button with keyboard support and state reflection
- [Container](https://videojs.org/docs/framework/react/reference/components/player-container): The player's visual and interaction surface for layout, fullscreen, focus, and user activity.

### API

- [Fullscreen](https://videojs.org/docs/framework/react/reference/api/feature-fullscreen): Fullscreen state and actions for the player store
- [Orientation lock](https://videojs.org/docs/framework/react/reference/api/feature-orientation-lock): Screen orientation locking while fullscreen is active

### Guides

- [Use picture-in-picture](https://videojs.org/docs/framework/react/guides/picture-in-picture): Pop the video into a floating window, with availability detection and state that tracks every entry path.

---

React documentation: https://videojs.org/docs/framework/react/llms.txt
All documentation: https://videojs.org/llms.txt
