title: How can I code a server/client video and audio streaming application?
body: <p>I have to create a client/server system to stream video and audio. It would be very simple. Like youtube style. The server should attend clients providing a list of medias first and waiting the choice of each client to start streaming the media. Until create a socket and showing a simple list I'm on it ;) But I don't know which class could I use to stream. The example is basically youtube style. How can I start streaming, How can client pause reproduction, how can? 
  I know how to stream text but what about video? Do you know any tutorial page?
  It's very different from this simple server client example?</p>
  
  <pre><code>import java.io.*; 
  import java.io.*;
  import java.net.*;
  
  public class ThreadedEchoServer {
  
     public static void main(String[] args) {
        try {
           int i = 1;
           ServerSocket s = new ServerSocket(8189);
  
           while(true) {
              Runnable r = new ThreadedEchoHandler(incoming, i);
              Thread t = new Thread(r);
              t.start();
              i++;
           }
        } catch (IOException e) {
           e.printStackTrace();
        }
     }
  }
  
  class ThreadedEchoHandler implements Runnable {
     private Socket incoming;
     private int counter;
  
     public ThreadedEchoHandler(Socket i, int c) {
        incoming = i;
        counter = c;
     }
  
     public void run() {
        try {
           try {
              InputStream inStream = incoming.getInputStream();
              OutputStream outStream = incoming.getOutputStream();
  
              Scanner in = new Scanner(inStream);
              PrintWriter out = new PrintWriter(outStream);
  
              out.println("BYE to exit");
              boolean done = false;
  
              while (!done &amp;&amp; in.hasNextLine()) {
  
                 String line = in.nextLine()) {
                 out.println("Echo: " + line);
  
                 if (line.trim().equals("BYE"))
                    done = true;
                 out.println("BYE to exit");
              }
           } finally {
              incoming.close();
           }
        } catch (IOException e) {
           e.printStackTrace();
        }
  }
  </code></pre>
  
  <p>Hope you could clarify my ideas. 
  Kind regards.</p>