I'm trying to play music on a web browser using mpg123. I use Apache as the web server on a Raspberry Pi ZH with no audio devices on it as I don't need any sound to come out of the Raspberry but to play the sound in the computer that connects to the web my Raspberry Pi is serving.
When accessing to the web page, a CGI-script executes on the server and runs mpg123 ../music/audio1.mp3 but no music sounds.
Looking at the logs I can see the following output from mpg123:
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.26.4; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Decoder: generic
Trying output module: alsa, device: <nil>
Trying output module: oss, device: <nil>
Trying output module: jack, device: <nil>
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Trying output module: portaudio, device: <nil>
Segmentation fault
As you can see, the program fails with a Segmentation fault error.
Debugging the execution of mpg123 music/audio1.mp3 I saw it fails here:
openat(AT_FDCWD, "/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 ENODEV (No such device)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xb67eacf0} ---
+++ killed by SIGSEGV +++
Segmentation fault
Any clue on how can I make this work and play music through the browser?