Skip to content

Commit

Permalink
Updated control bar autohide to support touch devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevecochrane committed Jun 6, 2012
1 parent 6a2c0e2 commit 2bf7731
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controls.js
Expand Up @@ -86,8 +86,10 @@ _V_.ControlBar = _V_.Component.extend({
placeholderFadeIn();
// Clear any existing fade out instructions that are waiting to trigger
clearTimeout(fadeOutTimeout);
// If this mouse movement was not over the control bar...
if (!mousedOverControls) {
// If this mouse movement was not over the control bar, and if the current
// device isn't a touch device (since the control bar needs to be shown at all
// times for touch devices, since there is no mouse)...
if (!mousedOverControls && !_V_.isTouchDevice()) {
// Set the control bar to fade out in 1.5 seconds
fadeOutTimeout = setTimeout(function() {
placeholderFadeOut();
Expand Down
1 change: 1 addition & 0 deletions src/lib.js
Expand Up @@ -19,6 +19,7 @@ _V_.extend({
isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
isTouchDevice: function(){ return !!('ontouchstart' in window); },
iOSVersion: function() {
var match = navigator.userAgent.match(/OS (\d+)_/i);
if (match && match[1]) { return match[1]; }
Expand Down

0 comments on commit 2bf7731

Please sign in to comment.