1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-03 15:12:49 +02:00

initial support for toggling controlbar via touch

This commit is contained in:
Gary Katsevman 2013-03-07 17:32:47 -05:00
parent 95e87be2d2
commit 57c5cefe0f

22
src/js/controls.js vendored
View File

@ -29,9 +29,31 @@ vjs.ControlBar = function(player, options){
goog.base(this, player, options);
player.one('play', vjs.bind(this, function(){
var touchstart;
this.fadeIn();
this.player_.on('mouseover', vjs.bind(this, this.fadeIn));
this.player_.on('mouseout', vjs.bind(this, this.fadeOut));
touchstart = false;
this.player_.on('touchstart', function() {
touchstart = true;
});
this.player_.on('touchmove', function() {
touchstart = false;
});
this.player_.on('touchend', vjs.bind(this, function() {
var idx;
if (touchstart) {
idx = this.el().className.search('fade-in');
if (idx !== -1) {
this.fadeOut();
} else {
this.fadeIn();
}
}
touchstart = false;
}));
}));
};
goog.inherits(vjs.ControlBar, vjs.Component);