Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brave is now intercepting media keys #3807

Closed
ArchFrosty opened this issue Mar 20, 2019 · 21 comments
Closed

Brave is now intercepting media keys #3807

ArchFrosty opened this issue Mar 20, 2019 · 21 comments
Labels
design A design change, especially one which needs input from the design team feature/keyboard-shortcuts priority/P4 Planned work. We expect to get to it "soon". QA Pass-Linux QA Pass-macOS QA Pass-Win64 QA/Yes release-notes/include workaround/flags resolve by flipping brave://flags

Comments

@ArchFrosty
Copy link

Description

Note: this is probably a new Chromium "feature".
After the most recent update, Brave intercepts media button key presses on my keyboard (play, stop, skip, etc.). I use these buttons to control desktop Spotify client to play my music, but now while Brave is opened (doesn't need focus) these buttons do nothing. Furthermore if I have a Youtube video opened in one of my tabs (doesn't need to be the active tab), it controls this video (play, pause, [next, previous - if in playlist]).

Even this is somewhat buggy, for example, if video is NOT in a playlist, the next and previous buttons do still control Spotify, but as soon as I switch to a tab with video in a playlist, these buttons control the playlist again.

If this is a wanted feature, at least give me the option to disable it. Please.

Suggestion to fix: if this behaviour only occurred if the tab with a video is SELECTED (Brave doesn't have to be in focus, just the tab is currently selected), otherwise the key press is not intercepted, this would be a fine compromise.

Steps to Reproduce

  1. Press media (play, for example) button on keyboard.

Actual result:

Nothing happens if Youtube video is not opened in some tab.
Plays video if it is opened in one of the tabs.

Expected result:

If media button is pressed, Brave does nothing, instead Spotify plays my music.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave | 0.61.51 Chromium: 73.0.3683.75 (Official Build) (64-bit)
Revision | 909ee014fcea6828f9a610e6716145bc0b3ebf4a-refs/branch-heads/3683@{#803}
OS | Windows 10 OS Build 17134.590

Reproducible on current release:

  • Does it reproduce on brave-browser dev/beta builds?

Website problems only:

  • Does the issue resolve itself when disabling Brave Shields?
  • Is the issue reproducible on the latest version of Chrome?

Additional Information

I am not familiar with Chromium internals, however according to issue #3299 this does seem like its is a "feature" added in Chromium version 73. My up to date version of Chrome is only version 72 so I cannot replicate this issue there.

@ArchFrosty
Copy link
Author

If anyone has the same issue, I am posting my temporary workaround here.
This is an AutoHotkey script I have written that intercepts the play/pause, next and previous media key presses and sends them to Spotify instead of letting Brave intercept them.

Media_Play_Pause::
DetectHiddenWindows, On 
PostMessage, 0x319,, 0xE0000,, ahk_exe Spotify.exe
DetectHiddenWindows, Off 
return

Media_Next::
DetectHiddenWindows, On 
PostMessage, 0x319,, 0xB0000,, ahk_exe Spotify.exe
DetectHiddenWindows, Off 
return

Media_Prev::
DetectHiddenWindows, On 
PostMessage, 0x319,, 0xC0000,, ahk_exe Spotify.exe
DetectHiddenWindows, Off 
return

@Mister36MN
Copy link

I can confirm I have this issue as well. I use Windows Media player and I realized it stopped taking commands from my keyboard and it would even start playing videos on the browser. I never realized it was the browser doing it.

@Mister36MN
Copy link

I currently use the Dev channel

@Soben
Copy link

Soben commented Mar 21, 2019

I am encountering this issue as well on OSX.

Even after leaving the offending website that took over my Media Keys, I do not regain them to my previous application (Spotify, in this case) until I restart Brave.

This does appear to be tied with the newest Chromium release https://www.neowin.net/news/chrome-73-will-bring-hardware-media-key-support-automatic-picture-in-picture/

@bsclifton
Copy link
Member

Can someone please give this a try? Go to brave://flags and search for Hardware Media Key Handling. Disable this setting and let us know if that fixes the issue 😄

@Soben
Copy link

Soben commented Mar 21, 2019

@bsclifton Hey Brian,

This flag being disabled works for me.

I don't mind having it temporarily gain the media keys, though, just want it to relinquish control when done.

But for now, I'll leave the flag active to block Brave from ever taking over my media keys.

@ArchFrosty
Copy link
Author

@bsclifton Yes! That does fix the issue, thank you very much.

@bsclifton
Copy link
Member

Awesome @Soben - thanks for confirming! 😄 Great that folks have a work-around; would be even better if it wasn't needed 😛

Let's keep this issue open and perhaps (based on the number of upvotes / etc), we can look at disabling the flag by default

@rebron rebron added priority/P5 Not scheduled. Don't anticipate work on this any time soon. workaround/flags resolve by flipping brave://flags labels Mar 22, 2019
@jbartolozzi
Copy link

Can someone please give this a try? Go to brave://flags and search for Hardware Media Key Handling. Disable this setting and let us know if that fixes the issue 😄

Thanks

@bsclifton
Copy link
Member

bsclifton commented May 14, 2019

Maybe this is something we can expose in our settings screen
cc: @petemill

@petemill
Copy link
Member

Setting conditional could be added here: https://cs.chromium.org/chromium/src/content/public/browser/media_keys_listener_manager.cc?type=cs&g=0&l=19

@petemill petemill self-assigned this May 14, 2019
@rebron rebron added priority/P4 Planned work. We expect to get to it "soon". design A design change, especially one which needs input from the design team and removed priority/P5 Not scheduled. Don't anticipate work on this any time soon. labels May 14, 2019
@Tywele
Copy link

Tywele commented Jun 4, 2019

In Chrome I can use my media keys for Google Music (in the browser) even when I watch a video on YouTube. If I use Brave it starts and stops the video instead of the music when I have YouTube open with a video. Can this behaviour be changed somehow?

@bsclifton
Copy link
Member

I believe this was tied to the field trial HardwareMediaKeyHandling which we recently dropped. This change has been made in Nightly and will be working it's way through the channels

Can anyone on Nightly confirm that they don't see the problem? If so, I think we're safe to close this out 😄

@bsclifton
Copy link
Member

bsclifton commented Jun 24, 2019

Closing as this should be resolved in 0.68.x (current nightly). Fixed with #4551

@bsclifton bsclifton added this to the 0.67.x - Dev milestone Jun 24, 2019
@LaurenWags
Copy link
Member

@bsclifton #4551 is actually in 0.68.x milestone, should this issue be moved to match that milestone?

@bsclifton bsclifton modified the milestones: 0.67.x - Beta, 0.68.x - Dev Jun 26, 2019
@bsclifton
Copy link
Member

whoops! good catch, @LaurenWags 😄 Fixed!

@LaurenWags
Copy link
Member

LaurenWags commented Aug 6, 2019

Verified passed with

Brave 0.68.119 Chromium: 76.0.3809.87 (Official Build) beta (64-bit)
Revision 111fe1e15d5ced26080a7dc239bcfe70f6c49aad-refs/branch-heads/3809@{#967}
OS Mac OS X
  • Verified able to play, pause, mute, fullscreen, etc a YT video when tab was in focus using expected keys (k, m, f, etc)
  • Verified that when the YT tab was not in focus but Brave was, selecting these keys did not affect the YT video.
  • Verified that when Brave was not in focus, selecting these keys did not affect the YT video.

Verification passed on

Brave 0.68.119 Chromium: 76.0.3809.87 (Official Build) beta (64-bit)
Revision 111fe1e15d5ced26080a7dc239bcfe70f6c49aad-refs/branch-heads/3809@{#967}
OS Ubuntu 18.04 LTS
  • Verified able to play, pause, mute, fullscreen, etc a YT video when tab was in focus using expected keys (k, m, f, etc)
  • Verified that when the YT tab was not in focus but Brave was, selecting these keys did not affect the YT video.
  • Verified that when Brave was not in focus, selecting these keys did not affect the YT video.

Verification passed on

Brave 0.68.129 Chromium: 76.0.3809.100 (Official Build) (64-bit)
Revision ed9d447d30203dc5069e540f05079e493fc1c132-refs/branch-heads/3809@{#990}
OS Windows 10 OS Version 1803 (Build 17134.523)
  • Verified able to play, pause, mute, fullscreen, etc a YT video when tab was in focus using expected keys (k, m, f, etc)
  • Verified that when the YT tab was not in focus but Brave was, selecting these keys did not affect the YT video.
  • Verified that when Brave was not in focus, selecting these keys did not affect the YT video.

@ghost
Copy link

ghost commented Aug 25, 2019

The fix in v 0.68.131, is not flawless on windows.

The fix only works if your media player of choice is communicating with windows(If it shows the currently playing song on the lock screen and in the volume overlay). If your media player doesn't this or you have disabled it then the only detected source for media within windows will be brave, so the media keys will control brave and your other service at the same time.

If your media service does communicate with windows then media keys (as of 0.68.131) only affect the service in focus and show the track metadata (rather than "brave.exe" like it did pre 0.68.131)
image
But there is a bug that will pause what ever is in brave when you change focus from music to brave

As a work around, the media flags should be added into the settings menu to make it easier for users to choose how media on brave operates
image

@ghost
Copy link

ghost commented Feb 19, 2021

Sorry to open this issue again.
But for me with Manjaro on Kernel 5.10.15
Even when changing #hardware-media-key-handling to disabled it still intercepts my media stream.
Screenshot_20210220_002943

@ghost
Copy link

ghost commented Feb 21, 2021

I found the problem. The Plasma integration extension was handling the media keys instead of pure brave.
Sorry for necrobumping the issue.

@bsclifton
Copy link
Member

@PlayingPenguin no worries - thanks for sharing what caused the problem for you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design A design change, especially one which needs input from the design team feature/keyboard-shortcuts priority/P4 Planned work. We expect to get to it "soon". QA Pass-Linux QA Pass-macOS QA Pass-Win64 QA/Yes release-notes/include workaround/flags resolve by flipping brave://flags
Projects
None yet
Development

No branches or pull requests