Issue 131612 in chromium: Multimedia keys API support

6 views
Skip to first unread message

chro...@googlecode.com

unread,
Jun 7, 2012, 1:41:04 PM6/7/12
to chromi...@chromium.org
Status: Unconfirmed
Owner: ----
Labels: Type-Bug Pri-2 Area-Undefined OS-Windows

New issue 131612 by david.pr...@gmail.com: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

Chrome Version : 21.0.1163.0
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)

It's just an idea of Keyboard API: support multimedia keys (play,
stop, ...) in a global scope, without needly the Chrome been in focus.
It'll be useful to extensions of players, for instance, to go to next
music, without need focus Chrome. If you are playing a game in fullscreen,
for instance, and want to next song, you will need back to chrome and
advance.

I belive that a full support keyboard API can be insecure, because it can
create keyloggers, but only in multimedia keys, I guess that it not will be
a problem.

Keys:
- Play/Pause (KeyCode: 179);
- Stop (KeyCode: 178)
- Previous song (KeyCode: 177);
- Next song (KeyCode: 176);

UserAgentString: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1
(KHTML, like Gecko) Chrome/21.0.1163.0 Safari/537.1



chro...@googlecode.com

unread,
Jun 13, 2012, 7:24:04 AM6/13/12
to chromi...@chromium.org

Comment #2 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

mihaip: I wasn't planning on it for the first cut at least.

chro...@googlecode.com

unread,
Jun 13, 2012, 10:05:07 AM6/13/12
to chromi...@chromium.org

Comment #3 on issue 131612 by david.pr...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Is too complex to accept it on the *first cut*?

chro...@googlecode.com

unread,
Jun 13, 2012, 11:21:22 AM6/13/12
to chromi...@chromium.org

Comment #4 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

No, just plenty of higher priority work left on the feature.

chro...@googlecode.com

unread,
Jun 13, 2012, 11:25:22 AM6/13/12
to chromi...@chromium.org

Comment #5 on issue 131612 by david.pr...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Fine so... But the status will be Available? Or Milestone?

chro...@googlecode.com

unread,
Dec 18, 2012, 8:37:13 AM12/18/12
to chromi...@chromium.org

Comment #6 on issue 131612 by owencmo...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Apologies for a (semi-)bump comment, but I just wanted to bring this up
again since now Spotify has launched a web based client (play.spotify.com),
turning it into a Chrome app with media keys support would be a great demo.

chro...@googlecode.com

unread,
Apr 10, 2013, 1:17:57 AM4/10/13
to chromi...@chromium.org

Comment #12 on issue 131612 by w...@chromium.org: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

This sounds closely related to issue 166928?

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

chro...@googlecode.com

unread,
Jul 23, 2013, 2:46:18 AM7/23/13
to chromi...@chromium.org

Comment #14 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

I want to tackle this issue up and have did some investigation work. My
proposal:

1. argument chrome.commands like

{
"name" : "my extension",
...
"commands": {
"toggle-feature-foo": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
},
"description": "Toggle feature foo"
},
“enable_media_keys”: true ← default: false
},
...
}

2. Built-in commands for media keys: _Media_Next_Track,
_Media_Previous_Track, _Media_Stop, _Media_Play_Pause, _Volume_Mute,
_Volume_Down, _Volume_Up

Then extensions/apps can listen for onCommands to receive the key pressed
event if "enable_media_keys" is true.

Currently I have an experimental implementation on the Windows:
http://crrev.com/19915002. (untested and buggy maybe)
Also a doc that record some problems:
https://docs.google.com/document/d/1t1s7RD3Nh_5TX6r7bwf-_QGkGTNXb3-IoGmDbDsmqsQ/edit?usp=sharing

Please take a look and give me some suggestions and instructions,
especially for my problems. If everything goes smoothly, I hope cl about
this feature can land as soon as I can.

By the way, Google Play Music team needs this feature as I know.

chro...@googlecode.com

unread,
Jul 25, 2013, 7:53:55 PM7/25/13
to chromi...@chromium.org

Comment #15 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Speaking as the person who implemented this in the first place:

Approach 1 seems weird. I don't know why we'd want a flag to activate the
media keys.
Approach 2 seems like the way to go, but I'm not sure we'd need the
underscore notation (other supported keys don't use that). MediaNextTrack
and VolumeDown (etc) would be what I'd expect to see.

Caveat: Haven't looked at the experimental implementation/doc (I am
currently on vacation and slow to respond).

