Web content not playing simultaneously to NCMPCPP

Hi,
I have just installed mopidy-spotify, and I’m using ncmpcpp to play content from spotify. I love it so far, except there’s one big flaw in my setup;
Whenever ncmpcpp is playing, content in my browsers (tested in latest Chrome and Firefox) will not load. YouTube videos and radio streams just try to load for about 5 seconds, then it gives me an error message like “Something is wrong with your network”, or “Please refresh your browser”.

Pausing the song does not help, but changing to a new song in ncmpcpp results in the web video instantly starting. However, now ncmpcpp is muted! If I want to listen to music again, I have to exit the web site, wait for ~10 seconds, then press play in ncmpcpp.

Can anyone explain to me why this happens?

Here is my mopidy config:

/usr/lib/python2.7/site-packages/mopidy/ext.py:202: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
  extension_class = entry_point.load(require=False)
ERROR    Loading logging config '/etc/mopidy/logging.conf' failed. [Errno 13] Permission denied: '/var/log/mopidy/mopidy.log'
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
debug_file = /var/log/mopidy/mopidy-debug.log
config_file = /etc/mopidy/logging.conf

[audio]
mixer = software
mixer_volume = 
output = autoaudiosink
buffer_time = 

[proxy]
scheme = 
hostname = 
port = 
username = 
password = 

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password = 
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist = 
  listall
  listallinfo
default_playlist_scheme = m3u

[http]
enabled = true
hostname = 127.0.0.1
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = 
csrf_protection = true

[stream]
enabled = true
protocols = 
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist = 
timeout = 5000

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir = /var/lib/mopidy/playlists

[softwaremixer]
enabled = true

[file]
enabled = true
media_dirs = 
  $XDG_MUSIC_DIR|Music
  ~/|Home
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = /var/lib/mopidy/media
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip

[spotify]
enabled = true
username = oveee7
password = ********
client_id = ecce8b3e-93b3-48f8-8ee8-b4e1075d4d5c
client_secret = ********
bitrate = 160
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =

So I’m pretty sure the problem stems from the fact that Mopidy is running system wide, and my PulseAudio is running on my user. I’ve tried the procedure described in the docs where I add
output = pulsesink server=127.0.0.1
to my /etc/mopidy/mopidy.conf, and load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 to my /etc/pulse/default.pa.
However, now I can’t play songs at all, they are just queued in the playlist, and mopidy logs an error like “Track is not playable: spotify:track:02itaCXOdC54J0ISjqqFAp” and “GStreamer error: gst-resource-error-quark: Failed to connect”.

Still troubleshooting though

Did you definitely run the commands to stop and restart pulse (and also Mopidy)? Is this on the latest Ubuntu?

I’ve used pulseaudio --kill and start-pulseaudio-x11 to restart it several times, sudo systemctl restart mopidy to restart mopidy. I’ve also rebooted the computer several times.
I’m using the latest Arch Linux.

Still not sure how to fix the original problem, but I found a workaround that works for me;
Starting the service in user mode roughly following this guide: https://gist.github.com/0x414A/11118592
I guess starting it in --user mode grants it access to the pulseaudio service or something…

That link is dead, I’m having a similar issue. You started pulse in user mode? Or you started mopidy in user mode?

Hi, i started mopidy in user mode
Something like:
Systemctl start --user mopidy

Gotcha thanks. I’ve been tweaking around all day trying to get the visualizer for ncmpcpp to work with mopidy and have had 0 luck so far, I’m using alsa so it’s tougher, but I even installed pulse to try and figure it out and I think that might be messed things up even more so I went back to alsa. Still no visualizer though

try putting this into /etc/mopidy/mopidy.conf

 [audio]
output = tee name=t t. ! queue ! autoaudiosink t. ! queue ! audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/mpd.fifo

I have the following in .ncmpcpp/config

visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "my_fifo"
#depreciated, will be removed in version .10
visualizer_sync_interval = "30"
# can be ellipse, wave or spectrum
visualizer_type = "ellipse" (spectrum/wave)
visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161

ncmpcpp now has support for using the visualizer without a hacky fifo setup, see the Look into adding a gstreamer fifo sink · Issue #775 · mopidy/mopidy · GitHub

Should work regardless of using pulse/alsa/whatever.

1 Like