Error Unable To Prefetch Com.sun.media
with JMF LinkBack LinkBack URL About LinkBacks Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 09-16-2012,02:12 PM #1 oror84 Member Join Date Mar 2012 Posts 4 Rep Power 0 Problem with JMF Hi, I'm trying to play a song with JMF, the song location is in my computer. I'm getting an exception of CannotRealizeException. I'm king of new programmer with JMF, here is my code : Java Code: import javax.media.CannotRealizeException; import javax.media.Manager; import javax.media.NoPlayerException; import javax.media.Player; import java.io.File; import java.io.IOException; import java.net.URL; public class SimpleAudioPlayer { private Player audioPLayer; public SimpleAudioPlayer(URL url) throws IOException, NoPlayerException, CannotRealizeException { audioPLayer = Manager.createRealizedPlayer(url); } public SimpleAudioPlayer(File file) throws IOException, NoPlayerException, CannotRealizeException { this(file.toURI().toURL()); } public void play() { audioPLayer.start(); } public void stop() { audioPLayer.stop(); audioPLayer.close(); } public static void main(String[] args) { try { File file = new File("C://Users//Or//Downloads//Songs//a.mp3") ; SimpleAudioPlayer simpleAudioPlayer = null; simpleAudioPlayer = new SimpleAudioPlayer(file); simpleAudioPlayer.play(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (NoPlayerException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (CannotRealizeException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } I have a song with a.mp3 name at this location, and i dont know what is the reason i'm gettting this exception. Hope that someone can help me.. Thanks, Or. Reply With Quote 09-16-2012,04:18 PM #2 DarrylBurke Forum Police Join Date Sep 2008 Location Madgaon, Goa, India Posts 12,001 Rep Power 23 Re: Problem with JMF Have you installed the MP3 Plugin? db If you're forever cleaning
took a while and I can't really be sure exactly what I did to get all the things working; if I ever do a clean install, I'll try and document the process. Here's a very quick outline before I post the code -I grabbed all the jars from here:http://java.sun.com/products/java-media/jmf/2.1.1/download.htmlAnd grabbed the mp3 handler http://www.java-forums.org/advanced-java/63056-problem-jmf.html here:http://java.sun.com/products/java-media/jmf/mp3/download.htmlThe jars you'll need to drop into eclipse are (I think):mp3plugin.jarmediaplayer.jarjmf.jarmultiplayer.jarHere were some other links I found handy:http://java.sun.com/products/java-media/jmf/2.1.1/setup-linux.htmlhttp://java.sun.com/products/java-media/jmf/2.1.1/jmfdiagnostics.htmlhttp://ubuntuforums.org/showthread.php?t=436053http://weblogs.java.net/blog/jonathansimon/archive/2004/11/suns_mp3_plugin.htmlhttp://forum.java.sun.com/thread.jspa?threadID=686681&messageID=3996185Just a prewarning:I kept getting errors that looked like this -Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo,LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bitsFailed to realize: com.sun.media.PlaybackEngine@12dd76Error: Unable http://blog.msbbc.co.uk/2007/06/mp3-playback-in-java.html to realize com.sun.media.PlaybackEngine@12dd76Failed to realize: input media not supported: mpeglayer3 audioIf you keep seeing these, try a number of different mp3 files; I had to try 3 before I had something working. I found testing the mp3 files using jmstudio was a reliable way to test - if jmstudio can open and play the file automatically, then it should work fine with the code listed below. You can see a forum discussion regarding some of the common problems here:http://www.velocityreviews.com/forums/t149533-mp3-playback-using-java-sound-and-sun-mp3-plugin.htmlA common alternative to the sun offering seems to be:http://www.tritonus.org/plugins.html-----------------------------------------------------Ok - if everything is set up and appears to be working, you can try some of these classes. I found the original examples by looking around on forums, but had to make some changes to get them to work completely.The simplest example I could find of a java class able
App EngineApache AntApache MavenjQueryJava MongoDBQuartz SchedulerLog4jContact Us JMF - Unable to handle format: mpeglayer3By mkyong | January 8, 2010 | Viewed : 10,993 times +18 pv/wProblemYou may encounter https://www.mkyong.com/applet/jmf-unable-to-handle-format-mpeglayer3/ the following error while using Java media framework (JMF) to play a mp3 file. Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits Failed to realize: com.sun.media.PlaybackEngine@19ec4ed Error: Unable to realize com.sun.media.PlaybackEngine@19ec4ed server running at port: 4264 SolutionThis is because Java took out the error unable MP3 support by default (pirate copyright issue), you are required to install a "JMF MP3 plugin" in order to play MP3 file.Go Java's JMF website to download it http://java.sun.com/javase/technologies/desktop/media/jmf/mp3/download.html Tags : jmf mp3Share this article onTwitterFacebookGoogle+Related Posts About the Author mkyong Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. error unable to Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.Popular PostsLoading...Comments Abhishek Hello I am trying to make a media player through netbeans in ubuntu. I Have following libraries installed jmf.jar mediaplayer.jar multiplayer.jar mp3plugin.jar customizer.jar. Still i am getting this error when i press the play button Unable to handle format: mpeglayer3, 48000.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits Failed to realize: com.sun.media.PlaybackEngine@76db09 Error: Unable to realize com.sun.media.PlaybackEngine@76db09 Could not realize media player Please suggest me something…….. David Peers Thanks, this blog helped me somewhat in solving some problems with the latest release, Why do they always seem to leave out vital documentation when they release a new version? It may be minor to them but not for us! I'm sure i'm not alone either. Rising Posts (100k-500k pv)Loading...Rising Posts (10k-99k pv)Loading...Rising Posts (<10k pv)Loadin