admin管理员组文章数量:1414934
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 example, 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.
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 example, 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.
Share Improve this question asked Jun 13, 2011 at 19:28 Tri NoensieTri Noensie 8269 silver badges24 bronze badges2 Answers
Reset to default 8Doing 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./event.preventDefault/
本文标签: javascriptDisable keyboard events in firefox for HTML5 Videos using JSStack Overflow
版权声明:本文标题:javascript - Disable keyboard events in firefox for HTML5 Videos using JS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745158531a2645320.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论