chro...@googlecode.com

unread,
Jul 25, 2013, 11:44:03 PM7/25/13
to chromi...@chromium.org

Comment #16 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Oops, 1 & 2 is two steps of my proposal, not Approach 1, Approach 2.

For "I don't know why we'd want a flag to activate the media keys.", AFAIK,
no all extensions using commands interesting in media keys build-in
command. And I think we should only notify the extensions with true flag
“enable_media_keys".

Thanks for your reply. Have a nice vacation.

chro...@googlecode.com

unread,
Jul 26, 2013, 1:44:43 PM7/26/13
to chromi...@chromium.org

Comment #17 on issue 131612 by de...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

I feel strongly that you should not expose volume or mute keys to apps. If
these keys are typically already handled by the OS, having them
additionally get sent to an app seems undesirable. For example, consider
the following case:

1. System is already muted.
2. User loads app.
3. User hits mute key. System is unmuted but app is now muted.

The Play/Pause, Stop, Previous, and Next keys described in the initial
request seem fine to me, though.

chro...@googlecode.com

unread,
Jul 27, 2013, 9:51:47 AM7/27/13
to chromi...@chromium.org
Updates:
Cc: yus...@chromium.org ma...@chromium.org dan...@chromium.org

Comment #19 on issue 131612 by de...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

(No comment was entered for this change.)

chro...@googlecode.com

unread,
Aug 5, 2013, 8:17:58 AM8/5/13
to chromi...@chromium.org

Comment #22 on issue 131612 by svenreck...@googlemail.com: Multimedia keys
API support
http://code.google.com/p/chromium/issues/detail?id=131612

#14: Why so complicated? Shouldn't it be enough if the user could assign
the multimedia keys in the shortcuts settings? I don't think we need
built-in commands for this (just some new values for "suggested_key").
Also, if more than one extension had the "enable_media_keys" flag set to
true, the user must be able to control which one receives the events (OK,
this could be done with extension options, but not all extensions would
provide such an option).

chro...@googlecode.com

unread,
Aug 5, 2013, 8:28:57 AM8/5/13
to chromi...@chromium.org

Comment #23 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

#22 Wow!! Thanks very much! I have made a stupid choice...

The last question I should make sure here: *does media keys need to have a
special permission*?

Hope I can help to finish it and didn't make trouble. I would like to focus
on this issue in the next two weeks.

chro...@googlecode.com

unread,
Aug 12, 2013, 7:41:30 AM8/12/13
to chromi...@chromium.org

Comment #24 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Back from vacation and catching up on things...
At a glance I agree with derat@17 & @21. I think we should only expose keys
to Extensions and Apps that we are certain won't get processed by the OS
before/after we intercept them. It would be very undesirable to have the
App and the OS handle the same key in different ways as described in
comment 17.

chro...@googlecode.com

unread,
Aug 16, 2013, 11:30:53 PM8/16/13
to chromi...@chromium.org

Comment #26 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

@smus, AFAICS, media keys are always bound together. Via #22 and #25's way
the developer needs to write four commands....

Now the manifest change I proposal is only a special permission, something
like:

{"commands": ["mediaKeys"]}

We should request for the users' agreement about listening media keys.

And all of the extensions which have this permission can share these media
keys commands(MediaKeyPlayPause, MediaKeyPrevious, MediaKeyNext, and
MediaKeyStop). Or only the first one who request this permission
successfully?

@finnur, what's your opinion about this one?

chro...@googlecode.com

unread,
Aug 19, 2013, 10:48:41 AM8/19/13
to chromi...@chromium.org

Comment #27 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

I'm worried that we are getting too bogged down on supporting the Media
Keys specifically, and not focused enough on providing a general purpose
solution for global Commands. A Media key is just one type of key it should
support and I think it would help nudge the design in the right direction
if we assume (just for the sake of discussing the design) that we're not
going to support any Media keys. For example, how would this look if we
were trying to support Ctrl+Shift+A (or something) globally? (Once we have
that working it is easy to add MediaKeys to the mix.

From an API standpoint we talked about (see proposal
https://docs.google.com/a/google.com/document/d/1mFmxLoYrcwdg1pouXpC_MC4SF-nMWDzWaMNrIHgM1pM/edit)
adding a global flag, such as:

"commands": {
"next-track": {
"suggested_key": {
"default": "MediaKeyNext",
"global": true <- This.
},
"description": "Go to the next track in Rdio."
},
},

It follows from this proposal that we need changes on these fronts (and
this is also the order of how I would attack the problem):
1) We should add a global handler that keeps a registry of keys that
extensions want to listen to globally.
2) The global handler needs to handle not just the Media keys eventually
but also the other keys we can parse from the manifest (ie. Ctrl+Shift+A).
3) We should add MediaKey* keys as keys that we can parse from the manifest
(see ParseImpl of chrome/common/extensions/command.cc).
4) The non-global (current) Command handler needs to handle the new Media
keys and I think we get that for free assuming Chrome sees the media keys
when it has focus -- I don't have such a keyboard to test it.

