FSAI Design System
Components

VideoPlayer

Custom video player with play controls, progress, volume, fullscreen, and optional keyboard shortcuts.

Overview

VideoPlayer is the shared-ui video playback component for embedded video content.

It wraps react-player with a custom control surface instead of relying on the browser's default video controls.

Basic Usage

import { VideoPlayer } from "@fsai/shared-ui";

<VideoPlayer src={videoUrl} />;

Props

PropTypeDefaultDescription
srcstringRequired video source URL.
onVideoProgress(secondsPlayed: number, totalDuration: number) => voidCalled during playback progress updates.
withKeyboardShortcutsbooleantrueEnables keyboard shortcuts when the player is focused.
controlledbooleantrueShows the custom controls and uses controlled-style playback behavior.
classNamestringAdditional root classes.
fitToSourceAspectRatiobooleanfalseSizes the player to the video's actual aspect ratio when metadata is available.
maxRenderedHeightstringOptional max height used with fitToSourceAspectRatio.

Behavior

When controlled is enabled, the player includes:

  • play and pause controls
  • seek bar
  • volume and mute controls
  • fullscreen toggle
  • time display
  • keyboard shortcuts

Supported keyboard shortcuts:

  • Space or K to play or pause
  • Left Arrow and Right Arrow to seek
  • M to mute
  • F to toggle fullscreen

When controlled={false}, the custom control bar is removed and the player behaves more like an ambient or looping media surface.

Usage

Representative usages:

PatternPathNotes
Asset file viewerfsai/packages/shared-ui/src/modules/assets/components/UnifiedFileViewer/UnifiedFileViewer.tsxUses VideoPlayer for fullscreen playback of uploaded video assets.
Learning course playbackfsai/packages/shared-ui/src/modules/learning/components/VideoPlayer.tsxWraps the shared player with progress tracking and completion logic.
Applicant portal step videofsai/packages/shared-ui/src/modules/applicantPortal/components/PortalVideoStep/PortalVideoStep.tsxUses progress callbacks plus aspect-ratio fitting for guided portal steps.

Guidelines

  • Do use VideoPlayer when you want a consistent in-app video playback experience
  • Do use onVideoProgress if the screen needs playback progress for analytics or completion tracking
  • Do use fitToSourceAspectRatio when vertical or non-16:9 video should preserve its natural shape
  • Don't treat this as a generic iframe wrapper for arbitrary embeds without validating the source first

On this page