Last Comment Bug 674739 - Implement DOM3 KeyboardEvent types for audio
: Implement DOM3 KeyboardEvent types for audio
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: Events (show other bugs)
: Trunk
: All All
: P2 normal (vote)
: mozilla21
Assigned To: Brad Lassey [:blassey] (use needinfo?)
:
Mentors:
Depends on:
Blocks: webapi 834772 839446 762362
  Show dependency treegraph
 
Reported: 2011-07-27 15:34 PDT by Chris Jones [:cjones] inactive; ni?/f?/r? if you need me
Modified: 2013-02-25 12:05 PST (History)
33 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
-


Attachments
patch for volume up/down (1.16 KB, patch)
2013-02-01 08:06 PST, Brad Lassey [:blassey] (use needinfo?)
masayuki: feedback-
Details | Diff | Review
patch for volume keys (1.26 KB, patch)
2013-02-04 12:53 PST, Brad Lassey [:blassey] (use needinfo?)
masayuki: review+
bugs: superreview+
Details | Diff | Review
patch for windows to use volume keys (1.08 KB, patch)
2013-02-04 13:41 PST, Brad Lassey [:blassey] (use needinfo?)
masayuki: review+
Details | Diff | Review
patch for android to use volume keys (2.73 KB, text/plain)
2013-02-04 15:29 PST, Brad Lassey [:blassey] (use needinfo?)
nchen: review+
Details

Description Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2011-07-27 15:34:19 PDT
As far as I can tell, these aren't delivered uniformly through DOM key events.  The use case is, if I have headphones plugged into my computer that's playing, say, HTML5 http://www.rdio.com/, I want to be able to use my headphone's controls pad to play/pause/etc. rdio playback.

I may have overlooked existing standards for this, if so sorry.

I think there may be two parts to this
 (1) Add keycodes or whatever for media keys
 (2) Add a new "focus context" for audio playback, so that rdio can grab "media focus" even if it's in a background tab, and keep listening to media-key presses.  Can do the latter in a separate bug.
Comment 1 Paul Rouget [:paul] 2011-08-01 03:25:42 PDT
DOM3 includes such keycodes:
http://www.w3.org/TR/DOM-Level-3-Events/#key-values-list
Comment 2 Justin Lebar (not reading bugmail) 2012-06-06 21:26:11 PDT
> (2) Add a new "focus context" for audio playback, so that rdio can grab "media focus" even if it's 
> in a background tab, and keep listening to media-key presses.

Maybe I'm weird, I don't want random pages to grab my "media focus".  That would break my ability to control my desktop media player, if I happened to have rdio open.  Or, I happen to be listening to Pandora, but I want to change my system speaker volume.

I agree it'd be useful under some circumstances, but I'm wary of letting a random webpage register a system-global keyboard shortcut.

Let's deal with this separately.  We really need these keycodes for b2g; we're using pageup/pagedown, which is causing all sorts of silly confusion.
Comment 3 Dietrich Ayala (:dietrich) 2012-07-03 13:40:44 PDT
Required for B2G. We can't overload pageup/down for this in production.
Comment 4 Andreas Gal :gal 2012-08-08 15:18:10 PDT
Its not clear to me that this would keep us from shipping v1. Renom if you disagree.
Comment 5 Justin Lebar (not reading bugmail) 2012-08-08 15:40:58 PDT
We don't need this because we have an alternative resolution to bug 762362.
Comment 6 Brad Lassey [:blassey] (use needinfo?) 2013-02-01 08:06:33 PST
Created attachment 709059 [details] [diff] [review]
patch for volume up/down

Just want to make sure I'm on the right track with this.
Comment 7 Masayuki Nakano [:masayuki] (Mozilla Japan) 2013-02-01 18:04:00 PST
Comment on attachment 709059 [details] [diff] [review]
patch for volume up/down

Although, I still don't like to add new keycode...

Basically, 0xAE and 0xAF are the best value for them.
http://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx

However, they have been already assigned to DOM_VK_OPEN_CURLY_BRACKET and DOM_VK_CLOSE_CURLY_BRACKET, unfortunately. Although, AFAIK, the is no keyboard driver/utility using these virtual keycode. So, I guess that IE never fires key events with these keycodes actually.

0xE2 is VK_OEM_102. Probably, we will never use this code because in our new rules, we cannot keep compatibility with IE for such keycodes (printable keys in standard position except [0-9a-z]). So, 0xE2 should be safe.

However, 0xE3 isn't so. It's an OEM specific keycode. See bug 833719. If we will decide we define all OEM specific keycodes for compatibility with IE (rather than a11y on non-Windows platforms), 0xE3 will be used.

Please use 0xB6 and 0xB7. AFAIK, no keyboard driver/utility uses these virtual keycodes. So, we must never use them in the future.

And please map 0xAE and 0xAF to the new DOM keycodes on Windows too in a separated patch. Change here:
http://mxr.mozilla.org/mozilla-central/source/widget/windows/KeyboardLayout.cpp#1080
Comment 8 Brad Lassey [:blassey] (use needinfo?) 2013-02-04 12:53:31 PST
Created attachment 709847 [details] [diff] [review]
patch for volume keys
Comment 9 Brad Lassey [:blassey] (use needinfo?) 2013-02-04 13:41:58 PST
Created attachment 709871 [details] [diff] [review]
patch for windows to use volume keys
Comment 10 Brad Lassey [:blassey] (use needinfo?) 2013-02-04 15:29:04 PST
Created attachment 709936 [details]
patch for android to use volume keys
Comment 11 Masayuki Nakano [:masayuki] (Mozilla Japan) 2013-02-04 23:09:04 PST
Comment on attachment 709847 [details] [diff] [review]
patch for volume keys

0xB8 is reserved. So, in the future, it might become an important virtual keycode and we would be in trouble with compatibility with IE. So, don't use 0xB8. Use 0xB5-0xB7.

With that change, r=me. And ask sr to smaug.
Comment 12 Jim Chen [:jchen] [:darchons] 2013-02-05 12:56:11 PST
Comment on attachment 709936 [details]
patch for android to use volume keys


>+        // KEYCODE_AT (77) ... KEYCODE_MEDIA_FAST_FORWARD (90)
>+        case AndroidKeyEvent::KEYCODE_MUTE:            return NS_VK_VOLUME_MUTE;

nit: alignment.

>         case AndroidKeyEvent::KEYCODE_PAGE_UP:            return NS_VK_PAGE_UP;
>         case AndroidKeyEvent::KEYCODE_PAGE_DOWN:          return NS_VK_PAGE_DOWN;
Comment 13 Brad Lassey [:blassey] (use needinfo?) 2013-02-07 06:50:25 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/d91803d01873
https://hg.mozilla.org/integration/mozilla-inbound/rev/27c00bd9cc71
https://hg.mozilla.org/integration/mozilla-inbound/rev/a840d8f3fcb2

cjones, since you're the one that originally filed this bug, do you want to leave this open for more media keys to be implemented or resummarize to cover just volume keys and open a new bug?
Comment 15 Brad Lassey [:blassey] (use needinfo?) 2013-02-08 04:23:51 PST
spun out bug 839446 to handle the media key events. Re-summarizing this bug to reflect what was done.
Comment 16 Masayuki Nakano [:masayuki] (Mozilla Japan) 2013-02-17 23:45:08 PST
https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent#Virtual_key_codes

Note You need to log in before you can comment on or make changes to this bug.