I want to call a function on single click and double click on an video element in react.But when i double click the element it also calling the single click function
I want the solution of the problem
Here is the video element
<video
id={`post${index}`}
width="640"
height="360"
// controls
// onDoubleClick={() =>
// setdoublefunction(item.post_id, index)
// }
onDoubleClick={(event)=>{
handleDoubleClick (event,index)
}}
className="post__media_video"
alt="Post Content"
style={{
objectFit: "contain",
background: "black",
}}
onClick={(event) => {
videoFunction(event,index)
}}
>
<source src={item.image} type="video/mp4" />
<source src={item.image} type="video/webm" />
Your browser does not support the video tag.
</video>
You can add this mechanism to your code to handle a single click. There is no default handler to prevent a single click in this scenario, according to my knowledge.