[Deprecated] [TESTING] Bluetooth audio streaming (A2DP)

PA only.

Just make sure you use ALSA only for retrosmc. I am sure this can be configured.

I will check the logs later.

Did rmmod work? Did restarting Kodi without a full reboot work? I suspect if you restart both Pulse and Kodi, the issue will disappear

Sam,

This time I just did reboot RPI.
Next time it happens (prob same time tomorrow morning),
I’ll try rmmod, and restart Pulse and Kodi.

Thanks.
Best regards,
Niall.

Hi all!
I found this setup to work for me, but the process to make it work seems a bit convoluted to me, maybe I’m missing something here.
What I have been doing lately to let my OSMC stream audio to my Bluetooth headphones is the following :

  1. Turn on the raspberry
  2. Turn on the Bluetooth headphones
  3. Navigate to Settings > My addons > Program addons > OSMC > Network > Bluetooth
  4. Select the headphones from the list of paired devices, then reconnect
  5. Go to Settings > System > Audio output and set audio output device to Pi:HDMI, then back again to ALSA OSMC streaming

And now it works. Every step seems crucial to make it work. Is there a simpler way I could try? Or otherwise, can I automate this in some way??
Thanks and keep up the great work!

Hi,

I followed the instructions from the first post on an OSMC 2016-06-02 build running on RP3 and A2DP streaming from mobile device to OSMC HDMI out worked like a charm - thanks a lot for this great feature!

However, I would really like to set it up such that the bluetooth audio is output on Analog jack while Kodi continues to use HDMI for video & audio out. What I gathered going through the forum posts is that these two channels are independent and all that’s required to achieve this is:

amixer cset numid=3 1

However, I realized that amixer is no longer available by default (apparently alsa-utils is not installed as a dependency for the a2dp app). Therefore, I manually installed it, but running the above command still throws the following error:

root@osmc:~# amixer cset numid=3 1
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied
amixer: Control default open error: Connection refused

Can anyone please advise how can I redirect bluetooth audio to Analog out instead of HDMI?

Thanks!

I see a lot of these:

06:59:35 3473.008057 T:1715643376 DEBUG: script.module.osmcsetting.updates : - blurp 268 - MusicVisualisation.xml 06:59:35 3473.220459 T:1617949680 ERROR: CDVDAudio::AddPacketsRenderer - timeout adding data to renderer 06:59:35 3473.220947 T:1617949680 NOTICE: CDVDPlayerAudio::OutputPacket skipping a packets of duration 24 06:59:37 3474.847168 T:1617949680 NOTICE: Previous line repeats 66 times.

Could it be that the Visualisation add-on is killing the audio out to BT…?
(I’m not actually using the Visualisation most of the time, so I’ll try disable it and see)

Thanks.
Best regards,
Niall.

This is how I did it as it would not connect through MYOSMC BT:

after you run
wget http://paste.osmc.io/raw/qiyekuvafe -O- | sudo sh

Make sure the A2DP is in discoverable mode when trying to pair.

In the below it is mac address 7C:1E:52:0B:0D:97. Copy and past that to the pair and connect commands i.e. pair 7C:1E:52:0B:0D:97

(If a pin is required, after the pair command you may need to enter the PIN code quickly on the A2DP and hit enter - within a few seconds.)

From terminal:

bluetoothctl
---->[NEW] Controller 00:15:83:15:A3:10 raspberrypi [default]
---->[NEW] Device 7C:1E:52:0B:0D:97 Microsoft Wedge Mobile A2DP

agent on
---->Agent registered

scan on
---->Discovery started
---->[CHG] Controller Discovering: …
---->
---->[CHG] Device 7C:1E:52:0B:0D:97 P9

pair 7C:1E:52:0B:0D:97
---->Attempting to pair with 7C:1E:52:0B:0D:97
---->[CHG] Device 7C:1E:52:0B:0D:97 Connected: yes

If pin required, otherwise see No Pin require:

[agent] PIN code: 953853
Enter pin quickly on device

No Pin require:
---->[CHG] Device 7C:1E:52:0B:0D:97 Paired: yes
---->Pairing successful
---->[CHG] Device 7C:1E:52:0B:0D:97 Connected: no

trust 7C:1E:52:0B:0D:97

connect 7C:1E:52:0B:0D:97
---->Attempting to connect to 7C:1E:52:0B:0D:97
---->[CHG] Device 7C:1E:52:0B:0D:97 Connected: yes
---->Connection successful

quit
---->Agent unregistered

Hope this helps

Sam,
Lost BT Audio again.
PM’d the logs.

Restarted Kodi, and everything fine again.
sudo systemctl restart mediacenter

Thanks.
Best regards,
Niall.

Hello friend,

I just installed this A2DP packages, it just restart in the middle of installation process. Is this intentional?

Anyway, after the restart. I successfully paired my OSMC with to Windows 7 laptop.

I can play anything on my Win7 laptop and the audio will play on OSMC -> works perfectly

However when I tried to do the reverse (stream sound from OSMC to Win7 laptop), it doesn’t work. I already set the Audio output device to ALSA: OSMC streaming to Bluetooth speaker/headphones. Still no luck so far.

Any idea what I do wrong?

Note :
-. Raspberry Pi 2 Model B
-. Old bluetooth dongle (probably version 2.0)
-. Not sure if related, but just in case. I have a program called SoundWire installed on my OSMC and this program requires me to install these packages :
sudo apt-get install pulseaudio
sudo apt-get install pavucontrol
sudo apt-get install libportaudio2

So it means I already have these packages installed before I run the A2DP command

wget http://paste.osmc.io/raw/qiyekuvafe -O- | sudo sh

The weird things I notice is that I have bunch of option in my Audio output device like PulseAudio, recording, etc before installing A2DP but it’s gone after A2DP is installed. Now the only option I got in Audio output device are

  1. HDMI
  2. Analogue
  3. HDMI and Analogue, and
  4. ALSA: OSMC streaming to Bluetooth speaker/headphones
1 Like

Update:

This has been working fine every day now for nearly a week.
If the BT loses audio, then I can fix it by restarting Kodi.
But it has not lost audio yet this week.

Thanks.
Best regards,
Niall.

Hi anbodearg

Did you test with both Bluetooth dongle and on-board Bluetooth?

I’m only using BT dongle - which works very well.
I gave up on the onboard BT.

Update:

Seems to last for around 5 days.
BT remains connected, but Audio to BT is lost.

Then I restart Kodi, and everything works again.

Thanks.
Best regards,
Niall.

Update:

Audio output to Bluetooth kept going for another 5 days.
Then I tried restart Kodi, but there was no Audio output to Bluetooth option anymore.
I had installed the latest July update a few days ago - which seems to have removed that feature.

So, I re-installed the Bluetooth patch (at the start of this thread).

Now, everything working again.

Thanks.
Best regards,
Niall.

This worked pretty well for me. But I stopped using it since I installed SpotifyConnect. It works perfectly and i can just keep using Spotify on my Phone/tablet/laptop as I am used to. Inside the app, I can select the output device (OSMC). This works really well. Sometimes after I stop playback and start watching something on OSMC, there is no audio, I just reboot, rebooting happens in a few seconds (RPi3). I believe stopping the Spotify Connect service might also do the trick.

I still really like this functionality, my parents use it all day at their house. Not sure if it still works now (haven’t updated their RPi2 for months).

i tried searching with no luck, so does anyone using a TP-LINK branded BT dongle?

I’m having trouble to use one of my bluetooth speakers with the method described in this thread. It seems like the speaker connects properly but no sound is played through it.

When connecting the speaker I get the following error messages in the system journal:

Aug 19 22:59:57 mm pulseaudio[258]: W: [pulseaudio] module-bluez5-device.c: Profile has no transport
Aug 19 22:59:57 mm bluetoothd[270]: a2dp-source profile connect failed for 6C:5A:B5:38:F5:DB: Device or resource busy
Aug 19 22:59:57 mm kernel: input: 6C:5A:B5:38:F5:DB as /devices/virtual/input/input5

However using bluetoothctl I can’t see anything wrong with the device or its connection:

info 6C:5A:B5:38:F5:DB 
Device 6C:5A:B5:38:F5:DB
	Name: Mars by crazybaby
	Alias: Mars by crazybaby
	Class: 0x240414
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	UUID: Vendor specific           (00001107-d102-11e1-9b23-00025b00a5a5)
	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v000ApFFFFdFFFF

The speaker works without trouble on both my phone and Laptop, and another Headphone works fine together with my RPI/OSMC. So I really don’t know whom to blame.
Any ideas on where to start debugging? I wasn’t able to find any useful information about the above mentioned error messages.

Best regards,
Patric

Hi,

a first test worked for me. My conf includes OSMC running on rasberry pi 3 and a bose smartlink mini II.

One issue is that the Samsung TV remote doesn’t apply to the output volume level anymore.

If it normally did this via CEC, then this is not currently expected to work.

Sam

Thanks for the reply Sam!
I’m not at all expert of the CEC tech, but I see it’s a way to control peripherals through HDMI.
Is it just a not implemented feature or the CEC (anynet+ in case of Samsung) doesn’t allow it?