diff --git a/client/src/main/java/ctbrec/ui/Player.java b/client/src/main/java/ctbrec/ui/Player.java index c7cbf442..f2c2dcb5 100644 --- a/client/src/main/java/ctbrec/ui/Player.java +++ b/client/src/main/java/ctbrec/ui/Player.java @@ -1,11 +1,13 @@ package ctbrec.ui; import java.io.File; +import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -17,7 +19,6 @@ import ctbrec.Hmac; import ctbrec.Model; import ctbrec.OS; import ctbrec.Recording; -import ctbrec.io.DevNull; import ctbrec.io.StreamRedirectThread; import ctbrec.recorder.download.StreamSource; import ctbrec.ui.controls.Dialogs; @@ -127,7 +128,7 @@ public class Player { try { if (cfg.getSettings().localRecording && rec != null) { File file = new File(cfg.getSettings().recordingsDir, rec.getPath()); - String[] cmdline = createCmdline(file.getName()); + String[] cmdline = createCmdline(file.getAbsolutePath()); playerProcess = rt.exec(cmdline, OS.getEnvironment(), file.getParentFile()); } else { if (rec != null) { @@ -140,13 +141,13 @@ public class Player { // create threads, which read stdout and stderr of the player process. these are needed, // because otherwise the internal buffer for these streams fill up and block the process - Thread std = new Thread(new StreamRedirectThread(playerProcess.getInputStream(), new DevNull())); - // Thread std = new Thread(new StreamRedirectThread(playerProcess.getInputStream(), System.out)); + Thread std = new Thread(new StreamRedirectThread(playerProcess.getInputStream(), OutputStream.nullOutputStream())); + //Thread std = new Thread(new StreamRedirectThread(playerProcess.getInputStream(), System.out)); std.setName("Player stdout pipe"); std.setDaemon(true); std.start(); - Thread err = new Thread(new StreamRedirectThread(playerProcess.getErrorStream(), new DevNull())); - // Thread err = new Thread(new StreamRedirectThread(playerProcess.getErrorStream(), System.err)); + Thread err = new Thread(new StreamRedirectThread(playerProcess.getErrorStream(), OutputStream.nullOutputStream())); + //Thread err = new Thread(new StreamRedirectThread(playerProcess.getErrorStream(), System.err)); err.setName("Player stderr pipe"); err.setDaemon(true); err.start(); @@ -163,11 +164,12 @@ public class Player { private String[] createCmdline(String mediaSource) { Config cfg = Config.getInstance(); String[] playerArgs = cfg.getSettings().mediaPlayerParams.trim().split(" "); - String[] cmdline = new String[playerArgs.length + 3]; + String[] cmdline = new String[playerArgs.length + 2]; cmdline[0] = cfg.getSettings().mediaPlayer; - cmdline[cmdline.length - 2] = "--"; + //cmdline[cmdline.length - 2] = "--"; cmdline[cmdline.length - 1] = mediaSource; System.arraycopy(playerArgs, 0, cmdline, 1, playerArgs.length); + LOG.debug("Player command line: {}", Arrays.toString(cmdline)); return cmdline; } diff --git a/common/src/main/java/ctbrec/io/DevNull.java b/common/src/main/java/ctbrec/io/DevNull.java deleted file mode 100644 index b40772b9..00000000 --- a/common/src/main/java/ctbrec/io/DevNull.java +++ /dev/null @@ -1,18 +0,0 @@ -package ctbrec.io; - -import java.io.IOException; -import java.io.OutputStream; - -public class DevNull extends OutputStream { - @Override - public void write(int b) throws IOException { - } - - @Override - public void write(byte[] b) throws IOException { - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - } -}