ReactAllPlayer
GitHub

Select a source type to see how the player handles different formats

View From A Blue Moon © Brainfarm

ReactAllPlayer

Simple React component that provides versatile and good looking UI video player.

HLS SupportDASH SupportAccessibleCustomizableResponsive

Installation

pnpm install react-all-player

Quick Usage

demo.tsx
import ReactAllPlayer from 'react-all-player'
  
<ReactAllPlayer
  sources={[
    {
      file: 'https://ezy.ovh/sample-1080.mp4',
      label: '1080p'
    },
    {
      file: 'https://ezy.ovh/sample-720.mp4',
      label: '720p'
    }
  ]}
  subtitles={[
    {
      lang: 'en',
      language: 'English',
      file: 'https://ezy.ovh/english-vtt',
    }
  ]}
    poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jp"
/>

Key Features

  • 🎛 Rich API - toggle playback, volume, seeking, and more
  • 💪 Accessible - full support for VTT captions and screen readers
  • 📹 Streaming - support for hls.js and dash.js streaming playback
  • 🔎 Fullscreen - native support with fallback to "full window"
  • 🖥 Picture-in-Picture - supports PiP mode
  • 📖 Multiple captions - support for multiple caption tracks
  • 🔧 Customizable - make the player look how you want with the markup you want
  • ⌨️ Shortcuts - supports keyboard shortcuts
  • 🖼️ Preview thumbnails - support for displaying preview thumbnails on hover

Available Props

PropTypeDescriptionDefaultRequired
sourcesSource[]An array of sources contain file, label and typenulltrue
subtitlesSubtitle[]An array of subtitles contain file, lang and languagenullfalse
hlsRefReact.MutableRefObject<Hls | null>hls.js instance refReact.createRef()false
dashRefReact.MutableRefObject<DashJS.MediaPlayerClass | null>dashjs instance refReact.createRef()false
hlsConfigHls['config']hls.js configfalse
changeSourceUrl(currentSourceUrl: string, source: Source) => stringA function that modify given source url (hls only)() => nullfalse
onHlsInit(hls: Hls) => voidA function that called after hls.js initialization() => nullfalse
onDashInit(dash: DashJS.MediaPlayerClass) => voidA function that called after dashjs initialization() => nullfalse
onInit(videoEl: HTMLVideoElement) => voidA function that called after video initialization() => nullfalse
refReact.MutableRefObject<HTMLVideoElement | null>video element refnullfalse
i18nI18nTranslationsDefault Translationsfalse
hotkeysHotkey[]Hotkeys (shortcuts)Default Hotkeysfalse
componentsComponent[]Customization componentsDefault componentsfalse
thumbnailstringThumbnails on progress bar hovernullfalse
posterstringVideo poster image on loadnullfalse