我需要执行各种操作,具体取决于用户是否单击了play
/pause
控件或他是否想要选择视频的特定时刻。ReactJS html5视频 - 如何在点击时捕捉视频的控件
到目前为止,我已经这样做了:
constructor(props) {
super(props);
this.state = {
videoSrc: "static/dt1.mp4",
}
this.testClick = this.testClick.bind(this);
}
testClick(evt) {
console.log("hello");
}
render() {
return (
<video ref={(video1) => { this.video1 = video1; }} onClick={this.testClick} width="100%" height="350"controls>
<source src={this.state.videoUrl} type="video/mp4" />
</video>
);
}
所以,在这里,如果我点击视频本身我已经问候印刷。但是,如果我点击控件,什么都没有发生......
也许我在找它错,但到目前为止我在google上找不到任何东西。
如何知道用户是否点击了播放/暂停或选择了视频的时间范围?我是否需要绝对的图书馆: http://docs.videojs.com/index.html?
Ps:我不想使用任何jQuery。
真棒!所以放心。谢谢! –