mirror of
https://github.com/videojs/video.js.git
synced 2025-01-27 11:22:06 +02:00
fix: being able to toggle playback with middle click (#4756)
Uses the new Dom.isSingleLeftClick method to do the check we were doing previously. Also, refactor the player.handleTechClick_() method to follow the new style of code. Fixes #4689
This commit is contained in:
parent
1fcd5ae4b1
commit
7a776eeeea
@ -1430,22 +1430,22 @@ class Player extends Component {
|
||||
* @private
|
||||
*/
|
||||
handleTechClick_(event) {
|
||||
// We're using mousedown to detect clicks thanks to Flash, but mousedown
|
||||
// will also be triggered with right-clicks, so we need to prevent that
|
||||
if (event.button !== 0) {
|
||||
if (!Dom.isSingleLeftClick(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// When controls are disabled a click should not toggle playback because
|
||||
// the click is considered a control
|
||||
if (this.controls()) {
|
||||
if (!this.controls_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.paused()) {
|
||||
this.play();
|
||||
} else {
|
||||
this.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a tap on the media element. It will toggle the user
|
||||
|
Loading…
x
Reference in New Issue
Block a user