I use a Raspberry Pi 4 as a bluetooth receiver for audio. I set it up with this script and it works well if the connection is initiated through my phone: Click on the name of the raspberry bluetooth, it connects and I can play audio.
When I initiate the connection through bluetoothctl connect xx:xx:xx:xx:xx:xx
, the connection is established as well and playing audio on my phone does not end up on the phone speaker, but the raspberry also does not play the audio. I tried to initiate the connection through dbus using d-feet, but the result is exactly the same.
It appears that the audio is received, but not forwarded to the AUX output. With pactl list
I can see that indeed there are significant differences for the both cases (new sink input, new card, some state changes). So there must be some callback that is executed in the one connection mode and not in the other one.
Seeing that pulseaudio might be a problem, i purged it, as suggested here, but that didn't change the behavior.
I tried to start bluealsa-aplay manually, but got the following when the connection was initiated by the raspberry:
bluealsa-aplay: D: aplay.c:690: Creating PCM worker B0:4A:6A:37:AA:BB
bluealsa-aplay: D: aplay.c:1018: Starting main loop
bluealsa-aplay: E: aplay.c:448: Couldn't open PCM: Device or resource busy
bluealsa-aplay: D: aplay.c:422: Exiting PCM worker B0:4A:6A:37:AA:BB
Any idea how I could solve the problem?
The final goal is to have an auto-connect if my phone is near the Raspberry.