Automatic switching between Jack and Bluetooth

I haven’t found an answer to my question about the documentation, so I’ll ask again.

I use a bluetooth headset and jack headphones on a daily basis. I would therefore like it to be possible on osmc to switch the sound automatically to the jack if the cable is plugged into the socket or then to the bluetooth if the bluetooth is connected. Is this possible?

I don’t think there is a headphone detect pin on any stock RPi. Maybe it is a feature of something like a HiFiBerry? I don’t know but it might be something to look into. You might ease the settings your changing by using the Audio Profiles add-on.

Doesn’t the switch already happen when you turn the bluetooth headphones on/off though? I haven’t messed with the analog audio but I have a RPi 4 setup where it output to HDMI until I turn on a pair of headphones that are paired with it and it automatically switches the audio output device. This wasn’t configured, just how it worked stock. The only limit being that it doesn’t switch during playback.

We have some logic to change the audio output on the fly which we developed when exploring a remote with a headphone jack.

To my knowledge though there is no hot plug event for the Raspberry Pi’s 3.5mm jack so we don’t know when we should change the output over. You could map it to a remote button perhaps.

Hello, I’ve installed the remote control but I can’t see where to go to change the audio output.

Should I use “audio profile”?

Hello, I remember that it automatically connects to Bluetooth when the jack is not in use.

Is it the physical remote control or the mobile?

I think there may be a bit of a language barrier here making understanding a bit more difficult. The Raspberry Pi’s don’t have a way to detect if the headphone jack is plugged in or not so a software solution to do the exact thing your seeking isn’t possible trivially. I suggested two different methods to get a workable solution.

The first method would be to trigger off the bluetooth headphones being on/off instead of the wired headphones being plugged in or not. If audio output is configured for the wired headphones in settings>system>audio>audio output device> when the wireless headphones are not powered on, and then you switch that setting to the wireless headphones when they are paired, then that setting should automatically switch after that when the bluetooth headphones are turned on and off.

The second option I suggested was to use the Audio Profiles add-on. This add-on allows you to configure different audio settings either by a trigger or with a remote/keyboard mapping. Further information on how that would work and how you would go about configuring it would come from the link I provided and if that is not enough through whatever thread the author of that add-on has on Kodi’s forum.

If I understand correctly, the first solution is to set Bluetooth audio output as the default in “Settings > System > Audio > Audio output device > Bluetooth Audio ()” so that as soon as OSMC is turned on, it connects to Bluetooth. Otherwise, if you plug it into the jack, it will output via the jack and not Bluetooth.

The second solution (Audio Profile) I’m trying to figure out how it works. For the moment, I’ve configured profile 1: Jack - Analog / profile 2: Bluetooth - Digital.

No, that is not what I was saying. With the Bluetooth headphones turned off you set your output such that your headphone jack is outputting audio. Then connect your Bluetooth headphones and set the output so it sends the audio to the Bluetooth headphones. Once you have done that the audio output should switch automatically depending on if the Bluetooth headphones are connected/powered on or not.

And I will state this one again, hopefully for the last time, the Raspberry Pi’s do not have a function built in to detect if something is plugged into the headphone port.

that’s what I did