react-player

A single React component that plays video and audio from YouTube, Vimeo, Wistia, Mux, Twitch, TikTok, Spotify, HLS, DASH, and local files.

Library
npm
v3.4.0
10,276stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity0
Maintenance20
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture82
Code Quality78
Innovation80
Learning Curve70

ReactPlayer is a React component that renders a unified player for a wide range of media sources — YouTube, Vimeo, Wistia, Mux, Twitch, TikTok, Spotify, HLS and DASH streams, and native file URLs — behind a single consistent API. Instead of hand-rolling separate embeds and SDK integrations for every provider, developers pass a src URL and ReactPlayer detects the source and swaps in the matching player automatically.

Version 3 rebuilt the library around a family of custom-element packages (hls-video-element, youtube-video-element, vimeo-video-element, and similar), each lazily loaded via React.lazy so unused providers never ship in the main bundle. The project is now co-maintained with Mux, the video infrastructure company, which has taken over ongoing maintenance and release cadence.

What You Get

  • A single <ReactPlayer src=”…” /> component that auto-detects and plays YouTube, Vimeo, Wistia, Mux, Twitch, TikTok, Spotify, HLS, DASH, and native file URLs
  • Lazy-loaded, per-provider code splitting via React.lazy so only the player you actually use ships to the browser
  • A consistent callback API (onReady, onStart, onPlay, onProgress, onDurationChange, onEnded, onError, etc.) that normalizes events across every provider
  • Light mode that renders a lazy-loaded thumbnail preview and defers loading the real player until the user clicks
  • Support for picture-in-picture, custom players via addCustomPlayer, and native <source>/<track> children for multi-source and subtitle tracks

Common Use Cases

  • Embedding a single video or audio player in a marketing site without writing separate integration code for every provider a client might paste in
  • Building a media dashboard or CMS preview pane that must play arbitrary user-submitted URLs from YouTube, Vimeo, or direct file links
  • Wiring ReactPlayer into Media Chrome for a fully custom-branded set of playback controls
  • Deferring player and SDK downloads behind a click-to-play thumbnail on content-heavy pages to improve initial load time

Under The Hood

Architecture ReactPlayer is built around a small factory function, createReactPlayer, that takes an ordered list of PlayerEntry objects (players.ts) plus a fallback and returns the public ReactPlayer component. Each entry pairs a canPlay(url) matcher (patterns.ts, mostly regexes tested against src) with a lazily imported provider component; when ReactPlayer.tsx mounts, getActivePlayer walks the list — including any players registered via addCustomPlayer — and hands the first match to Player.tsx, which forwards refs, filters out ReactPlayer-only event handlers, and normalizes playback state (play/pause, volume, playbackRate, picture-in-picture) onto whichever underlying element was selected. Because every provider shares the same PlayerEntry shape, adding a new source is a matter of writing one canPlay matcher and one lazy import, and the light-mode preview and Suspense fallback both live at the ReactPlayer.tsx level rather than being duplicated per provider.

Tech Stack The library is authored in strict TypeScript (tsconfig.json enables strict) with React as a peer dependency across several major versions, and it deliberately outsources per-provider playback to a family of custom-element packages — hls-video-element, dash-video-element, youtube-video-element, vimeo-video-element, wistia-video-element, twitch-video-element, tiktok-video-element, spotify-audio-element, and a Mux player package — each pulled in as a real dependency and loaded through React.lazy so unused providers are code-split out of the main bundle. Builds run through an in-repo esbuild-based builder script rather than a general-purpose bundler, tests run via a custom tester harness on top of a lightweight assertion library and spies, with coverage tooling layered on top, and a fast linter/formatter handles style; CI workflows run these checks on every push.

Code Quality Tests live under test/ and exercise both the public ReactPlayer surface (static methods, instance methods, and prop handling) and the lower-level Player component in isolation, using assertions and stubs rather than a mainstream framework like Jest or Vitest. Error handling favors silent no-ops for browser API edge cases — for example, picture-in-picture requests are wrapped in empty try/catch blocks — which keeps playback from throwing but also means such failures aren’t surfaced to consumers. Naming is consistent (PlayerEntry, canPlay, activePlayer) and CI enforces linting and the test suite on every push, though the codebase carries comparatively light inline documentation, relying instead on the README and a dedicated migration guide for usage guidance.

API Design ReactPlayer’s most distinctive choice is delegating actual playback to standards-based custom elements rather than hand-rolled iframe/SDK wrappers — the same underlying elements can be used directly outside React, which is why ReactPlayer pairs naturally with Media Chrome for fully custom controls. The public API stays minimal: a single src prop plus a flat set of HTMLMediaElement-shaped props and callbacks (onReady, onProgress, onEnded, etc.), and extensibility is opt-in via addCustomPlayer rather than requiring users to fork the library to add a provider. This lowers boilerplate for the common case of one component and one src while still giving power users a documented extension point.

Used by 8 apps in this directory

TypeScript
68%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,825

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript68%
Java21%
Updated 3 days ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

51,521

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
Python
63%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,539

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
90
Repo Health
82
Technical
63
Dependency
Built with
Python63%
TypeScript31%
Updated 2 days ago
TypeScript
99%
AGPL 3.0

fountain-ink

Blogging

64

A self-hostable, decentralized blogging platform built on Lens Protocol — own your content, audience, and distribution forever.

View details
26
Repo Health
66
Technical
66
Dependency
Built with
TypeScript99%
Updated 7 months ago
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,299

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
100%
Apache 2.0

ILLA Builder

Developer Tools · Low Code Platforms · No Code Platforms

12,312

Open-source low-code platform for building internal tools with drag-and-drop UI, reactive data bindings, and real-time collaboration.

View details
57
Repo Health
71
Technical
63
Dependency
Built with
TypeScript100%
Updated 3 months ago
Python
64%
Other

Keep

Devops · Automation · Monitoring

12,290

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
91
Repo Health
79
Technical
66
Dependency
Built with
Python64%
TypeScript36%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search