Results 1 to 3 of 3
Thread: Playing mp3 files in Ubuntu
- 09-07-2011, 01:36 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Playing mp3 files in Ubuntu
Could anyone please help play an mp3 in Java on Ubuntu using the javax.media.Manager object?
I'm building a fitness application for Ubuntu, and the mp3 sound capabilities would be a really interesting addition.
I have used the JMF and the code described in:
How to Play a MP3 File in Java – Simple and Beautiful
but it simply does not work in my version of Ubuntu.
- 09-07-2011, 02:35 PM #2
Re: Playing mp3 files in Ubuntu
does not work
- 09-07-2011, 09:26 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Re: Playing mp3 files in Ubuntu
Yes, I get following error message:
********************************
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@14b84c7
Error: Unable to realize com.sun.media.PlaybackEngine@14b84c7
javax.media.CannotRealizeException
at javax.media.Manager.blockingCall(Manager.java:2005 )
at javax.media.Manager.createRealizedPlayer(Manager.j ava:554)
at openfit.sonido.reproducir(sonido.java:40)
at openfit.sonido.continuar(sonido.java:84)
at openfit.OpenfitView$12.evaluarMusica(OpenfitView.j ava:943)
at openfit.OpenfitView$12.buclePrincipal(OpenfitView. java:927)
at openfit.OpenfitView$12.actionPerformed(OpenfitView .java:900)
at javax.swing.Timer.fireActionPerformed(Timer.java:2 91)
at javax.swing.Timer$DoPostEvent.run(Timer.java:221)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:641)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectio nPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 611)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)
********************************
I use the following code for registering the plugin:
********************************
Format input1 = new AudioFormat(AudioFormat.MPEGLAYER3);
Format input2 = new AudioFormat(AudioFormat.MPEG);
Format output = new AudioFormat(AudioFormat.LINEAR);
PlugInManager.addPlugIn("com.sun.media.codec.audio .mp3.JavaDecoder",new Format[]{input1, input2},new Format[]{output},PlugInManager.CODEC);
********************************
And the following code to (try to) play the song:
********************************
player=Manager.createRealizedPlayer(new MediaLocator(new File(cancion).toURI().toURL()));
player.start();
********************************
What could be wrong?
Similar Threads
-
Playing multiple wave files one after the other
By Pals in forum New To JavaReplies: 4Last Post: 02-26-2010, 04:18 AM -
JDK @ ubuntu
By M77 in forum New To JavaReplies: 2Last Post: 09-16-2009, 09:43 AM -
Eclipse in Ubuntu
By DavidG24 in forum EclipseReplies: 2Last Post: 04-18-2009, 04:10 PM -
SWT is not working on ubuntu
By shreedharghare in forum SWT / JFaceReplies: 0Last Post: 12-17-2008, 06:21 PM -
Log rotation in ubuntu
By sarah11 in forum New To JavaReplies: 0Last Post: 11-04-2008, 08:46 AM
Bookmarks