Page 1 of 1

Interfacing to VLC with Java

Posted: 08 Nov 2005 18:44
by lloyd142
Hi. There didn't seem to be any posts with any java code that demonstrated how to interface to VLC so I wrote some which seems to work. Hope you find it useful

Make sure you change the IP address, VLC.exe location and location of mdeia file to get it to work.

Code: Select all

import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; public class SocketDemo { /** * @param args */ public static void main(String[] args) { try { Runtime.getRuntime().exec("C:/Program Files/VideoLAN/VLC/vlc.exe --extraintf=\"rc\" --rc-host=\"10.215.122.68:1234\" --rc-quiet"); Socket MyClient = new Socket("10.215.122.68", 1234); DataOutputStream output = new DataOutputStream(MyClient.getOutputStream()); final DataInputStream is = new DataInputStream(MyClient.getInputStream()); new Thread() { public void run() { String response; try { while ((response = is.readLine()) != null) { System.out.println("Server: " + response); } } catch (IOException e) { e.printStackTrace(); } } }.start(); output.writeBytes("add D:/music/Coldplay/A Rush of Blood to the Head/01 Politik.mp3"); output.writeBytes("\n"); output.writeBytes("play\n"); Thread.sleep(10000); output.writeBytes("quit\n"); } catch (UnknownHostException e) { System.out.println(e); } catch (IOException e) { System.out.println(e); } catch (InterruptedException e) { System.out.println(e); } } }

Posted: 08 Nov 2005 21:58
by Guest
You might want to check out the advene project source code as well. Check the README in modules\control\corba for URL, and the Corba client. I havn't managed to compiled the corba module though. You can find other info in the bindings directory too.

Posted: 09 Nov 2005 10:14
by Guest
You might want to check out the advene project source code as well. Check the README in modules\control\corba for URL, and the Corba client. I havn't managed to compiled the corba module though. You can find other info in the bindings directory too.
:arrow: :?:

Posted: 09 Nov 2005 22:15
by Waruwaru
You might want to check out the advene project source code as well. Check the README in modules\control\corba for URL, and the Corba client. I havn't managed to compiled the corba module though. You can find other info in the bindings directory too.
:arrow: :?:
Not sure what your :?: is?

The Advene source code has demonstrate a few different ways of controlling VLC (using native connection, http connections..etc).