One is connected to a touch screen and is the 'Parent's' pi.
One has sensors connected to it and a bluetooth speaker. This is the 'Baby's' Pi
The other is just a dedicated camera pi with MotionEyeOS on it.
I've made a web interface on a local server to work with using Apache and PHP.
There is a bank of 3 mp3 files to choose from to play a lullaby in the baby's crib via the bluetooth speaker.
I'm using mpg123 player to play these as I cannot solve the problem with X11 forwarding pertaining to VLC player.
Note: I do have pulse audio, pavucontrol, blueman installed and my speaker automatically connects upon startup and works.
When I test out music in my terminal on mpg123 it plays out of the bluetooth speaker loud and proud.
Code: Select all
mpg123 -C /var/www/Lullabies2/twinkle.mp3CODE FOR BUTTONS
Code: Select all
<form name="update" method="post">
<p style="text-align:center;">
<button name="Twinkle" type="submit" style="align:center; background:white; font-family:Bradley Hand ITC;font-weight:bolder;font-size:21px; color:crimson; background-color: whitesmoke; border: 3pt ridge lightskyblue;border-radius:10px;cursor:pointer; margin-top:10px">Twinkle Twinkle, Little Star</button>
</p>
<p style="text-align:center;">
<button name="Rockabye" type="submit" style="align:center; background:white; font-family:Bradley Hand ITC;font-weight:bolder;font-size:21px; color:crimson; background-color: whitesmoke; border: 3pt ridge lightskyblue;border-radius:10px;cursor:pointer; margin-top:14px">Rockabye, Baby</button>
</p>
<p style="text-align:center;">
<button name="Lullaby" type="submit" style="align:center; background:white; font-family:Bradley Hand ITC;font-weight:bolder;font-size:21px; color:crimson; background-color: whitesmoke; border: 3pt ridge lightskyblue;border-radius:10px;cursor:pointer; margin-top:14px">Lullaby and Goodnight</button>
</p>
<p style="text-align:center;">
<button name="STOPMUSIC" type="submit" style="align:center; background:white; font-family:Bradley Hand ITC;font-weight:bolder;font-size:18px; color:crimson; background-color: black; border: 3pt ridge whitesmoke;cursor:pointer; margin-top:14px">STOP MUSIC</button>
</p>
</form>
PHP CODE
Code: Select all
<?php
ini_set('dsplay_errors', '1');
if (isset($_POST['Twinkle']))
{
shell_exec("mpg123 -C /var/www/Lullabies2/twinkle.mp3 2>&1");
}
if (isset($_POST['Rockabye']))
{
shell_exec("mpg123 -C /var/www/Lullabies2/rockabyebaby.mp3 2>&1");
}
if (isset($_POST['Lullaby']))
{
shell_exec("mpg123 -C /var/www/Lullabies2/lullabygoodnight.mp3 2>&1");
}
if (isset($_POST['STOPMUSIC']))
{
echo shell_exec("pkill mpg123");
}
?>