0

I want to be able to play a video on my Raspberry Pi and control it from my phone. After looking into this I decided to use a SSH connection and then play a video from a link using OMXPlayer. At first I used a session.openChannel("exec"); channel to send the command which would look like omxplayer '[link]' However, after looking around I found that the exec channel can only really execute a single command or a chain of commands as shown here, this is not suitable as I need to be able to pause at any time. So instead I used the shell channel. As a test I just used the default Input and Output streams.

Note: I'm using JSch for the SSH

try {

        JSch jsch = new JSch();
        Session sesh = jsch.getSession("pi", "***.***.***.***", 22);
        java.util.Properties config = new java.util.Properties(); 
        config.put("StrictHostKeyChecking", "no");
        sesh.setConfig(config);
        sesh.setPassword("*");
        sesh.connect(3000);
        Channel chan = sesh.openChannel("shell");

        chan.setInputStream(System.in);
        chan.setOutputStream(System.out);
        chan.connect(3000);
    } catch(Exception e) {

        e.printStackTrace();
    } 

This code opens up a semi functioning shell which I can use to execute the command, and the video plays however, the hot keys (space = play/pause, q = exit, left arrow = seek back, right arrow = seek forward) do not work I have tried just pressing the key as you would in a normal shell and pressing the key and enter just as a test but neither worked. So the question is does anyone know how to get the hot keys working in the shell channel? Or does anyone know how to get the hotkeys working with the exec channel the way I need it to with JSCH?

Any help is appreciated.

Community
  • 1
  • 1
Dan13_
  • 193
  • 1
  • 2
  • 16

0 Answers0