loginek0
Posts: 16
Joined: Fri Mar 13, 2015 7:11 am

omxplayer change the video file using the keyboard

Fri Mar 13, 2015 7:24 am

I use the Raspberry Pi and the player omxplayer. I would like to RaspbperyPi play movies in a loop from the specified folder. With this I have no problem. Here my code:

Code: Select all

#!/bin/sh
VIDEOPATH="/mnt/storage/videos"

SERVICE="omxplayer"
while true; do
    if ps ax | grep -v grep | grep $SERVICE > /dev/null
    then
    sleep 1;
else
    for entry in $VIDEOPATH/*
    do
            clear
            omxplayer $entry --no-keys > /dev/null
    done
fi
done
And it works. I have a keyboard connected to it. I want to see when you press eg. "5" I Raspbpery PI launched a video file "5.mp4" (eg key. "8" - file "8.mp4"). Unfortunately omxplayer not support such a switch between files, so I turned off the keyboard listening (parameter: --no-keys).
How, then, to modify this code to loop during playback you can quickly switch to another file?

brigi01
Posts: 1
Joined: Tue Oct 13, 2015 5:07 am

Re: omxplayer change the video file using the keyboard

Tue Oct 13, 2015 5:09 am

Hi,
did you ever find a solution? I have the same problem.

Thank you!

Return to “Media centres”