Video-react-hooks represents video events in the form of React hooks. By encapsulating the video event logic in hooks. These hooks can then be easily used across the application in components that are affected by the video events. This approach not only simplifies the code but also makes it more readable and maintainable.
Each hook built on the concept of React hooks, and each hook is based on a specific video event. These hooks are executed when the corresponding event occurs during video playback. Under the hood video-react-hooks also used React hooks.
Simple usage
import { useReadyEffect, usePlayingEffect, usePauseEffect } from 'video-react-hooks';
export const VideoComponent = () => {
useReadyEffect(() => {
//executed when video is ready
}, []);
usePlayingEffect(() => {
//executed when video is playing
}, []);
usePauseEffect(() => {
//executed when video is paused
}, []);
return (//jsx);
}
Top comments (0)