Video
The Video component provides multiple video playback options depending on the requirements and source type.
Supported variants:
| Variant | Description |
|---|---|
custom | Inline video with custom playback controls |
big-button | Inline video with a large overlay play button |
native | Opens a native HTML5 video player inside a dialog |
youtube | Opens a YouTube player inside a dialog |
Features include:
- Accessible playback controls
- Optional transcript support
- Optional audio description links
- Fullscreen/lightbox viewing
- Native HTML5 and YouTube playback support
Installation
Required dependencies
npm install react-playerInline Videos
Props
| Prop | Type | Function | Required |
|---|---|---|---|
variant | 'custom' | 'big-button' | Defines which layout the video player will have | ✓ |
src | string | the source of the video to be played | ✓ |
transcript | string | If passed, the transcript control will be visible | ✗ |
autoplay | boolean | Dictates if the video should start automatically | ✗ |
audioDescription | string | A link to the audio description for the video. If it is passed, the audio description button will appear within the controls | ✗ |
Custom Video
The custom variant renders an inline HTML5 video element with branded controls.
<Video
variant="custom"
src="/videos/example.mp4"
transcript="This is an example transcript."
audioDescription="/audio-description"
/>Big Button Video
The big-button variant provides the same functionality as the custom player while adding a large centered overlay play button.
<Video
variant="big-button"
src="/videos/example.mp4"
transcript={data.transcript}
audioDescription="/audio-description"
/>Overlay Behaviour
When paused:
- The large play button is visible.
When playing:
- The overlay fades out.
- The overlay becomes visible again when the video container is hovered.
- Clicking the overlay toggles playback.
Lightbox-only videos
Native Video
The native variant renders a trigger button that opens a native browser video player inside a dialog.
<Video
variant="native"
src="/videos/example.mp4"
transcript="This is an example transcript."
audioDescription="/audio-description-url"
/>Selecting the trigger opens the browser's native video controls inside the fullscreen dialog.
YouTube Video
The youtube variant renders a trigger button and loads a YouTube player using react-player.
<Video
variant="youtube"
youtubeId="dQw4w9WgXcQ"
/>Internally the component creates:
const url = `https://www.youtube.com/watch?v=${youtubeId}`;and renders it using ReactPlayer.
Accessibility
The component includes:
- ARIA labels on all control buttons.
- Keyboard-accessible interactions through
react-aria-components. - Accessible transcript controls.
- Support for external audio description resources.
- Semantic button and link elements throughout.