diff --git a/index.js b/index.js index 7437f24..b55c46a 100755 --- a/index.js +++ b/index.js @@ -138,8 +138,7 @@ app.post("/select", (req, res) => { }); app.post("/playoverlay", (req, res) => { - let video = fs.readFileSync('/overlayvideo'); - require('child_process').spawn('ffplay', ['-fs', '-autoexit', '-hide_banner', '-loglevel', 'error', video]); + require('child_process').spawn('/home/pi/video-player/play-overlay.sh'); res.json({ status: 'ok' }); }); @@ -179,11 +178,5 @@ app.post('/upload', function (req, res) { } }); - try { - require('child_process').spawn('sudo', ['systemctl', 'restart', 'video-player2.service']); - } catch (error) { - console.error(error); - } - res.redirect('/'); }); diff --git a/play-overlay.sh b/play-overlay.sh index 8cacac7..990a4b8 100755 --- a/play-overlay.sh +++ b/play-overlay.sh @@ -1,5 +1,9 @@ #!/bin/bash +/home/pi/video-player/relay-on.sh & + export DISPLAY=:0 ffplay -fs -autoexit $(cat /overlayvideo) + +/home/pi/video-player/relay-off.sh & diff --git a/public/index.html b/public/index.html index 834841a..1d4c73c 100755 --- a/public/index.html +++ b/public/index.html @@ -39,6 +39,22 @@
+