Normally, after a recent fresh install of Linux Mint 19.3 x64 MATE on an Acer Aspire E15 laptop, media keys (using Fn+arrow keys on the built-in keyboard, or dedicated keys on an external keyboard) work fine for changing the volume: A modal pops up showing the current volume level, and disappears after a moment of not adjusting the volume. Also, the default volume control tray icon affects the same volume level when I drag the slider.
Now, sometimes we'll plug in an HDMI device that has built-in speakers, and want the audio to go through the speakers. Often the software audio source (browser, for example) is already open, and the only way I've found to switch its output to HDMI without having to restart the browser, is to go into the default Sounds applet:
...and set the analog output to Off, and the HDMI output to HDMI.
The problem is, once I've done this (or the other way around—started with HDMI and then switched back to analog stereo) the media keys no longer have an effect on the volume level. (But they do still make a popup showing a level changing...it just doesn't actually affect what's heard!)
Also, the volume control tray applet no longer has an effect on what's heard. The slider still visually works, but strangely, seems to have become independent from the popup that the media keys produce. Then, often the tray applet will simply disappear entirely (crashed, I guess.)
At that point the only (GUI-based) way to change the volume is to open the Sounds applet pictured above and adjust it from the slider there.
My main question is, how can I keep them working after switching audio outputs as described?
Or, if there happens to be a way to avoid this problem by using a different method than described for forcing an audio output change, that would be a welcome answer too.