I want to write a seperate program that can receive commands from network and replay these commands to omxplayer
. omxplayer
is the video player on raspberry pi, we can control omxplayer
via the keystroke. May anyone please suggest some approaches that we can send keystroke event to a running process?
Any suggestions are appreciated. Thanks!
You can use FIFO to send keystrokes to omxplayer.
We'll show you a basic example of how you do it.
In Shell (Terminal 1),
mkfifo /path/to/dir/fifo
omxplayer /path/to/movie/dir/movie.ext < /path/to/dir/fifo
after you execute these commands, the terminal 1 will hold.
Now in terminal 2
echo -n . > /path/to/dir/fifo
now it will start play.
This was the basic example. You can create a php file to write to the fifo file. So from that you can send commands.
p will pause
q will quit
also, when using non-letter commands (like up arrow, and down arrow), you should send the correct key code.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With