Skip to content

Commit

Permalink
Correcting NativeControls + Taps.
Browse files Browse the repository at this point in the history
Skipping browser bugfix for changing cursor as that stops tap events
from propergating to native controls. Also enabled option that disables
converting events to 'tap'. The 'tap' event does not cause native
controls to appear on devices like android.
  • Loading branch information
darrennolan committed Dec 18, 2016
1 parent a7ffa34 commit afa7421
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,10 @@ class Component {

let couldBeTap;

if (this.options_.disableEmitTapEvents) {
return;
}

this.on('touchstart', function(event) {
// If more than one finger, don't consider treating this as a click
if (event.touches.length === 1) {
Expand Down
13 changes: 9 additions & 4 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ class Player extends Component {
const techOptions = assign({
source,
'nativeControlsForTouch': this.options_.nativeControlsForTouch,
'disableEmitTapEvents': this.options_.disableEmitTapEvents,
'playerId': this.id(),
'techId': `${this.id()}_${techName}_api`,
'videoTracks': this.videoTracks_,
Expand Down Expand Up @@ -2897,10 +2898,14 @@ class Player extends Component {
// When this gets resolved in ALL browsers it can be removed
// https://code.google.com/p/chromium/issues/detail?id=103041
if (this.tech_) {
this.tech_.one('mousemove', function(e) {
e.stopPropagation();
e.preventDefault();
});
// But make sure we're not touch enabled and trying to use native controls.
// This will stop native controls from appearing on androids as we stop events
if (!(browser.TOUCH_ENABLED && this.options_.nativeControlsForTouch)) {
this.tech_.one('mousemove', function(e) {
e.stopPropagation();
e.preventDefault();
});
}
}

this.removeClass('vjs-user-active');
Expand Down

0 comments on commit afa7421

Please sign in to comment.