Sending a keystroke in progress

I want to write a separate program that can receive commands from the network and play these commands before omxplayer . omxplayer is a video player on raspberry pi, we can control omxplayer with a keystroke. Can someone suggest some approaches that we can send a keystroke event to the current process?

Any suggestions are welcome. Thank you

+6
source share
1 answer

You can use FIFO to send keystrokes to omxplayer.

We will show you a basic example of how you do this.

In the shell (terminal 1),

 mkfifo /path/to/dir/fifo omxplayer /path/to/movie/dir/movie.ext < /path/to/dir/fifo 

after executing these commands, terminal 1 will hold.

Now in terminal 2

 echo -n . > /path/to/dir/fifo 

Now it will start playing.

This was a basic example. You can create a php file to write to a fifo file. This way you can send commands.

p pauses

q will stop

also, if you use non-letter commands (for example, the up arrow and the down arrow), you must send the correct key code.

Hope this helps.

+6
source

Source: https://habr.com/ru/post/953846/


All Articles