You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
I have React application that uses videoJS to play the videos. I want to override the click event. On clicking on the video, it should perform an action (eg: console log) before the video gets played.
Here is how the video component is constructed
importReactfrom'react';importVideoPlayerfrom'../Player/VideoPlayer'constVideoDetail=({video})=>{//Check if video object is validif(!video){return<div>Loading...</div>return(<divclassName="video-detail col-md-8"><
divclassName="details"><divclassName="video-app-title">{video.title}</div><div>{video.description}</div></div><VideoPlayer{...{autoPlay: true,controls: true,poster: video.poster,fileName : video.fileName,sources: [{src: video.source,</div></div>exportdefaultVideoDetail;VideoJSisconstructedasshownbelowimportReact,{Component}from'react';//React module is imported.exportdefaultclassVideoPlayerextendsComponent{componentDidMount(){this.player=videojs(this.videoNode,this.props,functiononPlayerReady(){document.getElementById('vjs_video_3_html5_api').onclick=function(){console.log('clicked');});reportAndPlay(){console.log('called');componentWillUnmount(){if(this.player){this.player.dispose();render(){return(<videoclassName="video-js vjs-default-skin vjs-big-play-centered"height="360"ref={(c)=>{this.videoNode=c;}}width="640"/>
It is not working as expected. Click event triggers only after a click.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Issue actions