Reputation: 3104
I have RaspberryPi2 (1GB RAM version) with Raspbian OS. I need to execute Omxplayer for play video. If i execute new process, Omxplayer is on a background. I need Omxplayer always on top. How to do it? Omxplayer has not switch to stay on top as for example mplayer (-ontop).
I found (https://askubuntu.com/questions/7377/how-to-start-an-app-with-always-on-top-set) wmctrl. I tried run java which execute omxplayer and after execute:
ProcessBuilder pb2 = new ProcessBuilder("bash", "-c", "wmctrl -a omxplayer");
Process p2 = pb2.start(); // Start the process.
but not working, probably because JavaFX working with framebuffer, not with the X11. Source: Why does my JavaFx application not have a frame when run on my RaspberryPi?
I am feeling that it is not possible tu run Omxplayer over java in fullscreen on RaspberryPi.
Code for run omxplayer as new process:
public class OmxPlayer {
private int xPosition;
private int yPosition;
private int width;
private int height;
/** Constructor.
*
* */
OmxPlayer (int xPosition, int yPosition, int width, int height) {
this.xPosition = xPosition;
this.yPosition = yPosition;
this.width = width;
this.height = height;
}
public void play(String url){
try {
ProcessBuilder pb = new ProcessBuilder("bash", "-c", "omxplayer -r -o hdmi "+url);
Process p = pb.start(); // Start the process.
Log.write("I am playing file: "+url, Log.ENABLE_STDOUT);
//p.waitFor(); // Wait for the process to finish.
Log.write("File was played.", Log.ENABLE_STDOUT);
} catch (Exception e) {
StringWriter err = new StringWriter();
e.printStackTrace(new PrintWriter(err));
Log.write(err.toString(), Log.ENABLE_STDOUT);
}
}
}
Thank you.
Upvotes: 2
Views: 893