[How-to] set up Bluetooth audio

Interesting but as @fzinken says it shouldn’t be. You seem to have missed out scan on from the bluetoothctl commands and there shouldn’t be a need for power on. TBH it should all be possible from My OSMC which is programmed to do things in the right order.

I think what can happen is a device can end up connected but only for non-audio services (like what’s needed for volume buttons). A difficult thing to debug. Removing the device completely and starting again is always a good strategy.

I’m certainly not an authority on this and somehow got to where I am with try and error.

Quite possibly the bluetoothctl sequence ended up with the speaker not being connected, and only the GUI sequence did that. Maybe connect after pair would have done the trick just as well.

A comment on bluetooth - Not getting an "Enter Pin" prompt when pairing with BLE device - Raspberry Pi Stack Exchange, as well as pulseaudio - Pairing Bose QC 35 over Bluetooth on Fedora - Unix & Linux Stack Exchange indicate that trust is required before pair, not after – which is consistent with my observations.

During one of my attempts I did in fact miss scan on, which resulted in a different error message (device not found). That implies there’s a different issue.

I can’t guarantee every part of the BT commands in the sequence is required (particularly default-agent and power on), it would take some extra commands to figure that out. A that point I was simply trying out solutions to similar-looking problems one by one.

What I can tell for sure is that pair – trust – connect reproducibly failed at the pair stage for me, whereas connect – trust –pair at least gave me a correctly paired device. However, if you have previously paired the device and not removed all traces, you might still have the trust stored somewhere, so a pair operation without a previous trust would succeed in your case, but not for a fresh setup.

If anyone else runs into similar issues, I would suggest trying the following sequence:

agent on
scan on
trust <mac>
pair <mac>
connect <mac>
scan off
agent off

Seems it’s in the repo now.

Yes, please see the OP as the package names have been changed.

Is it possibility to connect more then one Bluetooth headphones at the same time and watch movie?

I thought I remembered there was someone who tried it before. But when I was searching I only found this thread which says not possible

That user did follow up with a how-to but it’s not for the feint-hearted.

Had that in mind, but search “multiple bluetooth” didn’t made it show up

Found it. Not that user but @rupert_s

Thanks for info.

Will we get back the feature for showing track title and interpret and player controls in future releases?

It’s not high on the todo list, unfortunately. It was implemented by a virtual audio player which someone developed for earlier Kodi versions but it hasn’t been updated and the author is no longer around. Quite a lot of work for someone to pick up. How are your coding skills?

exist an old patch file to see the modifications?
would work the addon for patched kodi or will need it mods too?

There was something called BTplayer but it seems to have gone from the osmc github.

The problem is the way that BTPlayer ‘knew’ when audio was being streamed to it would likely need changing as we don’t use PulseAudio anymore.

I’m doubtful whether bluez-alsa has the ability to get the track and volume information.

there’s no .asoundrc.example file after upgrarding but I found this thread to be helpful - My Bluetooth speakers won't connect either! - #22 by grahamh

Hi,

i have not tried to stream to my BT-Headphone’s yet but at least both were listed in Settings->Audio->Output with the provided .asoundrc-template.
This really should find it’s place back in ~/.asoundrc.template or at least in here.

Am I correct to look into /usr/share/kodi/addons/script.module/omcsetting.networking/ressources/lib/osmcnetworking/*py, especially osmc_bluetooth.py, to try to implement an ‘Add Alsa-Plug’-Button in the Drop-Down-Field?
First i thought about a shell-script but now that i found the Python-Files I would need to comb through them…
Or maybe just an dirty os.exec()/shutil…with a Shell-Script. My Python-Skills aren’t that sophisticated.
But on the other hand, one should first check if the device can stream Audio before allowing this action. So even more to look up…

Maybe I will first write a shell-script as helper for lets say adding a device with connectbot from my mobile’ or just being lazy…
echo "exit" |bluetoothctl |grep Device |cat -A |cut -c59- |rev |cut -c2-|rev
… got rid of everything ‘nasty’ and the rest will have to do later when i have the time.

That is, if anyone would be interested.

with regards,
Christopher

PS: This would even be my second official contribution to osmc after one in ~2014 :joy:

got bored waiting for someone who didn’t show…

image

Thanks for your interest, but can you explain what problem this solves?

this doesn’t solve a problem, it just makes things easier… as i mentioned…
I couldn’t switch to my headset until i found this thread. i didn’t need it… it was just annoying that i even had to look around why the … my Headset wasn’t shown in the Audio-Output. And didn’t have that much time either.
With my former device , an wetek play 2 and libreelec it just worked out of the box…
And know that i got myself a new Vero, i just thought this would be a given… my bad.

And for the Shell-Script. One could wrap ‘dialog’ or ‘whiptail’ around and read the current .asoundrc… to check if the Device is already listed. or something or just overwrite it …
i would have welcomed a executable to just generate the config a week ago.

with regards,
Christopher