javascript - Disable keyboard events in firefox for HTML5 Videos using JS - Stack Overflow

I'm creating keyboard shortcuts for HTML5 videos using javascript. It works in Chrome and safari,

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 badges
Add a ment  | 

2 Answers 2

Reset to default 8

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./event.preventDefault/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745158532a4614269.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信