title: how to play video using java?
body: <p>I want to play a video in media player using java i used JMF to display the video however it gives me an error in one of the data types i used from the JMF library and here is my code.</p>
  
  <pre><code>public static void main(String args[]) {
      // create a file chooser
      JFileChooser fileChooser = new JFileChooser();
  
      // show open file dialog
      int result = fileChooser.showOpenDialog(null);
  
      if (result == JFileChooser.APPROVE_OPTION) // user chose a file
      {
          URL mediaURL = null;
  
          try {
              // get the file as URL
              mediaURL = fileChooser.getSelectedFile().toURL();
          } // end try
          catch (MalformedURLException malformedURLException) {
              System.err.println("Could not create URL for the file");
          } // end catch
  
          if (mediaURL != null) // only display if there is a valid URL
          {
              JFrame mediaTest = new JFrame("Media Tester");
              mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
              MediaPlayer mediaPanel = new MediaPlayer(mediaURL);
  
              mediaTest.add(mediaPanel);
  
              mediaTest.setSize(300, 300);
              mediaTest.setVisible(true);
          } // end inner if
      } // end outer if
  }
  </code></pre>
  
  <p>the problem is it gives me an error in this lines</p>
  
  <pre><code>MediaPlayer mediaPanel = new MediaPlayer(mediaURL);
  </code></pre>
  
  <p>The constructor MediaPlayer(URL) is undefined as the MediaPlayer constructor does not take anything but i need to add url to the mediaplayer to display it in the jframe but i cannot, any help ?</p>