Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行omxplayer";“永远在最上面”;来自java代码_Java_Raspbian_Always On Top_Omxplayer - Fatal编程技术网

运行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

我有带Raspbian操作系统的Raspberryp2(1GB RAM版本)。我需要执行Omxplayer来播放视频。若我执行新进程,Omxplayer就在后台。我需要Omxplayer始终在顶部。怎么做?Omxplayer并没有像mplayer(-ontop)那样切换到顶部

我找到了()wmctrl。我尝试运行执行omxplayer的java,然后执行:

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);
        }
    }
}
多谢各位