mirror of
https://github.com/videojs/video.js.git
synced 2025-01-19 10:54:16 +02:00
use tap events. Report activity on touch move.
This commit is contained in:
parent
44d6cac1b7
commit
4d2267c1bc
@ -61,9 +61,6 @@ vjs.MediaTechController.prototype.initControlsListeners = function(){
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.addControlsListeners = function(){
|
||||
var userWasActive,
|
||||
touchmove = false;
|
||||
|
||||
// Some browsers (Chrome & IE) don't trigger a click on a flash swf, but do
|
||||
// trigger mousedown/up.
|
||||
// http://stackoverflow.com/questions/1444562/javascript-onclick-event-over-flash-object
|
||||
@ -84,29 +81,18 @@ vjs.MediaTechController.prototype.addControlsListeners = function(){
|
||||
this.on('touchstart', function(event) {
|
||||
// Stop the mouse events from also happening
|
||||
event.preventDefault();
|
||||
userWasActive = this.player().userActive();
|
||||
touchmove = false;
|
||||
});
|
||||
|
||||
this.on('touchmove', function(event) {
|
||||
touchmove = true;
|
||||
})
|
||||
|
||||
this.on('touchend', function(event) {
|
||||
if (userWasActive) {
|
||||
this.player().reportUserActivity();
|
||||
}
|
||||
if (!touchmove) {
|
||||
this.player().userActive(!this.player().userActive());
|
||||
}
|
||||
this.player().reportUserActivity();
|
||||
});
|
||||
|
||||
// Turn on component tap events
|
||||
//this.emitTapEvents();
|
||||
this.emitTapEvents();
|
||||
|
||||
// The tap listener needs to come after the touchend listener because the tap
|
||||
// listener cancels out any reportedUserActivity when setting userActive(false)
|
||||
//this.on('tap', this.onTap);
|
||||
this.on('tap', this.onTap);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user