josephjo
Posts: 1
Joined: Sun Nov 10, 2019 6:18 pm

Problem with streaming ALSA with script.

Sun Nov 10, 2019 6:26 pm

Hi,

I created a webserver using apache and php on the raspberry. Would like to stream the USB mic or webcam mic attached to the raspberry to the user accessing the server.

I tried using arecord -D plughw:1,0 -f dat | ssh -C [email protected] aplay -f dat on the command line it works perfectly.
I tried created a bash script where I would sh the file on the command line it works well.
I tried manually "php audio.php" on the command line it works.

But when I tries opening with a php script from the client browser. it seems to have problem, it doesn't work.

Code: Select all

<?php
shell_exec('arecord -D plughw:1,0 -f dat | ssh -C [email protected] aplay -f dat');

?>
or

Code: Select all

<?php
shell_exec(''sh audio.sh');

?>
Does anyone knows how can I solve this?

Return to “Graphics, sound and multimedia”