运行omxplayer";“永远在最上面”;来自java代码
我有带Raspbian操作系统的Raspberryp2(1GB RAM版本)。我需要执行Omxplayer来播放视频。若我执行新进程,Omxplayer就在后台。我需要Omxplayer始终在顶部。怎么做?Omxplayer并没有像mplayer(-ontop)那样切换到顶部 我找到了()wmctrl。我尝试运行执行omxplayer的java,然后执行:运行omxplayer";“永远在最上面”;来自java代码,java,raspbian,always-on-top,omxplayer,Java,Raspbian,Always On Top,Omxplayer,我有带Raspbian操作系统的Raspberryp2(1GB RAM版本)。我需要执行Omxplayer来播放视频。若我执行新进程,Omxplayer就在后台。我需要Omxplayer始终在顶部。怎么做?Omxplayer并没有像mplayer(-ontop)那样切换到顶部 我找到了()wmctrl。我尝试运行执行omxplayer的java,然后执行: ProcessBuilder pb2 = new ProcessBuilder("bash", "-c", "wmctrl -a omxpl
ProcessBuilder pb2 = new ProcessBuilder("bash", "-c", "wmctrl -a omxplayer");
Process p2 = pb2.start(); // Start the process.
但不起作用,可能是因为JavaFX使用的是帧缓冲区,而不是X11。资料来源:
我觉得不可能在RaspberryPi上全屏运行Omxplayer
将omxplayer作为新进程运行的代码:
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);
}
}
}
多谢各位