Recent

Author Topic: Sending commands to OMXPlayer using TProcess  (Read 3857 times)

saezj

  • New Member
  • *
  • Posts: 10
Sending commands to OMXPlayer using TProcess
« on: March 04, 2016, 09:09:08 pm »
HI:

I use OMXplayer to show videos on a Raspberry PI. I command the player using the following piece of program.

  var
    charac  : String
    Proceso: TProcess

  begin
    Proceso:= TProcess.create (nil);
    Proceso.CommandLine := 'omxplayer '+ PendriveName +'/Videos/vid.flv';
    Proceso.Options:=Proceso.Options+[poUsePipes];
    Proceso.Execute;

    charac:='p';
    If Proceso.Running then Proceso.Input.Write(charac[1], length(charac));


I use a remote control instead of a keyboard. I have no problem to send characters (as 'p', 'q', '+', etc) to the player to command it. But I have no idea how should I send the following "characters" :
[LEFT ARROW]
[RIGHT ARROW]
[UP ARROW]
[DOWN ARROW]

Lazarus 1.7 / FPC 3.0.0 / arm-linux-gtk2



davemaster2018

  • Newbie
  • Posts: 1
Re: Sending commands to OMXPlayer using TProcess
« Reply #1 on: September 27, 2018, 09:47:22 pm »
Greetings,

Try using "--key-config" option, as:

var
   AProcess:TProcess
...

begin
...
  AProcess:=TProcess.create(nil);
AProcess.FreeOnRelease;
AProcess.Executable:='/usr/bin/omxplayer';
AProcess.Options:=AProcess.Options+[poUsePipes];
...
AProcess.Parameters.Add('--key-config');
AProcess.Parameters.Add('/path/to/keyfile'); //        my file dave.cfg
AProcess.Parameters.Add('FileName');
AProcess.Execute;


then, dave.cfg:

EXIT:q
PAUSE:p
DECREASE_VOLUME:-
INCREASE_VOLUME:+
SEEK_BACK_SMALL:b   (instead [LEFT_ARROW])
.....

use any key you want, I replace the arrow keys with other

 

TinyPortal © 2005-2018