All Projects → jimmycallin → react-hook-videojs

jimmycallin / react-hook-videojs

Licence: MIT license
Easy React integration of Video.js using hooks.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-hook-videojs

usehooks-ts
React hook library, ready to use, written in Typescript.
Stars: ✭ 2,873 (+7664.86%)
Mutual labels:  hook, react-hooks
useAudioPlayer
Custom React hook & context for controlling browser audio
Stars: ✭ 176 (+375.68%)
Mutual labels:  hook, react-hooks
react-ui-hooks
🧩Simple repository of React hooks for building UI components
Stars: ✭ 20 (-45.95%)
Mutual labels:  hook, react-hooks
ReSift
A state management library for data fetches in React
Stars: ✭ 39 (+5.41%)
Mutual labels:  hook, react-hooks
Fre
👻 Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+8535.14%)
Mutual labels:  hook, react-hooks
react-use-hotkeys
React hook for creating simple keyboard shortcuts
Stars: ✭ 74 (+100%)
Mutual labels:  hook, react-hooks
react-hook-layout
Layouts in React.
Stars: ✭ 16 (-56.76%)
Mutual labels:  hook, react-hooks
formalizer
React hooks based form validation made for humans.
Stars: ✭ 12 (-67.57%)
Mutual labels:  hook, react-hooks
use-dencrypt-effect
⚛ A custom React hook generating crypting text effect.
Stars: ✭ 39 (+5.41%)
Mutual labels:  hook, react-hooks
window-scroll-position
React hook for Window scroll position
Stars: ✭ 81 (+118.92%)
Mutual labels:  hook, react-hooks
react-use-countdown
React hook for countdown state.
Stars: ✭ 19 (-48.65%)
Mutual labels:  hook, react-hooks
use-route-as-state
Use React Router route and query string as component state
Stars: ✭ 37 (+0%)
Mutual labels:  hook, react-hooks
web
React hooks done right, for browser and SSR.
Stars: ✭ 940 (+2440.54%)
Mutual labels:  hook, react-hooks
KeyBoardTool
Keyboard key detection software realized by Qt(Qt实现的键盘按键检测软件)
Stars: ✭ 35 (-5.41%)
Mutual labels:  hook
veact
Mutable state enhancer library for React based on @vuejs
Stars: ✭ 62 (+67.57%)
Mutual labels:  react-hooks
objects-hooks-remover
Package to remove WordPress hook callbacks that uses object methods or closures.
Stars: ✭ 44 (+18.92%)
Mutual labels:  hook
shaka-player-react
A simple React component wrapper for shaka-player
Stars: ✭ 79 (+113.51%)
Mutual labels:  react-hooks
react-cloud-music-typescript
基于React和Typescript搭建的cloud music项目
Stars: ✭ 14 (-62.16%)
Mutual labels:  react-hooks
react-live2d
在react项目里展示live2d看板娘:react-live2d
Stars: ✭ 52 (+40.54%)
Mutual labels:  react-hooks
re-use
⚛️ 🎣 A collection of hooks for ReasonReact
Stars: ✭ 27 (-27.03%)
Mutual labels:  react-hooks

react-hook-videojs

A simple react hook to easily integrate video.js with React. Supports React 18 Strict Mode.

NPM

react-hook-videojs

Due to how video.js mutates the DOM, integrating video.js with React can be a quite tricky. Especially if you want to support video.js component updates and correctly dispose of any old player.

React Hooks helps us package this quite nicely, and all you have to do to use this package is:

import React from "react";
import "video.js/dist/video-js.css";
import { useVideoJS } from "react-hook-videojs";

const App = () => {
  const videoUrl = "http://techslides.com/demos/sample-videos/small.mp4";
  const className = "my-class";
  const { Video, player, ready } = useVideoJS(
    { sources: [{ src: videoUrl }] },
    className // optional
  );
  if (ready) {
    // Do something with the video.js player object.
  }
  return (
    <div className="App">
      <Video />
    </div>
  );
};

useVideoJS takes an options argument, and passes it without modifications to video.js. You may also provide an optional second string argument that will be appended as class name on the video DOM node.

See their options reference for further information on the options argument.

Using with Tracks or other child components

This hook supports using features such as tracks, and other child components of the <video> element.

Example of using a text track:

const App = () => {
  // ...setup code from above

  return (
    <Video>
      <track
        kind="captions"
        src="//example.com/path/to/captions.vtt"
        srcLang="en"
        label="English"
        default
      />
    </Video>
  );
};

Support for all <video> element attributes

This hook supports all attributes for the native <video> element directly on the <Video> component.

const App = () => {
  return <Video muted autopictureinpicture />;
};
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].