How can I determine whether a user has stopped or started a video?

Long ago, I created a project where people could post and watch videos. I’m currently working on an algorithm or logic to recognize when a user starts or stops a video using Video-React. Can you please assist me with this?

Hi Komal!
You can use the event callbacks a player fires for each of the events.
Also, you can maintain a state variable in the component and store the state of the player in that state variable.
For react-player one of the most popular video players in react a small code snippet explaining these callbacks is as follows
<ReactPlayer url={playbackURI}
autoPlay={true}
controls={true}
width=“400”
onStart={() => {
sendData(‘played’, playbackID, 0, playbackURI);
}}
onPlay={() => {
console.log(“Update the state variable here”)
}}
onPause={() => {
console.log(“Update the state variable here”)
}}
/>I hope this may solve your query.

Thanks