videojs-hotkeys
Advanced tools
Comparing version 0.2.17 to 0.2.18
@@ -1,3 +0,3 @@ | ||
/* videojs-hotkeys v0.2.17 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.17"};var c=function(c){function d(a){return 32===a.which||179===a.which}function e(a){return 37===a.which||177===a.which}function f(a){return 39===a.which||176===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys,E=c.enableModifiersForNumbers;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),l.style.outline="none",!D&&k.autoplay()||k.one("play",function(){l.focus()}),k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var F=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(I(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:e(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b);break;case q:e(),k.currentTime(k.currentTime()+x);break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&d<59||d>95&&d<106)&&(E||!(a.metaKey||a.ctrlKey||a.altKey))&&B){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c,a))}}}},G=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;b!=l&&b!=l.querySelector(".vjs-tech")&&b!=l.querySelector(".iframeblocker")||A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},H=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):d==-1&&k.volume(k.volume()-w)}}},I=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",F),k.on("dblclick",G),k.on("mousewheel",H),k.on("DOMMouseScroll",H),this};b.plugin("hotkeys",c)}); | ||
/* videojs-hotkeys v0.2.18 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.18"};var c=function(c){function d(a){return 32===a.which||179===a.which}function e(a){return 37===a.which||177===a.which}function f(a){return 39===a.which||176===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,enableInactiveFocus:!0,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys,E=c.enableModifiersForNumbers,F=c.enableInactiveFocus;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),l.style.outline="none",!D&&k.autoplay()||k.one("play",function(){l.focus()}),F&&k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var G=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(J(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:var g=!k.paused();e(),g&&k.pause(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b),g&&k.play();break;case q:var g=!k.paused();e(),g&&k.pause(),k.currentTime(k.currentTime()+x),g&&k.play();break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&d<59||d>95&&d<106)&&(E||!(a.metaKey||a.ctrlKey||a.altKey))&&B){var h=48;d>95&&(h=96);var i=d-h;e(),k.currentTime(k.duration()*i*.1)}for(var j in c.customKeys){var n=c.customKeys[j];n&&n.key&&n.handler&&n.key(a)&&(e(),n.handler(k,c,a))}}}},H=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;b!=l&&b!=l.querySelector(".vjs-tech")&&b!=l.querySelector(".iframeblocker")||A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},I=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):d==-1&&k.volume(k.volume()-w)}}},J=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",G),k.on("dblclick",H),k.on("mousewheel",I),k.on("DOMMouseScroll",I),this};b.plugin("hotkeys",c)}); | ||
//# sourceMappingURL=videojs.hotkeys.min.js.map |
{ | ||
"name": "videojs-hotkeys", | ||
"version": "0.2.17", | ||
"version": "0.2.18", | ||
"description": "Adds more hotkey support to video.js", | ||
@@ -5,0 +5,0 @@ "main": "videojs.hotkeys.min.js", |
@@ -82,2 +82,3 @@ videojs-hotkeys | ||
The **Enter**/**Return** key may be used instead to activate the control elements (default: `false`) | ||
- `enableInactiveFocus` (boolean): This reassigns focus to the player when the control bar fades out after a user has clicked a button on the control bar (default: `true`) | ||
- `enableJogStyle` (boolean): Enables seeking the video in a broadcast-style jog by pressing the Up and Down Arrow keys. | ||
@@ -84,0 +85,0 @@ `seekStep` will also need to be changed to get a proper broadcast-style jog. |
@@ -20,3 +20,3 @@ /* | ||
"use strict"; | ||
window['videojs_hotkeys'] = { version: "0.2.17" }; | ||
window['videojs_hotkeys'] = { version: "0.2.18" }; | ||
@@ -37,2 +37,3 @@ var hotkeys = function(options) { | ||
enableModifiersForNumbers: true, | ||
enableInactiveFocus: true, | ||
playPauseKey: playPauseKey, | ||
@@ -68,3 +69,4 @@ rewindKey: rewindKey, | ||
alwaysCaptureHotkeys = options.alwaysCaptureHotkeys, | ||
enableModifiersForNumbers = options.enableModifiersForNumbers; | ||
enableModifiersForNumbers = options.enableModifiersForNumbers, | ||
enableInactiveFocus = options.enableInactiveFocus; | ||
@@ -85,16 +87,18 @@ // Set default player tabindex to handle keydown and doubleclick events | ||
player.on('userinactive', function() { | ||
// When the control bar fades, re-apply focus to the player if last focus was a control button | ||
var cancelFocusingPlayer = function() { | ||
clearTimeout(focusingPlayerTimeout); | ||
}; | ||
var focusingPlayerTimeout = setTimeout(function() { | ||
player.off('useractive', cancelFocusingPlayer); | ||
if (doc.activeElement.parentElement == pEl.querySelector('.vjs-control-bar')) { | ||
pEl.focus(); | ||
} | ||
}, 10); | ||
if (enableInactiveFocus) { | ||
player.on('userinactive', function() { | ||
// When the control bar fades, re-apply focus to the player if last focus was a control button | ||
var cancelFocusingPlayer = function() { | ||
clearTimeout(focusingPlayerTimeout); | ||
}; | ||
var focusingPlayerTimeout = setTimeout(function() { | ||
player.off('useractive', cancelFocusingPlayer); | ||
if (doc.activeElement.parentElement == pEl.querySelector('.vjs-control-bar')) { | ||
pEl.focus(); | ||
} | ||
}, 10); | ||
player.one('useractive', cancelFocusingPlayer); | ||
}); | ||
player.one('useractive', cancelFocusingPlayer); | ||
}); | ||
} | ||
@@ -142,3 +146,7 @@ player.on('play', function() { | ||
case cRewind: // Seek Backward | ||
var wasPlaying = !player.paused(); | ||
ePreventDefault(); | ||
if (wasPlaying) { | ||
player.pause(); | ||
} | ||
curTime = player.currentTime() - seekStep; | ||
@@ -151,6 +159,16 @@ // The flash player tech will allow you to seek into negative | ||
player.currentTime(curTime); | ||
if (wasPlaying) { | ||
player.play(); | ||
} | ||
break; | ||
case cForward: // Seek Forward | ||
var wasPlaying = !player.paused(); | ||
ePreventDefault(); | ||
if (wasPlaying) { | ||
player.pause(); | ||
} | ||
player.currentTime(player.currentTime() + seekStep); | ||
if (wasPlaying) { | ||
player.play(); | ||
} | ||
break; | ||
@@ -157,0 +175,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* videojs-hotkeys v0.2.17 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.17"};var c=function(c){function d(a){return 32===a.which||179===a.which}function e(a){return 37===a.which||177===a.which}function f(a){return 39===a.which||176===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys,E=c.enableModifiersForNumbers;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),l.style.outline="none",!D&&k.autoplay()||k.one("play",function(){l.focus()}),k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var F=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(I(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:e(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b);break;case q:e(),k.currentTime(k.currentTime()+x);break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&d<59||d>95&&d<106)&&(E||!(a.metaKey||a.ctrlKey||a.altKey))&&B){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c,a))}}}},G=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;b!=l&&b!=l.querySelector(".vjs-tech")&&b!=l.querySelector(".iframeblocker")||A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},H=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):d==-1&&k.volume(k.volume()-w)}}},I=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",F),k.on("dblclick",G),k.on("mousewheel",H),k.on("DOMMouseScroll",H),this};b.plugin("hotkeys",c)}); | ||
/* videojs-hotkeys v0.2.18 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.18"};var c=function(c){function d(a){return 32===a.which||179===a.which}function e(a){return 37===a.which||177===a.which}function f(a){return 39===a.which||176===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,enableInactiveFocus:!0,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys,E=c.enableModifiersForNumbers,F=c.enableInactiveFocus;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),l.style.outline="none",!D&&k.autoplay()||k.one("play",function(){l.focus()}),F&&k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var G=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(J(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:var g=!k.paused();e(),g&&k.pause(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b),g&&k.play();break;case q:var g=!k.paused();e(),g&&k.pause(),k.currentTime(k.currentTime()+x),g&&k.play();break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&d<59||d>95&&d<106)&&(E||!(a.metaKey||a.ctrlKey||a.altKey))&&B){var h=48;d>95&&(h=96);var i=d-h;e(),k.currentTime(k.duration()*i*.1)}for(var j in c.customKeys){var n=c.customKeys[j];n&&n.key&&n.handler&&n.key(a)&&(e(),n.handler(k,c,a))}}}},H=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;b!=l&&b!=l.querySelector(".vjs-tech")&&b!=l.querySelector(".iframeblocker")||A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},I=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):d==-1&&k.volume(k.volume()-w)}}},J=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",G),k.on("dblclick",H),k.on("mousewheel",I),k.on("DOMMouseScroll",I),this};b.plugin("hotkeys",c)}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47086
479
152