Access denied on capture data from audio device

I have snap with audio alsa/pusleaudio capture. I tried to debug snap with --debug and inside shell I have:

gst-launch-1.0 pulsesrc device=alsa_input.usb-Focusrite_Scarlett_2i2_USB-00.analog-stereo ! fakesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect stream: Access denied
Additional debug info:
pulsesrc.c(1622): gst_pulsesrc_prepare (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
Execution ended after 0:00:00.000104717
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

In understand I should to run my app under root user or add user to audio group, but as far as I know this is not supported on snap. How can I resolve this issue?

Also I tried many plugs:

apps:
  mysnap:
    plugs:
      - spi
      - uio
      - i2c
      - iio
      - io-ports-control
      - uhid
      - hidraw
      - alsa
      - pulseaudio
      - audio-playback
      - audio-record
      - desktop
      - desktop-legacy
      - x11
      - unity7
      - home
      - network
      - network-bind
      - opengl
      - hardware-observe
      - raw-usb
      - kernel-module-observe
      - removable-media

Thanks!

Is the audio-record plug connected?

Now connected :slight_smile: and mysnap works fine. Thank you very much for support. I do not fully understand from the documentation, will the audio-record be automatically connected to the user system after installation?

Thanks!

No, audio-record is not automatically connected.

When your snap is ready, you can request auto-connection of the interface via the store-requests category on this forum.

As you can imagine, allowing untrusted applications to record sounds has far greater privacy implications compared to letting untrusted applications make sounds. If recording audio is part of the primary purpose of your app and users would expect it to do so, then it is likely that your request will be granted.

1 Like

Ok. Thank you for explanation guys.

1 Like