Spotify does not play audio

The [community] package is outdated, but we cannot update it at this time. Please stick to snapd-git from AUR.

not sure about arch, its just it doesnot even open on Xubuntu 17.10

@attache If you run it in the terminal (e.g. via snap run spotify), what messages (if any) do you get? Could you please paste them here so that we can analyse this further?

it works now, it just didn’t work yesterday.

now I cannot even remember my p/word.

so christmas is gonna be grimm.

After some discussions in the IRC, snapd is looking at /run/user/1000/snap.spotify/pulse/native for the socket which is not available. Instead of looking at /run/user/1000/pulse/native, it tries /var/run/pulse/native and fails. @mvo suggested creating a symlink to check if it indeed fixes the issue. This workaround fixes the issue so the problem is snapd not looking in the correct directory for the socket. Thanks for the help @mvo and @mborzecki!

To give more detail on the matter at hand:

  • $XDG_RUNTIME_DIR is set to /run/user/1000/snap.spotify inside the snap
  • libpulse tries pulse socket locations in the following order: $XDG_RUNTIME_DIR/pulse/native, /var/run/pulse/native
  • pulse socket is not available in either location

Surprisingly it works on my system, the logs show that instead of trying $XDG_RUNTIME_DIR/pulse/native libpulse goes to {55f76458585f45adb352cdec85634ded}unix:/run/user/1000/pulse/native, as if $XDG_RUNTIME_DIR was completely ignored.

This should do the trick:

--- spotify.orig/bin/desktop-launch	2017-11-28 23:24:55.000000000 +0100
+++ spotify/bin/desktop-launch	2017-12-21 12:43:42.987532058 +0100
@@ -145,6 +145,18 @@ if [ -n "$XDG_RUNTIME_DIR" ]; then
     fi
 fi
 
+if [ -n "$XDG_RUNTIME_DIR" ]; then
+    pulsenative="pulse/native"
+    pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
+    pulseaudio_snappath="$XDG_RUNTIME_DIR/$pulsenative"
+    if [ -S "$pulseaudio_sockpath" ]; then
+        if [ ! -e "$pulseaudio_snappath" ]; then
+            mkdir -p -m 700 $(dirname "$pulseaudio_snappath")
+            ln -s "$pulseaudio_sockpath" "$pulseaudio_snappath"
+        fi
+    fi
+fi
+
 # GI repository
 export GI_TYPELIB_PATH=$RUNTIME/usr/lib/girepository-1.0:$RUNTIME/usr/lib/$ARCH/girepository-1.0
 [ "$WITH_RUNTIME" = yes ] && GI_TYPELIB_PATH=$SNAP/usr/lib/gjs/girepository-1.0:$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0 # add local SNAP assets if a runtime is used

@mborzecki Please can you submit that as a pull request to the desktop helpers. Then @kenvandine and @jamesh can review it :slight_smile:

PR right here:

3 Likes

Curious… why does it work for everybody else?

Works for me too, but I have no clue how libpulse obtains this address:

IIRC, pulse can also find the socket via an X property on the X11 root window.

I can confirm the patch works. Thanks for walking me through on how to apply the patch :slight_smile:

I think the PR looks fine, but I don’t know enough about pulse to feel comfortable approving it. I’ve asked @jamesh to look at the PR.

1 Like

I had the same problem in Chromium.

$ snap info chromium --verbose
name:      chromium
summary:   Chromium web browser, open-source version of Chrome
publisher: canonical
contact:   https://forum.snapcraft.io/
description: |
  An open-source browser project that aims to build a safer, faster, and more
  stable way for all Internet users to experience the web.
snap-id: XKEcBqPM06H1Z7zGOdG5fbICuf8NWK5R
commands:
  - chromium
notes:               
  private:           false
  confinement:       strict
  devmode:           false
  jailmode:          false
  trymode:           false
  enabled:           true
  broken:            false
  ignore-validation: false
tracking:            stable
installed:           62.0.3202.94 (128) 147MB 
refreshed:           2017-11-16 13:38:05 +0100 CET
channels:                                
  stable:            62.0.3202.94  (128) 147MB -
  candidate:         63.0.3239.108 (192) 164MB -
  beta:              64.0.3282.39  (205) 168MB -
  edge:              65.0.3298.3   (201) 168MB -

Starting by default gave me the ALSA problem:

$ which chromium
/snap/bin/chromium
$ chromium
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[20729:20729:0112/001149.575987:ERROR:desktop_window_tree_host_x11.cc(1880)] Not implemented reached in void views::DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState)
[20729:20729:0112/001149.586112:ERROR:desktop_window_tree_host_x11.cc(1880)] Not implemented reached in void views::DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState)
[1:22:0112/001154.986990:ERROR:adm_helpers.cc(62)] Failed to query stereo recording.
ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib conf.c:3750:(snd_config_update_r) Cannot access file /usr/share/alsa/alsa.conf
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM plug:default
[1:22:0112/001234.851449:ERROR:stunport.cc(88)] Binding request timed out from 0.0.0.x:39313 (any)

Using the right debug flags I got:

$ PULSE_LOG=4 SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 chromium
<snip>
Parsing configuration file '/etc/pulse/client.conf'
/etc/pulse/client.conf.d does not exist, ignoring.
Using shared memory pool with 1024 slots of size 64,0 KiB each, total size is 64,0 MiB, maximum usable slot size is 65472
Trying to connect to /run/user/1000/snap.chromium/pulse/native...
connect(): No such file or directory (2)
Trying to connect to /var/run/pulse/native...
connect(): No such file or directory (2)

As I can’t really modify the desktop-launch script I created a link which solved my issue (of course, it currently requires me to redo that after any boot):
$ sudo ln -s /run/user/1000/pulse/native /run/user/1000/snap.chromium/pulse/
With that I can now use hangouts and youtube without issues.

So, the pending questions is, where should this be reported?

1 Like

by some bizarre workings on my chrome-browser when I click on spotify community page

& then click on web-player,

I can still access my web-interface, although I don’t know why @popey ??

drum-roll - I have spotify.

sorry if this is’t the right way to do it.

although - all I hear is silence is a touch of very little.

As mentioned earlier in this thread, we landed a change to snapcraft-desktop-helpers to fix problems with apps finding the PulseAudio socket (we settled on setting an environment variable rather than the symlink though). Unfortunately this requires snaps using the cloud part to be rebuilt.

Looking at the build numbers for chromium, the stable channel build seems a lot older than the others (128 for stable vs. 192 for candidate), so I wonder if it was build prior to the snapcraft-desktop-helpers fix? Perhaps you could try one of the newer releases with a command like:

snap refresh --channel=candidate chromium

… and see if that fixes the problem.

Via the X11 root window

Thanks, I saw there were new versions but haven’t tried then until today. The candidate still had the same issues, but Chromium beta did work.

For future reference, there are the current versions:

$ snap info chromium
<snip>
channels:                        
  stable:    62.0.3202.94  (128) 147MB -
  candidate: 63.0.3239.108 (192) 164MB -
  beta:      64.0.3282.39  (205) 168MB -
  edge:      65.0.3298.3   (201) 168MB -
1 Like

@mvo somewhere in charlotte, carolina - there is someone playing Spotify

but I cannot.

Here is your paste cut .

colors- red, black green blue.