Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Keyboard shortcuts


It would be useful if there was support for keyboard shortcuts. E.g. spacebar to play/pause, something to enter/exit fullscreen etc.

25 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

There are plugins for this.

http://www.longtailvideo.com/addons/plugins/58/QuickKeys?q=
http://www.longtailvideo.com/addons/plugins/95/Interacter?q=

JW Player

User  
0 rated :

QuickKeys does not appear to work with version 5+. Is there a way to do this with version 5? I am able to bind keypresses in the DOM to JW actions, but if JW has focus this doesn't work.

Has this just been removed in version 5?

Ethan Feldman

JW Player Support Agent  
0 rated :

This plugin is not compatible with V5, but you can use the Backstroke Plugin, which works in 5.0 and 5.1 (not 5.2). Here is the link to it – http://www.longtailvideo.com/addons/plugins/149/Backstroke

JW Player

User  
0 rated :

Working great, somehow I missed that. Thanks!

Ethan Feldman

JW Player Support Agent  
0 rated :

Np!

JW Player

User  
0 rated :

So, I have a decent setup now in Firefox and Safari, using jQuery's keypress() function to catch the spacebar and pass a PLAY event to JW Player. This works well. When the user clicks the JW Player, keypresses pass to JW instead of Javascript, and the Backstroke plugin interprets them, so that also works. Solved.

No, on to Chrome. Chrome works slightly differently. When the user clicks the JW Player, Chrome passes subsequent keystrokes to JW, but it also processes them in Javascript, so JW receives two PLAY events which cancel each other out. This is not good. I can detect Chrome and remove the Backstroke plugin, which works except that Chrome does NOT pass keypresses to Javascript when the plugin is fullscreen.

Any idea how to solve this? Its sad that browsers all implement this differently.

Ethan Feldman

JW Player Support Agent  
0 rated :

Hi Mark,

Can you provide a link to where you are running this?

Thanks,
-Ethan

JW Player

User  
0 rated :

This is also apparently the behavior in IE8. It double-passes keystrokes to both Javascript and JW once the player has been clicked, but not in fullscreen mode.

I wonder if there is a way to prevent Flash from receiving keystrokes in the event that Javascript is getting them, or vice-versa.

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you provide a link?

JW Player

User  
0 rated :

http://mark.antsclimbtree.com/jwplayer-test/

Works in Safari and Firefox (Mac), exhibits issues in Chrome and IE8.

Ethan Feldman

JW Player Support Agent  
0 rated :

I know the issue. Backstroke is a 3rd party plugin, and it is not compatible with 5.2, it only works in 5.0 and 5.1. You are using 5.2 here, which is why it is not working correctly.

JW Player

User  
0 rated :

Aha, so is the issue that Backstroke should be not listening to keystrokes unless the browser is ignoring them, but in Chrome and IE it is? I'm just trying to figure out if there is a work-around.

Ethan Feldman

JW Player Support Agent  
0 rated :

No, the issue is that you are using a player version which is not fully compatible with this plugin. Try using 5.1 instead.

JW Player

User  
0 rated :

I downgraded the player.swf to 5.1.910 and the issue is still there:

http://mark.antsclimbtree.com/jwplayer-test/

Ethan Feldman

JW Player Support Agent  
0 rated :

It looks like there is a conflict between jQuery’s keypress() function and the Backstroke plugin, in Chrome/IE. I haven’t used jQuery’s keypress() function before. Could remove the event for the spacebar so it doesn’t register twice? That is the only workaround that I can think of, as the plugin by itself does not do this, it only does this in your specific scenario.

JW Player

User  
0 rated :

That's the whole point, the keypress() is there because, when the JW Player object is not focused keyboard controls do not work. The user has to first click the JW object before Backstroke is even in the picture. This is true regardless of jQuery or javascript:

http://mark.antsclimbtree.com/jwplayer-test/index2.php

The idea is to add a javascript key binding to allow the user to hit space or other controls without having to first click the plugin. Backstroke is only there because browsers do not allow javascript access to the keyboard when Flash is focused, and something has to take over in that case. Unfortunately, IE and Chrome allow both to access the keyboard, resulting in this problem.

If I could detect Flash object focus in javascript, that would solve it, but I don't see a way to do that.

Ethan Feldman

JW Player Support Agent  
0 rated :

This is a Flash issue in general, not a JW Player specific issue.

For example, go to any YouTube Video – http://www.youtube.com/watch?v=R8NSQmPoyeE&feature=popular

Hit the spacebar, it will actually scroll down the page.

Click on the Flash Player. Now press Space. It will now play/pause the video.

It is a Flash issue in General, you have to click on the Flash Item first before you can do any keyboard commands on it. Every Flash game has this same issue.

JW Player

User  
0 rated :

Right, I get that, so what I need to do is figure out how to make Javascript aware of when Flash has the focus, so it can avoid processing keyboard input. I can't believe there's not some way to do this.

Ethan Feldman

JW Player Support Agent  
0 rated :

I don’t know of a way to do this, sorry. If anyone else knows, please do post!

JW Player

User  
0 rated :

Thanks for the links, Zach. I need other parts of the page to work on focus, though, so I need to be able to route keypresses to Flash even if it isn't receiving focus in certain cases. If I can detect whether Flash has focus in Javascript, I can solve this problem. I'm sure there must be ways to detect this in browsers, but I haven't figured it out yet.

JW Player

User  
0 rated :

Hope this blackstone plugin gets updated... Seeing how flash loves to steal keyboard focus anyways :p

JW Player

User  
0 rated :

*backstroke -- its late

Ethan Feldman

JW Player Support Agent  
0 rated :

@Kevin – backstroke was created by a 3rd party developer. It is up to them to update it. We have indeed contacted them about the issues.

JW Player

User  
0 rated :

Is there a way to force focus away from Flash regardless? For what I am building, I'd rather have the user interact with custom built jquery components and events rather than the built-in controls of JW Player.

Kai

Ethan Feldman

JW Player Support Agent  
0 rated :

@Kai – Not that I know of, sorry.

This question has received the maximum number of answers.