Video-React Player

0.16.0 · active · verified Sun Apr 19

Video-React is an open-source web video player library constructed using the React JavaScript library, specifically designed for modern HTML5 video environments. It provides a comprehensive suite of React components for building customizable video player interfaces, handling core functionalities such as playback control, volume management, progress indication, and full-screen toggling. The current stable version, 0.16.0, supports a broad range of React versions up to 18.0.0. While not following a strict time-based release cadence, the project actively maintains the library, with recent updates ensuring compatibility with newer React versions and addressing bugs. Its primary differentiators are its React-centric architecture, allowing for seamless integration into React applications, and its visually appealing default styling, which is heavily inspired by the well-known video.js project. Users must manually install `react` and `react-dom` as peer dependencies.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up a basic Video-React player with common controls and a video source, including the essential CSS import.

import React from 'react';
import { Player, ControlBar, PlayToggle, VolumeMenuButton, BigPlayButton, Source } from 'video-react';
import 'video-react/dist/video-react.css'; // Don't forget to import the CSS

const VideoPlayer = () => {
  return (
    <div style={{ width: '80%', margin: '20px auto' }}>
      <Player
        playsInline
        poster="https://video-react.github.io/assets/poster.png"
        src="https://media.w3.org/2010/05/sintel/trailer_hd.mp4"
      >
        <BigPlayButton position="center" />
        <ControlBar autoHide={false} disableDefaultControls={false}>
          <PlayToggle />
          <VolumeMenuButton />
          {/* Add other control bar components as needed */}
        </ControlBar>
        {/* You can also specify sources as children, for multiple formats */}
        {/* <Source src="https://media.w3.org/2010/05/sintel/trailer_hd.mp4" type="video/mp4" /> */}
        {/* <Source src="https://media.w3.org/2010/05/sintel/trailer_hd.webm" type="video/webm" /> */}
      </Player>
    </div>
  );
};

export default VideoPlayer;

view raw JSON →