diff --git a/src/js/exports.js b/src/js/exports.js index 8a75e4cd3d..5fd8dfecfe 100644 --- a/src/js/exports.js +++ b/src/js/exports.js @@ -30,6 +30,7 @@ goog.exportSymbol('_V_', vjs); goog.exportSymbol('videojs.options', vjs.options); goog.exportSymbol('videojs.players', vjs.players); +goog.exportSymbol('videojs.TOUCH_ENABLED', vjs.TOUCH_ENABLED); // Allow external components to use global cache goog.exportSymbol('videojs.cache', vjs.cache); diff --git a/src/js/lib.js b/src/js/lib.js index ce9e897f0e..cca76e48fd 100644 --- a/src/js/lib.js +++ b/src/js/lib.js @@ -348,7 +348,7 @@ vjs.IS_OLD_ANDROID = vjs.IS_ANDROID && (/webkit/i).test(vjs.USER_AGENT) && vjs.A vjs.IS_FIREFOX = (/Firefox/i).test(vjs.USER_AGENT); vjs.IS_CHROME = (/Chrome/i).test(vjs.USER_AGENT); -vjs.TOUCH_ENABLED = ('ontouchstart' in window); +vjs.TOUCH_ENABLED = !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch); /** * Get an element's attribute values, as defined on the HTML tag diff --git a/test/unit/api.js b/test/unit/api.js index 4910cfa2c8..fae7fae0bc 100644 --- a/test/unit/api.js +++ b/test/unit/api.js @@ -44,6 +44,7 @@ test('should export ready api call to public', function() { }); test('should export useful components to the public', function () { + ok(videojs.TOUCH_ENABLED, 'Touch detection should be public'); ok(videojs.ControlBar, 'ControlBar should be public'); ok(videojs.Button, 'Button should be public'); ok(videojs.PlayToggle, 'PlayToggle should be public');