1.0.0 • Published 5 years ago
usevideostate v1.0.0
react-hooks usevideostate
usevideostate 初始化 video 属性以及事件绑定
Installation
# with NPM
npm install rusevideostate --save-dev
# with Yarn
yarn add usevideostate
Usage
import useVideoState from "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>
);
};
1.0.0
5 years ago