Depending on what type of keyboard you have there are different supporting applications enabling special features like the media buttons.
Microsoft mice and keyboards use the IPoint and IType applications for this. I have solved the issue with special functions provided by these applications by setting the "Run with highest privilege" on the Windows Task Scheduler activities that are responsible for starting the IPoint and IType applications when a user log in. This way the special features will also be available in admin sessions in Visual Studio.
If your keyboard is from another manufacturer you could probably find the software installed to support your keyboard and try running it with elevated privileges (run as admin) to test it.
My keyboard is using the Windows generic drivers. I have the same problem with the media keys not working when elevated programs are in focus. Is there a way to elevate the generic keyboard driver? – Matt Chambers – 2017-11-13T21:41:47.243
1Sorry, but I do not know if or how to solve that situation with the generic driver. The possibility to solve it for the IPoint and IType apps was based on the fact that they were separate apps. – Per Salmi – 2017-11-16T10:47:55.557