About this project

ReactPlayer is a React component for embedding media playback from a wide range of sources using a single interface. It accepts a media URL and automatically loads the appropriate markup or external SDK needed to play it. Supported sources include standard HTML5 video and audio file paths, HLS streams via hls.js, DASH streams via dash.js, Mux videos via the mux-player element, YouTube via the YouTube iFrame Player API, Vimeo via the Vimeo Player API, and Wistia via the Wistia Player API. The component exposes a rich set of props for controlling playback, such as src, playing, loop, controls, volume, muted, playbackRate, width, height, preload, playsInline, crossOrigin, disableRemotePlayback, and picture-in-picture support where available. It also provides callback props for common player events, including onReady, onStart, onPlay, onPlaying, onProgress, onTimeUpdate, onDurationChange, onPause, onWaiting, onSeeking, onSeeked, onRateChange, onEnded, onError, and picture-in-picture enter/leave events. A config prop allows source-specific settings for YouTube, Vimeo, and HLS. ReactPlayer includes static helpers such as canPlay to test whether a URL is likely playable, as well as addCustomPlayer and removeCustomPlayers for registering custom player implementations. Instance methods accessed through a ref aim to be compatible with the HTMLMediaElement interface. For performance, the component supports lazy loading of player chunks when the build system supports dynamic imports, reducing the main bundle size by loading only the player needed for a given source. Additional features include a light mode that shows a thumbnail first and loads the full player only after user interaction, support for custom thumbnails, responsive sizing through width, height, and aspect-ratio styles, and compatibility with custom control UIs such as Media Chrome. Since version 3, ReactPlayer also supports multiple source and track children in a way similar to native HTML video and audio elements, enabling alternate formats and subtitle tracks. The README notes that version 3 is a major architectural update and is not backwards compatible with version 2, and that maintenance is now handled by Mux while remaining open source.