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
|
* @private
|
||||||
*/
|
*/
|
||||||
handleTechClick_(event) {
|
handleTechClick_(event) {
|
||||||
// We're using mousedown to detect clicks thanks to Flash, but mousedown
|
if (!Dom.isSingleLeftClick(event)) {
|
||||||
// will also be triggered with right-clicks, so we need to prevent that
|
|
||||||
if (event.button !== 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When controls are disabled a click should not toggle playback because
|
// When controls are disabled a click should not toggle playback because
|
||||||
// the click is considered a control
|
// the click is considered a control
|
||||||
if (this.controls()) {
|
if (!this.controls_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.paused()) {
|
if (this.paused()) {
|
||||||
this.play();
|
this.play();
|
||||||
} else {
|
} else {
|
||||||
this.pause();
|
this.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a tap on the media element. It will toggle the user
|
* Handle a tap on the media element. It will toggle the user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user