title: Video streaming from the server side to the client side
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11343523/video-streaming-in-vlcj">Video Streaming in vlcj</a>  </p>
  </blockquote>
  
  
  
  <pre><code>public class VlcTest extends VlcjTest {
    public static void main(String[] args) throws Exception {
      if(args.length != 1) {
        System.out.println("Specify a single MRL to stream");
        System.exit(1);
      }
  
      NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:\\Program Files\\VideoLAN\\VLC");
      Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
  
      String media = args[0];
      String [] options = formatHttpStream("127.0.0.1", 5080);
  
      System.out.println("Streaming '" + media + "' to '" + options + "'");
  
      MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
      HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
      mediaPlayer.playMedia(media, options);
      // Don't exit
      Thread.currentThread().join();
    }
  
    private static String [] formatHttpStream(String serverAddress, int serverPort) {
      String [] sb={":sout = #duplicate{dst=std{access=http,mux=ts,dst=127.0.0.1:5080}}"};
      return sb;
    }
  }
  </code></pre>
  
  <p>I want to confirm that can this code is able to stream the video from the server to the client side. The flow I am trying to achieve is:</p>
  
  <ol>
  <li>Client sends request to server for stream</li>
  <li>Server creates connection to client to send the video in packets based on the clients ip address and port number.</li>
  </ol>