react-usevideostate
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

react-hooks react-usevideostate

react-usevideostate 初始化 video 属性以及事件绑定

Installation

# with NPM
npm install react-usevideostate --save-dev

# with Yarn
yarn add react-usevideostate

Usage

import useVideoState from "react-usevideostate";

const Example = () => {
  const videoRef = useRef(null);
  const videoState = useVideoState(videoRef);
  useEffect(() => {
    console.log(videoState);
  }, [videoState]);

  return (
    <div>
      <video
        width="500"
        height="400"
        controls
        ref={videoRef}
        src="https://download.blender.org/durian/trailer/sintel_trailer-720p.mp4"
      ></video>
    </div>
  );
};

Package Sidebar

Install

npm i react-usevideostate

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

30.1 kB

Total Files

10

Last publish

Collaborators

  • murrayee