Add touchStart/touchEnd event handlers for video
This commit is contained in:
parent
d68ebdef79
commit
9f1320a907
@ -32,6 +32,7 @@ export default class Video extends React.PureComponent<VideoProps> {
|
|||||||
this.timeout = undefined
|
this.timeout = undefined
|
||||||
}
|
}
|
||||||
handleMouseDown: ReactEventHandler<HTMLVideoElement> = e => {
|
handleMouseDown: ReactEventHandler<HTMLVideoElement> = e => {
|
||||||
|
clearTimeout(this.timeout)
|
||||||
this.timeout = window.setTimeout(this.toggleCover, 300)
|
this.timeout = window.setTimeout(this.toggleCover, 300)
|
||||||
}
|
}
|
||||||
handleMouseUp: ReactEventHandler<HTMLVideoElement> = e => {
|
handleMouseUp: ReactEventHandler<HTMLVideoElement> = e => {
|
||||||
@ -71,7 +72,9 @@ export default class Video extends React.PureComponent<VideoProps> {
|
|||||||
autoPlay
|
autoPlay
|
||||||
onClick={this.handleClick}
|
onClick={this.handleClick}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
|
onTouchStart={this.handleMouseDown}
|
||||||
onMouseUp={this.handleMouseUp}
|
onMouseUp={this.handleMouseUp}
|
||||||
|
onTouchEnd={this.handleMouseUp}
|
||||||
onLoadedMetadata={() => this.props.play()}
|
onLoadedMetadata={() => this.props.play()}
|
||||||
playsInline
|
playsInline
|
||||||
ref={this.videoRef}
|
ref={this.videoRef}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user