Installation

To add ReactPlayer to your project, you can use either npm or yarn.

npm

npm install react-player

Yarn

yarn add react-player

Peer Dependencies

ReactPlayer has react and react-dom as peer dependencies. You must have these installed in your project to use this library.

From package.json:

"peerDependencies": {
  "@types/react": "^17.0.0 || ^18 || ^19",
  "react": "^17.0.2 || ^18 || ^19",
  "react-dom": "^17.0.2 || ^18 || ^19"
}

Ensure that your project's React versions are compatible with these ranges.

Dependencies

ReactPlayer relies on a set of external player packages to handle different media types. These are regular dependencies and will be installed automatically with react-player.

  • @mux/mux-player-react
  • cloudflare-video-element
  • dash-video-element
  • hls-video-element
  • spotify-audio-element
  • tiktok-video-element
  • twitch-video-element
  • vimeo-video-element
  • wistia-video-element
  • youtube-video-element

These packages are lazy-loaded based on the src URL you provide, which helps keep your initial bundle size small.

Next Steps

Once installed, you can start using the player in your application. See the Quick Start guide for a basic implementation.