Welcome to the Treehouse Community
Looking to learn something new?
MediaException: Could not create Player!
When I attempt to run the app, then play the sound just as shown in the video, I get a MediaException. However, if I convert to wav, it runs and plays the sound just fine. Any ideas?
Exception in thread "Thread-4" com.sun.media.jfxmedia.MediaException: Could not create player! at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:274) at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118) at com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer.play(NativeMediaAudioClipPlayer.java:319) at com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer.clipScheduler(NativeMediaAudioClipPlayer.java:112) at com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer.access$000(NativeMediaAudioClipPlayer.java:47) at com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer$Enthreaderator.lambda$static$4(NativeMediaAudioClipPlayer.java:85) at java.lang.Thread.run(Thread.java:745)
Eric Schroeder19,882 Points
I've run into the same problem, not sure which OS you're using but I'm using Ubuntu 16.04. From my digging I think it's a compatibility issue between Java 8 and Ubuntu. Java wants to see libavcodec53 and libavformat53, 16.04 has libavcodec56 and libavformat56. I don't think you can downgrade these packages (I could be wrong) on newer ubuntu versions. I just use .wav file as you did, probably the easiest fix.
Check "JavaFX Media" at the bottom of this page.
I had the same issue and I'm running Elementry OS based on ubuntu, using a wav file solves the problem
Craig DennisTreehouse Teacher
Hmm... can you make sure that you are importing the right
MediaClip class. Make sure it's from JavaFX, not the Applet one.
The same problem on Ubuntu