I'm using a Raspberry pi zero with a Bluetooth dongle and I'm trying to play an mp3 file to a Bluetooth speaker. I managed to get them both connected after a lot of trying, this is the full list of commands I execute to get everything working:
rfkill unblock 0 sudo hciconfig hci0 up sudo hciconfig hci0 piscan pulseaudio -k pulseaudio -D bluetoothctl -a scan on connect 30:95:E3:95:46:F7 exit
To now stream the audio to the speaker I'm using the following gstreamer command:
gst-launch-1.0 filesrc location=song.mp3 ! pulsesink device=bluez_source.30_95_E3_95_46_F7
And that results in the following error:
pi@raspberrypi:~ $ gst-launch-1.0 filesrc location=song.mp3 ! pulsesink device=bluez_source.30_95_E3_95_46_F7 Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ERROR: from element /GstPipeline:pipeline0/GstPulseSink:pulsesink0: The stream is in the wrong format. Additional debug info: gstaudiobasesink.c(1119): gst_audio_base_sink_preroll (): /GstPipeline:pipeline0/GstPulseSink:pulsesink0: sink not negotiated. ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ...
song.mp3 is a normal audio file, I can play it just fine with my phone, vlc and windows media player. The speaker also works fine with my phone.
What can I do to solve this issue?