I setup Mopidy playing a local file to /tmp/snapfifo as per the readme.
It works beautifully, I tested it with two snapclients (one on Android, one on the same machine).
However, if I pause Mopidy then the snapclients seem to start from the beginning of the /tmp/snapfifo file.
To test this theory, I zero-d out /tmp/snapfifo after pausing and that served as a workaround.
Is snapcast designed to work like this or am I using it wrong? I would have thought pausing the stream should output silence on the clients but I'm no expert.
Thanks
I had a similar problem when I started working with snapcast. (see #75)
This happens when the fifo is not created by the snapserver but by another program (MPD in your case).
Somehow the fifo is not a real fifo then, but a regular file, so that played chunks are not deleted after playback and the Snapserver starts at the beginning when no new chunks are added by the source. You can propably also see that the /tmp/snapfifo file grows infinitely as you keep playing. This shouldn't happen with a real fifo.
The solution for me was pretty easy:
Delete the fifo, terminate MPD and Snapserver and then restart Snapserver, wait till it is loaded and then start MPD.
@1337sup3rh4x0r Thanks so much, that was the reason! This was also helpful to note (from the fifo(7) manpage):
FIFO special files can be created by mkfifo(3), and are indicated by ls -l with the file type 'p'.
@badaix Could you incorporate this sage piece of advice into the README under the MPD/Mopidy sections?
Something like this?
Mopidy can stream the audio output into the Snapserver's fifo with a filesink as audio output in mopidy.conf:
[audio]
#output = autoaudiosink
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo
Please make sure that the snapfifo file is not created by Mopidy, as Mopidy will create a regular file /tmp/snapfifo instead of a fifo. This will cause Snapcast to play from the beginning if you pause Mopidy.
Solution is to create the fifo manually with mkfifo /tmp/snapfifo or to start the Snapserver before Mopdy is started.
it's added now to the Readme
Yes, that is a good addition to the Readme!
However this problem is not exclusive to Mopidy. To me it happened with Spotify-Connect-Web and if I recall correctly, I think also MPD showed the same behaviour. So maybe this hint could be moved to a different section of the readme.
Most helpful comment
I had a similar problem when I started working with snapcast. (see #75)
This happens when the fifo is not created by the snapserver but by another program (MPD in your case).
Somehow the fifo is not a real fifo then, but a regular file, so that played chunks are not deleted after playback and the Snapserver starts at the beginning when no new chunks are added by the source. You can propably also see that the /tmp/snapfifo file grows infinitely as you keep playing. This shouldn't happen with a real fifo.
The solution for me was pretty easy:
Delete the fifo, terminate MPD and Snapserver and then restart Snapserver, wait till it is loaded and then start MPD.