I currently have an Apache web server running on my Pi that has this as the index.php file:
<?php
if (isset($_GET['play'])) {
exec('sudo omxplayer yes.m4a');
}
?>
However, my code doesn't work! When I visit the page, nothing happens on my Pi. I know that exec does work, because when I use another command such as li, I get an output. Is there any error(s) in my code?
Whenever someone visits the webpage with the url, say, 10.0.1.23/?play=1, I want the Pi to run my audio file. I have been looking for what feels like forever, but to no avail.
If this is not possible for any reason (although I am almost sure it is), then what would be the easiest way to do this? I need to have my audio file get executed from another computer with minimal delay, as this is for my lab where, as long as it's consistent, a 1/4 of a second delay would be fine.
Edit: I have tried running the web server on my mac with the same code, only instead of sudo omxplayer yes.m4a I used say test and it seemed to have worked fine. Still not sure why my Pi isn't running my audio.