I don't quite understand why we'd need a separate enable_media_keys flag or
a separate mediaKeys permission.

The latter may be an attempt to get around the fact that Apps by design
don't have access to the Commands permission/object (which is intentional
because they already have a more powerful JS API available to them that
they should use) but if that's the case, then I'd rather open this API up
to apps but restrict Apps to use only global shortcuts (trying to register
shortcuts in Apps without specifying global:true should then result in an
error).

chro...@googlecode.com

unread,
Aug 19, 2013, 10:50:41 AM8/19/13
to chromi...@chromium.org

Comment #28 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

> And all of the extensions which have this permission can share these
> media keys commands(MediaKeyPlayPause, MediaKeyPrevious, MediaKeyNext,
> and MediaKeyStop).
> Or only the first one who request this permission successfully?

We should do it the way we do it for non-global shortcuts today. If the key
is free when extension A requests it, we should let it take the key. If
extension B comes in and tries to grab the same key, it will not be honored
(but the conflict can be listed in the install bubble with a pointer to the
UI for the user to manually assign the key to extension B -- which will
obviously make extension A not see the key in the future).

chro...@googlecode.com

unread,
Aug 19, 2013, 11:08:41 AM8/19/13
to chromi...@chromium.org

Comment #29 on issue 131612 by stro...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

> We should do it the way we do it for non-global shortcuts today. If the
> key is free
> when extension A requests it, we should let it take the key. If extension
> B comes in
> and tries to grab the same key, it will not be honored (but the conflict
> can be listed
> in the install bubble with a pointer to the UI for the user to manually
> assign the key
> to extension B -- which will obviously make extension A not see the key
> in the future).

