Media playback pauses when changing audio devcice

Whenever I disconnect my headphones, my pc switches back to my speakers. This is fine and expected. The issue is that when it does this it pauses whatever I’m listening to/watching. Media doesn’t get paused when switching to my headphones and there doesn’t seem to be any toggle in the settings to change this behaviour. Can it be changed?

Fortunately, my browser has ‘search’ capabilities.

If you don’t use automatic port switching, this doesn’t happen…

I use a script to switch my Audio from quadrophonic to surround, and also to connect/disconnect my phone’s bluetooth audio.

# Card name (adjust if needed)
CARD="alsa_card.pci-0000_04_00.6"

# Get current default sink name
current_sink=$(pactl get-default-sink)

# Check if any media player is playing
was_playing=false
if playerctl status 2>/dev/null | grep -q "Playing"; then
    was_playing=true
    playerctl pause
fi
sleep 0.2

# Decide based on whether the sink name contains "surround"
if [[ $current_sink == *"surround"* ]]; then
    # Currently in surround → switch to stereo
    pactl set-card-profile "$CARD" output:analog-stereo
    notify-send "Audio Mode" "Switched to Stereo"
    if [ -f "$STEREO_SOUND" ]; then
        paplay "$STEREO_SOUND"
    fi
else
    # Currently in stereo → switch to surround
    pactl set-card-profile "$CARD" output:analog-surround-40
    notify-send "Audio Mode" "Switched to Surround 4.0"
    if [ -f "$SURROUND_SOUND" ]; then
        paplay "$SURROUND_SOUND"
    fi
fi

# Resume playback if it was playing
if [ "$was_playing" = true ]; then
    playerctl play
fi

So some logic, but I trigger my surround/bluetooth toggles with Fn_F9 and F10 manually, not automatically.

Overall it makes sense that audio stop playing when you unplug headphones, imagine if your main system volume is set loud (especially as mine is hooked up to a surround amplifier with five large speakers and a subwoofer)… hence in my case I added a line in my bluetooth connection (switching sinks) to also adjust the volume to 35…

That means that if I’m watching a loud movie, when I pull otu the headphone jack, the movie sound will continue playing through speakers - but at a lower volume (so I have to then turn it up).

I searched google and this forum before signing up to post the question. All the results I could find were unrelated bugs, or people asking how to enable this functionality before it became the default, like the posts you linked to. But thanks for being a dick about someone asking for help in a forum that is here for people to ask for help.

I’m not sure what you mean by automatic port switching, as I am not switching port but rather switching devices, between my bluetooth headphones and hdmi audio. When the headphones connect they have priority, when they disconnect it falls back to the default.

My hdmi volume is always at around the same level, I don’t crank it up before I connect my headphones, so that isn’t an issue. When I switch to hdmi it keeps the last-set volume level, and vice-versa for switching to my headphones.

While I appreciate that you have a script that works for your soundcard/setup, I would prefer to have a simple toggle to disable this functionality somewhere in the settings. That is what I was asking for, if it doesn’t exist then I guess I’ll go find the place for feature requests.

Well I’m not sure how similar it is - with Bluetooth/HDMI fallback, but I’d assume it’s similar.

I don’t think it is possible to continue playback after Bluetooth disconnecting, which is why I showed you the example script I made to do the switch and to resume playback after that.

It’s quite frustrating that you said ‘I disconnect my headphones’ and then come back saying that I’m wrong because it’s BLUETOOTH - which you didn’t state at all.

In that case, I’d suggest my script is a good starting place to see how to switch TO a bluetooth connection and resume playback, also to switch back and resume playback, as I am able to switch my audio profiles (surround/quadrophonic) and also connect/disconnect my bluetooth audio with only a brief interruption in playback.

I said you were wrong because the posts you linked were feature requests that were requesting the opposite of what I’m asking. Apologies for the frustration, I honestly didn’t think that there was that much of a difference to have to specify how my headphones are connected. Also, I feel like having to manually change devices every time would be more frustrating than how it is currently.

I wanted the toggle in the settings because I shouldn’t have to mess about writing scripts every time I want to change a setting and then having to debug and fix it when an update breaks it. This is what puts a lot of people off of linux, and honestly it’s almost enough to make me go back to windows, especially when coupled with the experience when asking for help.

It’s not so bad if it’s a one touch shortcut… but you’re right in your frustration. I found it incredibly annoying - even though the result is now excellent - that I had to spend a couple of hours figuring out a way to get stuff to work.

I always found Audio to be very complicated in Linux, I tend to ask nikgnomic over in the Manjaro forum to help me out with stuff… he’s a genius.

Actually you were rightly frustrated, because my reaction was about ten times stronger than it should have been… because it really isn’t that simple to figure out… so I’m the one who should be sorry :hugs: