Forum
Bluetooth Headphones - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Hardware (/forum-7.html)
+--- Forum: Video and Audio (/forum-28.html)
+--- Thread: Bluetooth Headphones (/thread-4072.html)



Bluetooth Headphones - degeulars - 5th Jan, 2020 02:55 AM

Hello all,
I have been trying to setup xbian to send audio to bluetooth headphones. I have followed the instructions from this thread. I managed to successfully connect to my headphones. However I don't get any audio coming out of them, just via the HDMI. I haven't got any other audio output available in the settings of kodi. And I can't find any setting to send the audio to that output. Has this changed since 2016 when this tutorial was made? I have tried poking around a bit with PulseAudio, but from what I can see I don't get Kodi to start with PulseAudio, but with ALSA. And from what I can understand bluez-alsa is no longer supported.

Any help would be welcome, thank you all!.

Software
XBian version: Xbian 20191008-0
XBMC/Kodi version: 18.5
Overclock settings: default

Hardware
Device type and model Raspberry Pi Model B 512 MB first gen.
Power supply rating: 2A
SD card size and make/type: 8gb
Network (Ethernet or wireless): Ethernet
Connected devices (TV, USB, network storage, ...): TV via HDMI and USB Bluetooth dongle Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)


RE: Bluetooth Headphones - Nachteule - 8th Jan, 2020 02:15 AM

Yes, seems that its not longer working

Try to start PA manually before starting Kodi by

Terminal

sudo /usr/bin/pulseaudio --system --log-target=syslog &

Then you can use PA inside of Kodi.

Just tested and its working


RE: Bluetooth Headphones - deHakkelaar - 10th Jan, 2020 10:01 AM

Only need to run PA with xbian user privies:

Terminal
xbian@avr ~ $ ps -o user,cmd -C kodi.bin
USER CMD
xbian /usr/local/lib/kodi/kodi.bin --standalone -fs --lircdev /run/lirc/lircd

I believe in the past, I added something like below to /etc/rc.local to have PA started before the xbian user logs in:

Code:
sudo -u xbian '/usr/bin/pulseaudio --start'

Could change it into more specific one from @Nachteule:

Code:
sudo -u xbian '/usr/bin/pulseaudio --start --system --log-target=syslog'

And add the /usr/bin/pulseaudio command to the sudoers list of commands in below file:

Terminal
xbian@avr ~ $ sudo cat /etc/sudoers.d/xbian
xbian ALL=(ALL) NOPASSWD: /sbin/initctl, /usr/local/sbin/xbian-config, /sbin/halt, /sbin/reboot, /usr/bin/splash, \
/usr/bin/renice, /sbin/start, /sbin/stop, /sbin/status, /bin/fuser, /sbin/restart, /usr/bin/pkill, /usr/sbin/btrfs-auto-snapshot, \
/bin/mount, /bin/umount, /bin/kill, /usr/local/sbin/splash-daemon, /bin/rm -fr /run/splash/splash.pid, /bin/mkdir -p -m 777 /run/splash, \
/usr/bin/setterm, /usr/bin/pulseaudio

Defaults env_keep+=http_proxy
Defaults env_keep+=LD_LIBRARY_PATH
Defaults env_keep+=LD_PRELOAD

What I miss in the instructions thread is selecting BT profile.
It could be that your headset defaults to low quality output profile with a mic input when connected at first.
You want to have the a2dp profile/sink (if headset supports) to get best quality.
Below ones might be useful once headset connected:

Code:
pacmd list-cards

pactl list cards

pactl list cards short

pactl list sinks

pactl list sinks short

For my Bose BT speaker, I had to do below to get the a2dp profile/sink activated:

Code:
pacmd set-card-profile bluez_card.00_0C_8A_XX_XX_XX a2dp_sink

pacmd set-default-sink bluez_sink.00_0C_8A_XX_XX_XX.a2dp_sink

Test with below:

Code:
pacat --list-file-formats

pacat < /dev/urandom

pacat --file-format=wav <A_RANDOM_WAV_FILE>

EDIT: added sudoers.


RE: Bluetooth Headphones - namarang - 21st Feb, 2021 06:43 AM

If you forward/reverse your video at kodi many times, the sound might stop even if the app is in call with kodi. If it happens, try play/pause video a couple of times and you should have the sound back.