运行 cmd 命令行以控制 VLC

huangapple 未分类评论56阅读模式
英文:

Run cmd command line to control VLC

问题

我正在尝试在 Windows 8.1 命令行上运行“暂停10秒钟”命令,以暂停当前打开的 VLC。

我已经打开了 VLC,并在其中运行了 video.mp4 文件,5秒后应该暂停 video.mp4 文件10秒。

以下是我的代码:

public class VlcControl {
    @Override
    public void start(Stage primaryStage) {
        try {
            manipulateVLC("rotate"); // 在 VLC 上打开 video.mp4
            Thread.sleep(5000); // 让视频运行 5 秒钟
            manipulateVLC("enterd"); // 暂停视频
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }

    public void manipulateVLC(String tachesysteme) throws IOException {
        ProcessBuilder processBuilder = new ProcessBuilder();
        if (tachesysteme.equals("rotate")) {
            processBuilder.command("cmd.exe", "/c", "vlc C:\\video.mp4");
            processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));
            processBuilder.redirectErrorStream(true);
            processBuilder.start();
        } else if (tachesysteme.equals("translate")) {
            processBuilder.command("cmd.exe", "/c", "TASKKILL /IM vlc.exe");
            processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));
            processBuilder.redirectErrorStream(true);
            processBuilder.start();
        } else if (tachesysteme.equals("enterd")) {
            processBuilder.command("cmd.exe", "/c", "vlc vlc://pause:10");
            processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));
            processBuilder.redirectErrorStream(true);
            processBuilder.start();
        }
    }
}

“暂停”命令对我不起作用,非常感谢任何帮助。我正在使用 VLC 3.0.11。

英文:

I am trying to run the command Pause for 10 seconds on the currently opened vlc on Windows8.1 command line.

I opened the vlc and run video.mp4 file on it and after 5 seconds it's supposed to pause the video.mp4 for 10 seconds.

here is my code

public class VlcControl {
@Override
public void start(Stage primaryStage) {
	try {			
		manipulateVLC("rotate");//open video.mp4 on vlc
        Thread.sleep(5000);//let the video run for 5 seconds 
        manipulateVLC("enterd");//pause the video 
	
	} catch(Exception e) {
		e.printStackTrace();
	}
}

public static void main(String[] args) {
	launch(args);
}	
    

public void manipulateVLC(String tachesysteme) throws IOException {
    ProcessBuilder processBuilder = new ProcessBuilder();
  if(tachesysteme.equals("rotate")) {		
    processBuilder.command("cmd.exe", "/c", "vlc C:\\video.mp4");
    processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));	        
    processBuilder.redirectErrorStream(true);
    processBuilder.start();

  }if(tachesysteme.equals("translate")) {
		processBuilder.command("cmd.exe", "/c", "TASKKILL /IM vlc.exe");	
		processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));	        
        processBuilder.redirectErrorStream(true);
        processBuilder.start();

  }if(tachesysteme.equals("enterd")) {
	processBuilder.command("cmd.exe", "/c", "vlc vlc://pause:10");
    processBuilder.directory(new File("C:\\Program Files\\VideoLAN\\VLC"));	        
    processBuilder.redirectErrorStream(true);
    processBuilder.start();
	
 }    
}
}

The command pause doesn't work for me, any help is much appreciated.
I am using VLC 3.0.11

huangapple
  • 本文由 发表于 2020年7月27日 19:31:07
  • 转载请务必保留本文链接:https://java.coder-hub.com/63114400.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定