J
Jason Teagle
I just had a crack at using the JMF for the first time (never let it be said
I don't try new things!), and tried to play an MP3 file chosen at random
from my vast collection of drivel. The document at
http://java.sun.com/developer/JDCTechTips/2002/tt0219.html says:
"Playing multimedia files through the JMF libraries is simple. The key
classes are Manager and Player. The Manager has a series of createPlayer()
methods that each return a Player. After you create a Player, you tell the
Player to start playing. For basic audio playing, all you need to do is:
Player player = Manager.createPlayer(resource);
player.play();"
Well of course, we knew that was a lie, didn't we?
Dreaming that it might actually work, I did just that:
try
{
m_Player = Manager.createPlayer(new
File("c:\\temp\\testing\\test.mp3").toURL() );
m_Player.start();
}
catch (Exception e)
{
e.printStackTrace();
}
And it threw an exception:
Unable to handle format: mpeglayer3, 22050.0 Hz, 16-bit, Stereo,
LittleEndian, Signed, 8000.0 frame rate, FrameSize=32768 bits
Failed to realize: com.sun.media.PlaybackEngine@19ec4ed
Error: Unable to realize com.sun.media.PlaybackEngine@19ec4ed
Now, this was hardly a surprise. I'm assuming this is simply a codec issue -
my (3rd-party) MP3 playing program can of course handle it quite easily.
The trouble is, I don't have a clue what to do next... how do I go about
solving this? The codec must be there as far as my OS (Windows) is
concerned, otherwise the (other) MP3 player wouldn't be able to do it... so
how do I convince Java to play it? Do I have to install special JMF codecs?
Do I have to somehow tell the JMF where the native codecs are?
Note that I downloaded the cross-platform version of the JMF, since any
other version would be a mockery of the cross-platform promise of Java.
Maybe the Windows-specific version would have worked? But I don't want that,
I want it to work on all platforms. So I want to stick with this version if
possible. If it's not possible, then what is the point of JMF?
Any guidance would be appreciated.
I don't try new things!), and tried to play an MP3 file chosen at random
from my vast collection of drivel. The document at
http://java.sun.com/developer/JDCTechTips/2002/tt0219.html says:
"Playing multimedia files through the JMF libraries is simple. The key
classes are Manager and Player. The Manager has a series of createPlayer()
methods that each return a Player. After you create a Player, you tell the
Player to start playing. For basic audio playing, all you need to do is:
Player player = Manager.createPlayer(resource);
player.play();"
Well of course, we knew that was a lie, didn't we?
Dreaming that it might actually work, I did just that:
try
{
m_Player = Manager.createPlayer(new
File("c:\\temp\\testing\\test.mp3").toURL() );
m_Player.start();
}
catch (Exception e)
{
e.printStackTrace();
}
And it threw an exception:
Unable to handle format: mpeglayer3, 22050.0 Hz, 16-bit, Stereo,
LittleEndian, Signed, 8000.0 frame rate, FrameSize=32768 bits
Failed to realize: com.sun.media.PlaybackEngine@19ec4ed
Error: Unable to realize com.sun.media.PlaybackEngine@19ec4ed
Now, this was hardly a surprise. I'm assuming this is simply a codec issue -
my (3rd-party) MP3 playing program can of course handle it quite easily.
The trouble is, I don't have a clue what to do next... how do I go about
solving this? The codec must be there as far as my OS (Windows) is
concerned, otherwise the (other) MP3 player wouldn't be able to do it... so
how do I convince Java to play it? Do I have to install special JMF codecs?
Do I have to somehow tell the JMF where the native codecs are?
Note that I downloaded the cross-platform version of the JMF, since any
other version would be a mockery of the cross-platform promise of Java.
Maybe the Windows-specific version would have worked? But I don't want that,
I want it to work on all platforms. So I want to stick with this version if
possible. If it's not possible, then what is the point of JMF?
Any guidance would be appreciated.