I know you're trying to think generally, but this is sub-optimal for the
media keys case, specifically because the user does not always want the key
to go to the same app. Rather, they want it to go to the app being used to
play music/movies at that moment. On a typical machine, a user might have
both a video player and a music player packaged app installed at the same
time. It would be silly to require the user to manually go and change the
key binding every time they want to use the other app. Much better in my
opinion is the behavior that the spotify folks chose (see link in #25)
where the most recent app gets the keypress. I don't think this behavior is
general to all global keys, but it is definitely required for reasonable
operation of media keys.

chro...@googlecode.com

unread,
Aug 19, 2013, 12:41:43 PM8/19/13
to chromi...@chromium.org

Comment #30 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Yup. Granted, we might in the end want to special-case this for the media
keys, but we must not lose track of the general case.

chro...@googlecode.com

unread,
Aug 19, 2013, 12:51:43 PM8/19/13
to chromi...@chromium.org

Comment #31 on issue 131612 by stro...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Agreed, starting general is good, just wanted to make sure you were aware
of the specifics to media keys. Sounds like you're on top of everything.

chro...@googlecode.com

unread,
Aug 19, 2013, 1:04:43 PM8/19/13
to chromi...@chromium.org

Comment #32 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

It was very good input -- I had not thought about that case, actually.

chro...@googlecode.com

unread,
Aug 20, 2013, 5:34:13 AM8/20/13
to chromi...@chromium.org

Comment #34 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

smus: A global shortcut is very useful as an entrypoint for many apps.
Think of note taking applications (Google Keep for example) that would be
able to register a global shortcut to start a new note. In fact, we've
already had people relying on the fact that the Commands API was
inadvertently global in nature on Chrome OS. They were using it to do
exactly this (and that had nothing to do with the Media keys).

chro...@googlecode.com

unread,
Aug 21, 2013, 6:41:34 AM8/21/13
to chromi...@chromium.org

Comment #38 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

As far as I can tell, these OS shortcuts are a bit of a niche feature. I
use one on Windows and it is to start a native app for quick note-taking.
If I could launch Google Keep with Ctrl+Shift+foo from anywhere in Windows
then I'd be able to start keeping my notes in the cloud. To me this fits in
well with trying to bring native capabilities to web apps.

I don't think the general public is aware of these OS shortcuts, though,
and those who are are powerusers who are probably able to figure out why
there's a conflict and how to resolve it.

chro...@googlecode.com

unread,
Aug 30, 2013, 9:12:56 PM8/30/13
to chromi...@chromium.org

Comment #39 on issue 131612 by amjo...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Hi folks,

What's the status of this work? The API proposal doc mentions M32 as a
target. Do we think that is still accurate? Is anyone actively working on
implementing this?

Thanks!

chro...@googlecode.com

unread,
Aug 30, 2013, 10:30:21 PM8/30/13
to chromi...@chromium.org
Updates:
Status: Started
Owner: zhch...@gmail.com

Comment #40 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

I'm working with on my proposal for windows and linux platform. finnur@ has
helped me a lot to continue the proposal. My current plan:

1. Support parsing media keys in chrome.commands. (WIP:
https://codereview.chromium.org/23445013/)
2. Add a global flag to support key combinations like: Ctrl+Shift+A, then
make it work as expected on Windows and Linux platform. Is there anybody
that are interested in making it works on OSX? As well as on Chrome OS.
3. Because the single media keys need another way to work globally, so we
also need to implement something like MediaKeysMonitor.

The global keyboard shortcut will tracked via issue 237475.

Change the owner to me temporarily.

chro...@googlecode.com

unread,
Sep 4, 2013, 1:13:54 AM9/4/13
to chromi...@chromium.org

Comment #41 on issue 131612 by bugdro...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612#c41

------------------------------------------------------------------------
r221143 | zhc...@gmail.com | 2013-09-04T04:07:59.289644Z

Changed paths:
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/command_unittest.cc?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/command.cc?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/extension_manifest_constants.cc?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/ui/base/accelerators/accelerator.cc?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/command.h?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/extension_manifest_constants.h?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/commands/command_service.cc?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/templates/intros/commands.html?r1=221143&r2=221142&pathrev=221143
M
http://src.chromium.org/viewvc/chrome/trunk/src/ui/base/strings/ui_strings.grd?r1=221143&r2=221142&pathrev=221143
D
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/commands/command_service_new.cc?r1=221143&r2=221142&pathrev=221143

Parse media keys for named command in the manifest.

BUG=131612

Review URL: https://chromiumcodereview.appspot.com/23445013
------------------------------------------------------------------------

chro...@googlecode.com

unread,
Sep 5, 2013, 3:30:46 AM9/5/13
to chromi...@chromium.org

Comment #42 on issue 131612 by bugdro...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612#c42

------------------------------------------------------------------------
r221360 | zhc...@gmail.com | 2013-09-05T07:23:13.448108Z

Changed paths:
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/resources/extensions/extension_command_list.js?r1=221360&r2=221359&pathrev=221360

Enable user assign media keys in chrome://extensions page.

BUG=131612

Review URL: https://chromiumcodereview.appspot.com/23523019

chro...@googlecode.com

unread,
Sep 24, 2013, 4:23:26 PM9/24/13
to chromi...@chromium.org

Comment #43 on issue 131612 by sc...@fujan.name: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

With NPAPI being removed in the near future this extension:
https://chrome.google.com/webstore/detail/swayfm-unified-music-medi/icckhjgjjompfgoiidainoapgjepncej
will stop working.

It seems best for this media key support to be given priority so that it
can get to stable in a timely fashion (before NPAPI is phased out).
Preferably before January, certainly before May. See:
http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html

What is the status of this issue?

chro...@googlecode.com

unread,
Sep 25, 2013, 7:27:40 AM9/25/13
to chromi...@chromium.org

Comment #44 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

In progress, as the status of this bug shows. Last checkin was September
5th (as the checkin trail in this bug shows) and there are changelists in
flight.

But we still have a long way until NPAPI stops working altogether.

chro...@googlecode.com

unread,
Sep 26, 2013, 3:12:11 AM9/26/13
to chromi...@chromium.org

Comment #45 on issue 131612 by jrc1...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

I posted to www...@w3.org for possible standardization of multimedia keys
support before Boris Smus pointed me to this issue.

http://lists.w3.org/Archives/Public/www-dom/2013JulSep/0277.html

Joël

chro...@googlecode.com

unread,
Sep 26, 2013, 6:15:02 AM9/26/13
to chromi...@chromium.org

Comment #46 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Thanks Joël.

Just to set the expectations right: What you describe in your proposal is
beyond the scope of what this bug covers. This bug covers extending the
Chrome Extension Commands API to include global shortcuts (of which Media
Keys are one type), not to provide this capability to arbitrary webpages.

That's not to say we won't expose that to arbitrary webpages at some point
-- it is just that I don't intend to take it that far. I therefore see
these initiatives as somewhat orthogonal, although there will be some
overlap in the implementations with some opportunities for reuse, I suppose.

chro...@googlecode.com

unread,
Sep 26, 2013, 6:29:02 AM9/26/13
to chromi...@chromium.org

Comment #47 on issue 131612 by jrc1...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

You're right Finnur. I should have said this more explicitly. Thanks for
the clarification.

Joël

chro...@googlecode.com

unread,
Nov 20, 2013, 12:22:57 AM11/20/13
to chromi...@chromium.org

Comment #49 on issue 131612 by adma...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

What is the status of the media keys, such as MediaNextTrack, in the
Commands API? The docs [1] mention that they are available, and the API is
marked as available in Stable since Chrome 25, but I can't get any media
keys to work on Mac, they all just open iTunes instead.

[1]: http://developer.chrome.com/extensions/commands.html

chro...@googlecode.com

unread,
Nov 20, 2013, 12:45:00 AM11/20/13
to chromi...@chromium.org

Comment #50 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Note: This is my personal opinion, as a student who are lucky in
contributing this feature to Chromium.

We are working in progress that making media keys works globally (which
means chrome didn't need to be focused) on Windows and Mac.

Windows Part: https://codereview.chromium.org/64273008/
MAC part: https://codereview.chromium.org/60353008/

However, the doc maybe misleading currently. On Linux and Mac, these keys
are controlled by the desktop environment, which means Chrome (as a normal
application) couldn't receive these key event directly, so it didn't work
as expect. But if the global chrome.commands are done, we can listen for
these multimedia keys easily and it can work without Chrome being focused.

Currently global chrome.commands is in dev channel and behind a feature
switch. We are trying our best to make it land stable channel as soon as I
can.

See issue 302437 if you are interesting in global chrome.commands.

chro...@googlecode.com

unread,
Nov 22, 2013, 2:25:15 AM11/22/13
to chromi...@chromium.org

Comment #51 on issue 131612 by bugdro...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612#c51

------------------------------------------------------------------------
r236707 | zhc...@gmail.com | 2013-11-22T07:20:01.539039Z

Changed paths:
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/global_shortcut_listener_win.cc?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_0/manifest.json?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_1/manifest.json?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_0/background.js?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_1/background.js?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_0?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_1?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/global_shortcut_listener_x11.cc?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_0/background.js?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_1/background.js?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_commands_global_registry_apitest.cc?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_0?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/non_global_media_keys_1?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_0/manifest.json?r1=236707&r2=236706&pathrev=236707
A
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/keybinding/global_media_keys_1/manifest.json?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_commands_global_registry.cc?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_keybinding_registry.cc?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/commands/command_service.cc?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_keybinding_apitest.cc?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_keybinding_registry.h?r1=236707&r2=236706&pathrev=236707
M
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/commands/command_service.h?r1=236707&r2=236706&pathrev=236707

[Windows] Finish global and non-global media keys support on Windows.

This patch make sure that Media keys go to all apps/extensions that
register for
them.

BUG=131612, 302437
TEST=interactive_ui_tests
--gtest_filter=CommandsApiTest.AllowDuplicatedMediaKeys
TEST=interactive_ui_tests
--gtest_filter=GlobalCommandsApiTest.GlobalDuplicatedMediaKey

Review URL: https://codereview.chromium.org/64273008
------------------------------------------------------------------------

chro...@googlecode.com

unread,
Jan 21, 2014, 3:39:17 AM1/21/14
to chromi...@chromium.org

Comment #53 on issue 131612 by Jayschwa: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

Media keys seems busted in stable and 33.0.1750.29 beta-m. Attempting to
load an unpacked extension that uses one yields:

Could not load extension from 'foo'. Invalid value
for 'commands[1].windows': MediaPlayPause.

Extensions in the Chrome store that purport to use the media keys don't
seem to be working either, though I'm able to install them.

chro...@googlecode.com

unread,
Jan 21, 2014, 12:32:44 PM1/21/14
to chromi...@chromium.org

Comment #54 on issue 131612 by boris.s...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Jay, you need to run chrome with --global-commands=1.

chro...@googlecode.com

unread,
Jan 21, 2014, 8:27:38 PM1/21/14
to chromi...@chromium.org

Comment #56 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Jay, would you mind provide me the below information, so that I can take a
look what's happening on your side. I can not reproduce your problem.
Thanks in advance.

OS:
manifest.json:

Note: non-global[0] media keys works only on Windows. And global media keys
are still behind a flag as Boris said.

[0]: Chrome should be focused.
[1]: Without requiring Chrome is focused, which is more useful and
cross-platform.

chro...@googlecode.com

unread,
Jan 21, 2014, 11:04:11 PM1/21/14
to chromi...@chromium.org

Comment #57 on issue 131612 by Jayschwa: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

I experience the problem regardless of how the global-commands flag is
toggled. The manifest is from a sample extension with some minor
modifications.

OS: Win 7 SP1 64-bit
manifest.json:
{
"name": "Sample Extension Commands extension",
"description": "",
"version": "1.0",
"manifest_version": 2,
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_popup": "browser_action.html"
},
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+F",
"windows": "MediaPlayPause"

chro...@googlecode.com

unread,
Jan 21, 2014, 11:16:44 PM1/21/14
to chromi...@chromium.org

Comment #58 on issue 131612 by zhch...@gmail.com: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Oops, media keys are only available for commands
except "_execute_browser_action" and "_execute_page_action". I should have
mentioned that in the docs.

chro...@googlecode.com

unread,
Jan 21, 2014, 11:57:44 PM1/21/14
to chromi...@chromium.org

Comment #59 on issue 131612 by Jayschwa: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

Hmm. Well the good news is that if I try a media key for the toggle-feature
command in the sample extension, I no longer get an error on extension
load. The bad news is that pressing the key doesn't seem to do anything,
even with Chrome focused. MediaPlayPause is the key that plays and pauses
for the likes of Windows Media Player and Spotify right?

chro...@googlecode.com

unread,
Jan 22, 2014, 8:15:46 AM1/22/14
to chromi...@chromium.org

Comment #60 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

Jayschwa: This isn't the right bug to complain about something that isn't
working. This bug is to keep track of the feature work. Please create a new
bug as needed.

And to be clear, you should be using: --enable-global-commands (I don't
think --global-commands gets translated into the former). Also, global
commands only work with named events, as Chaobin mentioned, and always
have. And finally, your last question is way too low on details for anyone
to answer.

But in any case, don't answer here. Please create a new bug if you are
still facing some issue with this.

chro...@googlecode.com

unread,
Jul 1, 2014, 5:55:19 PM7/1/14
to chromi...@chromium.org

Comment #61 on issue 131612 by ebl...@gmail.com: Multimedia keys API support
http://code.google.com/p/chromium/issues/detail?id=131612

Can anyone share an update with the current status of this feature in
Chrome OS? I am interested in helping to implement the support for media
keys in the built-in audio/video player applications.

chro...@googlecode.com

unread,
Jul 2, 2014, 6:04:59 AM7/2/14
to chromi...@chromium.org

Comment #62 on issue 131612 by fin...@chromium.org: Multimedia keys API
support
http://code.google.com/p/chromium/issues/detail?id=131612

A ChromeOS solution is in progress, and being tracked in issue 336761.

chro...@googlecode.com

unread,
Apr 12, 2015, 2:56:15 PM4/12/15
to chromi...@chromium.org

Comment #63 on issue 131612 by schellma...@gmail.com: Multimedia keys API
support
https://code.google.com/p/chromium/issues/detail?id=131612

i just tried using the 'MediaPlayPause' key as a global shortcut in a
packaged app on OSX and it worked like a charm.

chro...@googlecode.com

unread,
Oct 8, 2015, 6:58:57 PM10/8/15
to chromi...@chromium.org
Updates:
Labels: Hotlist-Recharge

Comment #65 on issue 131612 by lafo...@chromium.org: Multimedia keys API
support
https://code.google.com/p/chromium/issues/detail?id=131612#c65

This issue likely requires triage. The current issue owner may be inactive
(i.e. hasn't fixed an issue in the last 30 days or commented in this
particular issue in the last 90 days). Thanks for helping out!

-Anthony
Reply all
Reply to author
Forward
0 new messages