I tried adding the audio-playback interface to my snapcraft.yaml and have the pulseaudio snap installed but I’m not getting audio output via HDMI or the headphone socket on the Raspberry Pi 3. The documentation says that the audio-playback interface auto-connects, but the plug of my application doesn’t seem to have connected to anything.
Do I need to use the alsa interface perhaps? Or is there another staging snap or package I need to install?
I’m not even sure how I would do that? The /snap/bin/pulseaudio.pactl binary only seems to have limited commands and /snap/bin/pulseaudio.pactl upload-sample foo.mp3 fails to open a file I scp to the device. How can I test it?
Ah OK. I noticed that you replaced the pulseaudio interface with the audio-playback interface in the snapcraft-desktop-helpers examples and said that audio-playback now “only manually connects pulseaudio”. So what do I need to do to get audio output from Electron?
Thanks for this suggestion, this got past the alsa.conf error, but then I just had a bunch more errors.
Bingo! Once I added libpulse0 to stage-packages audio output started working.
I have now removed the alsa plug and added both the audio-playback and pulseaudio plugs back and it seems to work. It also seems to autoconnect the pulseaudio plug which is not what the documentation suggests.
This is because that page is talking about the implicit classic slot that you see on classic distro (not Ubuntu Core devices where the interface does not exist unless a snap provides it). The pulseaudio snap is providing the pulseaudio slot, and this snap allows auto-connection of the pulseaudio interface. It doesn’t provide the audio-playback and audio-record interfaces, so its pulseaudio slot was not deprecated.
I realise it’s tricky to document these interfaces when there are differences between implementations, but I’ve added comments on the Supported Interfaces and pulseaudio pages to suggest making this more clear in the documentation.
It also wasn’t obvious to me that I needed to install the pulseaudio snap (and stage the libpulse0 package) for this interface to work on Ubuntu Core.
(I would edit the documentation myself, but I’m not sure what the policy is on documenting differences between implementations as I guess the documentation is supposed to apply to all distros, not just Ubuntu)
this is not core specific, you need to do this for all installations when wanting to talk to pulse … if you use somehing like the gnome-3-xx extensions (like many desktop apps do) it comes for free with the extension though …