Switching inputs from MacBook Pro Speakers to External Headphones When I have my headphone plugged into my Mac and open an application like YouTube, I can hear sound from the headphones. When I unplug the headphones, I then hear sound from the MacBook Pro speakers.

But when I plug the headphones in again, I still hear sound from the Mac speakers! Not from the headphones! 

In Sound Setting I can see that the output Device is set as External Headphones, but the sound is coming from the Mac speakers!



I am so confused! Any idea how to get sound back to the headphones?
In my experiments so far:


It happens frequently in YouTube in Chrome but apparently not in YouTube in Safari or in iTunes.
I've seen it happen repeatedly on two Mac laptops and with multiple headphones. (Both Macs are on Mojave since they need to run 32-bit apps.)
Plugging in headphones does switch the Sound preference and the Sound menu bar menu to "External Headphones" even though it doesn't route the audio to the headphones.
When in this unfortunate state, the keyboard's Mute and Volume buttons don't work, that is, they don't alter the sound coming out the speakers.
Between all the above points, we can rule out hardware problems including flakey headphone jacks.
Resetting parameter RAM doesn't help.
Adjusting settings in Audio Devices in the Audio MIDI Setup utility app hasn't helped.
To get Audacity to switch to headphones, you have to ask it to rescan audio devices, then go into preferences to select the headphones. That usually works.


Funky workaround:


Pause YouTube in Chrome.
Start playback in iTunes (it will play through the headphones), then pause it.
Resume YouTube playback in Chrome.
If that didn't work, pause YouTube, wait a few seconds, then try again.


Hypothesis: Some apps don't respond as well as Apple's apps to macOS's complicated sound output switching.

In Zoom: It turns out the Zoom app has its own menu to pick the output device. If it's not doing what you want, open this menu (next to the microphone button) and pick the desired device or pick Same as System (which seems to me ought to be the default if not the only choice).