title: can't play mp3 file via javafx 2.2 media player
body: <p>I'm developing what I thought should ahve been a simple task with javafx- media player that will play mp3 files stored on the local hard drive, in users default music folder path (using fedora). I can play all the mp3 files fine from the command line, but when I try and play via javafx.scene.media libraries, javafx keeps telling me that mp3 is an upsupported media type. I've downloaded about every library I could find, but to no avail. Here is a the code that actually tries to open the file and play the media:</p>
  
  <p>First attempt:</p>
  
  <pre><code> public void playTrack( String audioFileName ) {
      System.out.println("going to play the file "+audioFileName);
      String filename = System.getProperty("user.home")+"/"+audioFileName;
      File audioFile = new File( filename);
      Media audioFileStream= null;
      try {
          audioFileStream = new Media(audioFile.toURI().toURL().toString());
      } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      MediaPlayer mediaPlayer = new MediaPlayer(audioFileStream);
      mediaPlayer.play();
  }
  </code></pre>
  
  <p>Method 2:</p>
  
  <pre><code>public void playTrack( String audioFileName ) {
      System.out.println("going to play the file "+audioFileName);
      String source = new File(System.getProperty("user.home")+"/"+audioFileName).toURI().toString();
      //String source = new File("07-Basket-Case.mp3").toURI().toString();
      System.out.println("going to play "+source);
      Media media = null;
      media = new Media(source);
      MediaPlayer mediaPlayer = new MediaPlayer(media);
      mediaPlayer.play();
  }
  </code></pre>
  
  <p>Both produce the exact same error result, shown here:</p>
  
  <p>going to play file:/home/cpeddie/workspace/parnassusfx/07-Basket-Case.mp3
  Exception in thread "JavaFX Application Thread" MediaException: MEDIA_UNSUPPORTED : com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported" : com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported"
      at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:125)
      at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:474)
      at javafx.scene.media.MediaPlayer.(MediaPlayer.java:383)
      at com.promptu.parnassusfx.sample.music.MusicController.playTrack(MusicController.java:218)
      at com.promptu.parnassusfx.sample.music.MusicController$3$1$1.handle(MusicController.java:357)
      at com.promptu.parnassusfx.sample.music.MusicController$3$1$1.handle(MusicController.java:1)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Node.fireEvent(Node.java:6867)
      at javafx.scene.control.Button.fire(Button.java:179)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
      at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3311)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3151)
      at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3106)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2248)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:530)
      at com.sun.glass.ui.View.notifyMouse(View.java:924)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:89)
      at java.lang.Thread.run(Thread.java:724)
  Caused by: com.sun.media.jfxmedia.MediaException: "Error media audio format unsupported"
      at com.sun.media.jfxmediaimpl.MediaUtils.nativeError(MediaUtils.java:331)
      at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia.init(GSTMedia.java:50)
      at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia.(GSTMedia.java:33)
      at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer.(GSTMediaPlayer.java:39)
      at com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform.prerollMediaPlayer(GSTPlatform.java:100)
      at com.sun.media.jfxmediaimpl.platform.PlatformManager.createMediaPlayer(PlatformManager.java:173)
      at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:260)
      at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:139)
      at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:431)
      ... 75 more</p>
  
  <p>I should also mention that I'm developing this using VMWare fusion running on a MacBook Pro with OS 10.8.5. Running Fedora 19.</p>
  
  <p>Any help will be appreaciated!</p>