Forum Discussion
Media Keys and Teams notifications
If I use keyboard media keys to pause music when I receive a call in teams, the notification sound doesn't seem to get dismissed when I answer the call. So, when I later press play, it also resumes playing the teams call sound over my music.
It does seem to go away on it's own eventually, but it's kind of annoying when I want to listen to music!
- Hi graemec5
Known issue, as raised here on uservoice
https://microsoftteams.uservoice.com/forums/555103-public/suggestions/39956326-media-keys-affecting-teams-web-app
If you go to that uservoice, a few comments down you should see a solution to this: go to avatar > settings > permissions > turn off midi device. People have reported that it has solved it for them
Hope this resolves and answers your question
Best, Chris
- dhvikCopper Contributor
graemec5 as a workaround, update the teams autostart post in the registry.
It's located in the following pathComputer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Key is named "com.squirrel.Teams.Teams"
If you modify the --process-start-args to contain the "-disable-features=HardwareMediaKey" value, then it should be set when launched on startup.
On my computer, the full value isC:\Users\My Name\AppData\Local\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "-disable-features=HardwareMediaKeyHandling --system-initiated"
- AndreDIALCopper Contributor
dhvik thank you very much!
Your suggestion didn't work for me perfectly as my registry entry got overwritten with every restart of windows but this is my modified solution now:1) Go to settings and switch off "Auto-start application"
2) Go to C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs and search for "Microsoft Teams" / Right click on the short cut / Copy
3) Press WIN+R / type in shell:startup
4) Right click in the autostart folder / Paste (now the shortcut should have been added to your autostart folder)
5) Right click on the short cut / properties / short cut and copy/paste the following to target:
C:\Users\My Name\AppData\Local\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "-disable-features=HardwareMediaKeyHandling --system-initiated"
6) Apply changes
7) Restart your computer
This works fine for me now. Hope it helps you, too .
- dhvikCopper Contributor
AndreDIAL I noticed the same. Seems that Teams updates the autostart registration each time it starts (and overwrites any changes).
I also switched off the autostart setting (in Teams configuration). This removed the registry autostart key.
Then you are free to manually launch teams any way you would like to.
(I added a new key to the same registry folder and named it Teams instead, but a shortcut in the autostart folder as you mentioned, works just as fine)
- romp99Copper ContributorHas anyone heard of a solution to this that still works? It seems to suddenly have gotten worse on my system and it completely ignores the "-disable-features=HardwareMediaKeyHandling" flag. I have to restart Teams every time I get a call for my media keys to work.
I am so sick of the Teams devs spending all their time adding new features and none fixing the myriad of bugs this program has. We can't get rid of this program fast enough for me.- TheParadoX1984Copper ContributorSame Problem here. It is really annoying.
- dawustCopper Contributor
The command line parameters are no longer passed to the Chromium instance of Electron. I'm not sure if it's a bug of Teams or Electron, but I have my guess 😉
But you can still disable HardwareMediaKeyHandling by some advanced methods. Take a hex editor and search for HardwareMediaKeyHandling in teams.exe.You'll find something like:
4D 65 64 69 61 4B 65 79 48 61 6E 64 6C 69 6E 67 00 00 00 00 00 00 00 00 38 C7 09 47 01 00 00 00 01 00 00 00 00 00 00 00
Replace the last instance of 01 with 00 which should disable HardwareMediaKeyHandling again
4D 65 64 69 61 4B 65 79 48 61 6E 64 6C 69 6E 67 00 00 00 00 00 00 00 00 38 C7 09 47 01 00 00 00 00 00 00 00 00 00 00 00
This will most likely violate the end-user license agreement and these changes will also most likely be reverted by any Teams update. But if you came this far, you should be able to find a way to patch the file automatically after every Teams update.
Well, that's what we are left with when Teams can't get basic features right in 2022.
- Kev_OCopper Contributor
graemec5Like you, I suffered from this. For me, this has fixed the issue:
try starting Teams with -disable-features=HardwareMediaKeyHandling
eg. C:\Users\Username\AppData\Local\Microsoft\Teams\current\Teams.exe -disable-features=HardwareMediaKeyHandling
If you have e.g. a start menu shortcut (or other shortcut for teams), you can edit it and add it as a (commandline) argument so you wont have to remember it. The solution mentions Windows, but for me it also works on Linux, which is really nice!
- JohnnybakerCopper Contributor
I found that teams take a weird priority in windows over the Play/Pause Media.
The fix I found was to use Alt with Play/Pause Media.This would alternate which media the Play/Pause Media was using.
If interested in using one key I created a keybind with AutoHotkey to automate this to one key press.
In this case, F2 is my key of choice.Hope this helps.
f2::
Send {LAlt down}{Media_Play_Pause}{LAlt up}
return
graemec5- IainMNormanCopper Contributor
OMG pressing alt works! This is very weird. So that means I just need to swap out my streamdeck media button for a hotkey that presses alt + media-play instead.
Works for me with any modifier key, all 6 alts, shifts and ctrls work fine. Without it just a dead response, unless I've been called in which case I get a ring tone play.
Many thanks Johnnybaker && Tpolz
- HofaCopper Contributor
I had some fun automating the process of changing the Teams executable. First iterations took about 10 to 15 minutes to complete but this one does the job in about 5 seconds. You don't have to use it if you don't trust it but it sets the original EXE aside so if something wrong happens, you can just replace the resulting file from this script with the original
# Getting the filepath for Teams.exe $FilePath = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Microsoft\Teams\current\Teams.exe" # Killing all instances of Teams.exe Get-Process | ? { $_.Path -eq $FilePath} | Stop-Process -Force -Confirm:$False # Get the Hex and Binary format of the option "HardwareMediaKeyHandling" $Option = "HardwareMediaKeyHandling" $HWMKeyHandlingHexArray = ($Option.ToCharArray() | % { [String]::Format("{0:X2}", [System.Convert]::ToUInt32($_)) }) -Join "-" $HWMKeyHandlingByteArray = [Byte[]]($HWMKeyHandlingHexArray.split("-") | % { "0x{0}" -f $_ }) # Other needed variables $ValueOffset = 8 $OldValue = 1 $NewValue = 0 # Get Teams as ByteArray and Hex String $Bytes = [System.IO.File]::ReadAllBytes($FilePath); $Hex = [System.BitConverter]::ToString($Bytes) # Get the location of the option in de HexString $HexIndex = $Hex.IndexOf($HWMKeyHandlingHexArray) # Calculate the index of the hex to the index of the byte array # Account for the dashes in the string $Index = $HexIndex * 2 / 3 # Account for the fact that HEX makes couples of 2 characters for a byte $Index = $Index / 2 # Build in some safety $GotIt = $True For ($i = 0 ; $i -lt $HWMKeyHandlingByteArray.Count ; $i++) { If ($Bytes[($Index + $i)] -ne $HWMKeyHandlingByteArray[$i]) { $GotIt = $False } } If ($GotIt -eq $False) { "Something went wrong calculating the exact location of '{0}'" -f $Option Break } Else { # Checking for the value of the option $ValueIndex = $Index + $HWMKeyHandlingByteArray.count + $ValueOffset If ($Bytes[$ValueIndex] -eq $OldValue) { # Actually setting the value "Changing the value of option '{0}' from {1} to {2}" -f $Option, $OldValue, $NewValue $Bytes[$ValueIndex] = $NewValue # Set aside the old file for if something went wrong despite the checks in this script $File = Get-Item -Path $FilePath $CopyFilePath = Join-Path -Path $File.DirectoryName -ChildPath ("{0}.old{1}" -f $File.BaseName,$File.Extension) [Void](Copy-Item -Path $FilePath -Destination $CopyFilePath -Force:$False -Confirm:$False) # Write new teams.exe [System.IO.File]::WriteAllBytes($FilePath, $Bytes) } ElseIf ($Bytes[$ValueIndex] -eq $NewValue) { "No need to update the value: '{0}' is already set to {1}" -f $Option, $NewValue } Else { "Something isn't correct, the value for option '{0}' is neither {1} or {2} but {3}" -f $Option, $OldValue, $NewValue, $Bytes[$ValueIndex] } }
This HEX editing method is the only workable one I've found. It does **bleep** up the Digital Signature so it could get flagged by some EDRs but nothing yet from FortiEDR here.
- csmanulCopper Contributor
works great on teams 1.5.0.31168 using 16 as the offset, many thanks for providing this script.
- JT-WGCopper ContributorHoly %$^& - at this rate it'll be faster for me to Alt F4 teams after each meeting. Hmm, actually a macro app would do that nicely...
C'mon MS Devs - pull your heads out of your fundaments and delete the abomnibal code from Teams!
- mordack550Copper Contributor
Do you happen to have the full script (with updates) to github gists or something similar? 😄 Because if i execute the script, both with offset 12 or 16, teams wont start anymore 😞
- IainMNormanCopper Contributoryou need to run teams.exe directly I suspect you are running the update.exe if you are using an existing shortcut. That'll fail when it detects the change to teams.exe I believe.
- TpolzCopper ContributorTeams started hijacking my media keys a few days ago (specifically the play/pause button). Instead of playing the call notification sound (like it did for the past year), nothing happens now. Close Teams, and play button actually plays my music.
However, I noticed something interesting, If I press Ctrl+Play or Shift+Play (and maybe other modifier keys), my music plays and Teams ignores it. This doesn't fix the problem, I have to press Ctrl+Play every time. However, if this continues I'm going to setup AutoHotKey to change Play/Pause to Ctrl+Play/Pause permanently.
Can anyone else replicate my finding? Additional detail, I play music using YouTube Music in Chrome.- ducklaw99Copper Contributor
Tpolz Wow interesting. Yep, just tried it and it worked for me. Sort of. At first I tried left ctrl+play and it didn't work (it played the Teams call sound). So I did left ctrl+play again to turn that sound off. Then I tried right ctrl+play and it played my spotify music. Huzzah!
So then I tried left ctrl+play again and this time it played spotify. WTF is going on.
Nice find, btw.
- TpolzCopper Contributor
ducklaw99 I think what you experienced what I've experienced for the past year+, and it has nothing to do with pressing Ctrl. Previously, I would press play, and the Teams notification would sound. If I then waited for that sound to finish, and hit play again, the music would start. That worked regardless of pressing Ctrl (or any other modifier key). The new problem I've experienced is Teams hijacking the play button completely so nothing plays, not even the Teams notification.
- Lathejockey81Copper Contributor
I get Teams calls all day and listen to music on Spotify. I got so tired of this stupid problem that I wrote an autohotkey script which redirects the media buttons to Spotify shortcuts. It may be more verbose than is necessary - I'm not an AHK expert by any means. You can just put a shortcut to this in your startup folder (with Autohotkey installed, of course) and it will activate at bootup. I was so excited about the QOL improvement (I was closing and reopening Teams after every call!) I figured I would share it here. I know not everyone will have the permissions to run something like that, but for those that do, this is a simple permanent fix.
#Requires AutoHotkey v2.0 If WinExist("ahk_exe Teams.exe") and WinExist("ahk_exe Spotify.exe") { Media_Play_Pause::SpotifyKey("{Space}") Media_Next::SpotifyKey("^{Right}") Media_Prev::SpotifyKey("^{Left}") } SpotifyKey(key) { active := WinExist("A") spotifyWin := WinExist("ahk_exe Spotify.exe") DetectHiddenWindows("On") ControlFocus(spotifyWin) ControlSend key,, "ahk_exe Spotify.exe" if (WinExist(active)) { ControlFocus(active) } DetectHiddenWindows("Off") }
- JT-WGCopper ContributorPerfect, my exact use case. Thanks, I will be trying that!
- Hi graemec5
Known issue, as raised here on uservoice
https://microsoftteams.uservoice.com/forums/555103-public/suggestions/39956326-media-keys-affecting-teams-web-app
If you go to that uservoice, a few comments down you should see a solution to this: go to avatar > settings > permissions > turn off midi device. People have reported that it has solved it for them
Hope this resolves and answers your question
Best, Chris- Robin_LarssonCopper ContributorSadly, it does not work... 😞
- sjasctCopper ContributorHas anyone found a new workaround for this that doesn't involve hex editing? Been using the HardwareMediaKeyHandling disable fix for a while before it broke but I'd rather not be changing the exe for this, no matter how frustrating this bug is.
- muhammadfaizan1640Copper Contributor
It seems there's an issue with media keys and Teams notifications during calls. When using media keys to pause music, the notification sound doesn't always dismiss, leading to it playing when you resume music. It can be annoying, and you may want to check for updates or settings to address this. Consider giving feedback to Microsoft for potential improvements.
Regards: Faizan