Disable keyboard events in firefox for HTML5 Videos using JS
I'm creating keyboard shortcuts for HTML5 videos using javascript. It works in Chrome and safari, but it doesn't quite work in Firefox because it has native keyboard controls. For exam开发者_Go百科ple, I'm using the front/back arrow keys to scroll within the video using a user-defined skip-step; FF already has the same function, but with a predefined skip-step.
Much thanks in advance.
Doing this worked for me using the audio tag, I'm not sure if it will work with full-screen video playback though
mediaElement.addEventListener('focus',function(){this.blur();},false);
Be sure to attach your keyboard controls to the body or window element
This works by keeping focus off the element so it will not receive keyboard events
Possible event.preventDefault
http://api.jquery.com/event.preventDefault/
精彩评论