For a tool, which executes a configurable command when a bluetooth device connects, see repository https://github.com/joleuger/bluetooth-manager. It can be used to play an icecast stream.
> apt-get install libpam-systemd
> apt-get install pulseaudio gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-tools mpv
> apt-get install bluetooth bluez bluez-tools bluez-firmware pulseaudio-module-bluetooth
> adduser audioclient
> vim /etc/shadow (remove password)
> usermod -a -G bluetooth audioclient
> usermod -a -G audio audioclient
> udevadm control --reload
> udevadm trigger
Reason: The file /etc/dbus-1/system.d/bluetooth.conf
requires it.
Quote:
<!-- allow users of bluetooth group to communicate with hcid -->
<policy group="bluetooth">
<allow send_destination="org.bluez"/>
</policy>
> ssh-keygen -t rsa -b 4096 -C "audioclientx"
> mkdir /home/audioclient/.ssh
> cat id_rsa.pub >> /home/audioclient/.ssh/authorized_keys
> chown -R audioclient:audioclient /home/audioclient/.ssh
> ssh -l audioclient localhost
> cd
> mkdir .config/
> mkdir .config/systemd/
> mkdir .config/systemd/user
> mkdir .config/pulse
> cp /etc/pulse/default.pa /home/audioclient/.config/pulse/default.pa
> cp /etc/pulse/daemon.conf /home/audioclient/.config/pulse/daemon.conf
test
> mpv http://$$$IP-ADDRESS$$$:8000/egofm.mp3
Add to file /home/audioclient/.config/pulse/daemon.conf
default-script-file = /home/audioclient/.config/pulse/default.pa
Add to file /home/audioclient/.config/pulse/default.pa
load-module module-null-sink rate=44100 channels=2 sink_name=every_local_output
set-default-sink every_local_output
load-module module-loopback source=every_local_output.monitor sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo
#disable: load-module module-suspend-on-idle
Add files dbus.service
dbus.socket
audioserver_pulseaudio.service
to .config/systemd/user
(adapt audioserver->audioclient)
> systemctl --user enable dbus.socket
> systemctl --user enable audioclient_pulseaudio.service
> systemctl --user start audioclient_pulseaudio.service
> exit
> loginctl enable-linger audioclient
> systemctl disable lightdm
> systemctl disable mpd.socket
> systemctl disable mpd.service
> mkdir /home/audioclient/.config/mpd
Mdp
> cp /etc/mpd.conf /home/audioclient/.config/mpd/mpd.conf
> chown -R audioclient:audioclient /home/audioclient/.config
> mkdir /var/log/mpd
> chown -R audioclient:audioclient /var/lib/mpd
> chown -R audioclient:audioclient /var/log/mpd
> ssh -l audioclient localhost
> vim /home/audioclient/.config/mpd/mpd.conf (disable line user; pulse:disable localhost; disable log_file; disable pid_file)
> systemctl --user enable audioclient_mpd
> reboot
Snapclient (currently without pulse and bluetooth)
x64:
> apt-get install libasound2 libvorbis0a libogg0 libflac8 alsa-utils libavahi-client3 avahi-daemon
> wget https://github.com/badaix/snapcast/releases/download/v0.10.0/snapclient_0.10.0_amd64.deb
> dpkg-deb -x snapclient_0.10.0_amd64.deb snapclient_extracted
> cp snapclient_extracted/usr/sbin/snapclient /usr/local/bin/
> rm -rf snapclient_extracted
raspberry
> apt-get install libasound2 libvorbis0a libogg0 libflac8 alsa-utils libavahi-client3 avahi-daemon
> wget https://github.com/badaix/snapcast/releases/download/v0.10.0/snapclient_0.10.0_armhf.deb
> dpkg-deb -x snapclient_0.10.0_armhf.deb snapclient_extracted
> cp snapclient_extracted/usr/sbin/snapclient /usr/local/bin/
> rm -rf snapclient_extracted
Dependencies of packacke: > dpkg -I snapclient_0.9.0_armhf.deb
systemctl --user enable audioclient_snapcast.service
systemctl --user start audioclient_snapcast.service
Bluetooth (initial)
> ssh -l audioclient localhost
> bluetoothctl
# scan on
# pairable on
# connect 00:1D:DF:A1:45:03 (address of bluetooth hw)
# exit
> pactl list
> pactl load-module module-loopback source=every_local_output.monitor sink=bluez_sink.00_1D_DF_A1_45_03
Note to Bluetooth: Works, but "connect 00:1D:DF:A1:45:03" must be called every time and "pactl load-module module-loopback...bluez_sink.00_1D_DF_A1_45_03". On disconnect module-loopback is remapped to different sink (thus echo). Module must be removed. TODO: Automate, see https://gist.github.com/joergschiller/1673341/) https://gist.github.com/Toasty27/8406352
enable bluetooth clients
pulsesrc device=broadcast_on_lan.monitor ! pulsesink device=bluetooth...