Stream audio from osmc KODI to bluetooth audio device


I found some solutions to use raspberry as bluetooth client to play audio. For example, to play music from phone to raspberry via bluetooth.
But I didn’t find any solution to push audio from KODI to bluetooth speakers. It would be nice, if KODI could recognize bluetooth audio device automatically and start streaming music to bluetooth device. I would like to use USB dongle for bluetooth transmitter connected to raspberry so the raspberry can simultaneously play via bluetooth and audio output. Is ti possible?


Mod Edit: use this: [Deprecated] [TESTING] Bluetooth audio streaming (A2DP)

1 Like

I think that this article is good starting point :wink: I hope that it will be helpful.

Note that this solution (it’s probably the only one) uses PulseAudio which is said to have less audio quality. After following that guide, Kodi will also playback via PulseAudio.
With the speakers I have, the difference will probably not be noticable but I thought you should know :smile:

Yes I know but this is only detailed described solution that I manage to found. So if you can suggest something different I will be very happy to try it.


in my mind this guy tric is to complicate.
Just do this , that would work easy

sudo apt-get update
sudo apt-get install
sudo apt-get install bluez pulseaudio pulseaudio-module-bluetooth
sudo bluetoothctl -a

once you are on bluetoothctl app, just make this
agent on
scan on
wait for your device to show and make it discoverable
connect YOURMACADR (i think you can direct connect your device, but without trust it, it won’t reconnect at reboot)

Then when bluetoothctl says you’re connect, you have to select via KODI Options the audio output Pulse !
And that work ,

no need to edit some files or thing in the system, all is already here !

sorry for my poor english , that’s not my tongue ! i’ll do my best

1 Like

Thanks Glou.
This looks easy but if I understood you right… If I want to stream music to bluetooth speakers, raspberry must be paired and connected to bluetooth speakers and output device in KODI must be set to Alsa…

My point is, to select output channel on the fly for example: to point to music file in KODI and select to stream to bluetooth speakers from context menu. Or even better… If I switch on bluetooth speaker, KODI starts to stream audio to bluetooth speakers else KODI play music via audio jack on raspberry.

Pulseaudio comes with one modulo to switch automagically to last device connected.

Try to gives this command to pulseaudio (or enable it in pulse.conf)

pactl load-module module-switch-on-connect.

I think KODI must be set to Alsa device output (or pulse)

armaster & marcopi

oh, i haven’t even think about it for my media center !
i will try marcopi’s solution tonight , i think that would be cool if it works !
And maybe that would share my bluetooth audio from my retrosmc addon !

i’ll come to answer here this evening so ^^

Did you guys make it work?

I´m trying to use my Samsung bluetooth headphones.
Was follwing the guide in the 2nd post. Please notice that this guide explain how to use osmc/raspi as an A2DP music receiver NOT as audio streaming source. So i was a bit confused. But this guide helps me to make it able to connect my headphones to my raspi.

So i´m able to connect my headset ! YES!! But i have no audio output. I tried to set audio output in osmc to alsa pulse and so on… but nothing helps, I dont get any sound out of my headset…

Did i miss a point? Whats going wrong… Maybe someone can give me a clue?

I got my little bluetoothspeaker working with the tutorial from Glou…
only thing i have no clue how to make it that after restart the raspberry that it will automatically connect the device?

you must trust it from the rasp via bluetoothctl for autoreconnection in my remember
and for the audio source option , you should test

pactl load-module module-switch-on-connect. 

from marcopi answer , i have not test that command, but i think if it work that would simplify your configuration.

And for your audioheadphone, no solution, maybe some drm or something like that ?

Glad to see that my post is usefull for some other people :slight_smile:

Its trusted and paired perfectly but still not connect on reboot
First found out that after reboot, the bluetooth is not powered on automatically, so i found a solution by adding a file


and add following

# Set bluetooth power up
ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="/usr/bin/hciconfig %k up"

and in the file


i add this:

# automatically switch to newly-connected devices
load-module module-switch-on-connect

but sadly the speaker will not connect automatically after reboot…

Oh … did you try under bluetoothclt something like power on

or something like sudo systemctl bluetooth enable ? i think i have made this on my pi

yes, with the file in the udev rules it will power on automatically…
maybe i’ve found a solution for it with ah bash code on startup that i’ve found on a blog:

EDIT: i made some changes and found a solution with a systemd.timer

1: i made a script in /var/scripts/ called with chmod 755

echo "connect YOURMACADR" | bluetoothctl -a
echo "exit" | bluetoothctl -a

2: in /etc/systemd/system i create a file named BTspeaker.service

Description=Bluetooth Speaker automatic connect


3: in /etc/systemd/system i create a file named BTspeaker.timer

Description=Run Script after some time

# Time to wait after booting before activation


and enable this service with

systemctl enable BTspeaker.timer

so at the end, i was troubling around that connect script starts before before pulseaudio starts and this won’t work… now it waits 15 seconds after boot and this work fine :slight_smile:

Was following your guide exactly on a fresh osmc installation.

But i´m not able to connect my headphone.

Everytime i get error: Failed to connect: org.bluez.Error.Failed

Was looking around. It has to deal with the bluz version? Anyone knows how to fix this?

I had once this issue as well…
At the end found out that my speaker was still connecting to an other divice… And turn off/on my speaker fixed the issue…

Sounds simple but in my case i’ve lost an hour of searching for a solution :stuck_out_tongue_winking_eye:

Nope, unfortunately it’s not that easy.
I tried to connect with 2 different devices.
A Samsung Bluetooth headphone and a Logitech pure WiFi speaker.
I can discover and pair both of them but can not connect to any device.
Dunno how you guys make it work.
My Bluetooth keyboard is working fine btw…

i’m not sure if it works when 2 devices are tring to connect…
if you test with an usb keyboard and disconnect the BT keyboard?

you get that error when you try to connect manually?

can you post the journalctl log?

Yes you can have 2 devices connected at the same time.

But for being sure I disconnect my keyboard and it is still not working.

Is there any detailed log file for bluez where I can find some more specific information about my error?