VLC server Instance with JAVA
Posted: 19 Apr 2011 20:42
Hi every body ;
I'm developing a VOD web application based on VLC ;
so I prepare a program in java which can start a new instance each time a client click on a video.
But the problem in the starting of VLC server , each time a message displayed appear in a black box saying
" the command line options couldn't be loaded, check that they are valid"
that's my code function which can start a new instance of VLC server, the parameters are inserted manually, PLZ check for me this code , I'm certain that the line options is correct , so what's the problem , thx in advance
I'm developing a VOD web application based on VLC ;
so I prepare a program in java which can start a new instance each time a client click on a video.
But the problem in the starting of VLC server , each time a message displayed appear in a black box saying
" the command line options couldn't be loaded, check that they are valid"
that's my code function which can start a new instance of VLC server, the parameters are inserted manually, PLZ check for me this code , I'm certain that the line options is correct , so what's the problem , thx in advance
Code: Select all
//____________Initialisation___________________________________________________
String ClientIP = "0.0.0.0";
int TelnetPort;
String Password="azerty";
int RTSPHost;
String FilmFileName="The_Film";
String FilePath="d:\\films\\Defiance\\Defiance.avi";
//StartNewInstance(ClientIP, TelnetPort, Password, RTSPHost);
/* System.out.print("Entrer ClientIP:\n");
ClientIP=sc.nextLine();
System.out.print("Entrer Password:\n");
Password=sc.nextLine();
System.out.print("Entrer FilmFileName:\n");
FilmFileName=sc.nextLine();
System.out.print("Entrer FilePath:\n");
FilePath=sc.nextLine();
*/
//____________RTSPHostGenerate__________________________________________________
System.out.print("Entrer RTSPHost:\n");
RTSPHost=sc.nextInt();
/* int RTSPHost_int = 5500;
Random RTSPHost_random = new Random();
RTSPHost = (int) (RTSPHost_random.nextInt(500)+RTSPHost_int);
System.out.print(RTSPHost+"\n");*/
//____________TelentPortGenerate________________________________________________
System.out.print("Entrer TelnetPort:\n");
TelnetPort=sc.nextInt();
/* int TelnetPort_int=4200;
Random TelnetPort_random = new Random();
TelnetPort = (int) (TelnetPort_random.nextInt(500)+TelnetPort_int);
System.out.println(TelnetPort+"\n");*/
//___________StartNewInstance___________________________________________________
Process p=null;
int exitStatus=-1;
String commande = "C:\\Program Files\\VideoLAN\\VLC\\vlc";
String arguments = "--ttl 12 -vvv --color -I telnet --telnet-password "+Password+" --telnet-port "+TelnetPort+" --rtsp-host "+ClientIP+":"+RTSPHost;
System.out.print(arguments);
String[] cmd={
commande,
arguments
};
String cmd1=commande+" "+arguments;
Runtime r = Runtime.getRuntime();
p = r.exec(cmd);
p.getOutputStream().close();
p.getInputStream().close();
// exitStatus = p.waitFor();
// System.out.println(exitStatus);
// System.out.println(p.exitValue());
// ProcessBuilder p1= new ProcessBuilder(cmd);
// p1.start();
/*if (exitStatus == 0){System.out.println("Process Starting");}
}
finally {
if ( exitStatus != 0 && p != null ) {
System.out.println("Process Error");
}
p = null;
}*/