MP3 playback using Java Sound and Sun MP3 plugin

Discussion in 'Java' started by Daniel Dyer, Jan 21, 2006.

  1. Daniel Dyer

    Daniel Dyer Guest

    I downloaded Sun's plugin for MP3 support
    (http://java.sun.com/products/java-media/jmf/mp3/download.html). The
    website seems to suggest that it will work with the Java Sound APIs
    without any need to install the Java Media Framework. However, I can only
    get it to work with the Java Sound classes when the JMF is also installed
    (I've tried on Windows and Linux).

    Has anybody managed to get it to work without installing the JMF?

    I'm aware that I can use the MP3SPI/JLayer libs from JavaZoom, but I'd
    like to get it working with Sun's stuff if possible (performance and
    licensing being the main reasons). Does anyone know of any other pure
    Java MP3 player libraries?

    Thanks,

    Dan.

    --
    Daniel Dyer
    http://www.dandyer.co.uk
     
    Daniel Dyer, Jan 21, 2006
    #1
    1. Advertising

  2. Daniel Dyer

    Daniel Dyer Guest

    On Sat, 21 Jan 2006 21:30:57 -0000, Daniel Dyer
    <> wrote:

    > I downloaded Sun's plugin for MP3 support
    > (http://java.sun.com/products/java-media/jmf/mp3/download.html). The
    > website seems to suggest that it will work with the Java Sound APIs
    > without any need to install the Java Media Framework. However, I can
    > only get it to work with the Java Sound classes when the JMF is also
    > installed (I've tried on Windows and Linux).
    >
    > Has anybody managed to get it to work without installing the JMF?


    I should probably specify the error I'm seeing. I get the following
    exception when I call the getAudioInputStream method of the
    javax.sound.sampled.AudioSystem class and pass it an MP3 file:

    javax.sound.sampled.UnsupportedAudioFileException: could not get audio
    input stream from input file
    at
    javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170)

    Dan.

    --
    Daniel Dyer
    http://www.dandyer.co.uk
     
    Daniel Dyer, Jan 21, 2006
    #2
    1. Advertising

  3. Daniel Dyer

    Roedy Green Guest

    On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
    <> wrote, quoted or indirectly
    quoted someone who said :

    >
    >Has anybody managed to get it to work without installing the JMF?


    It is part of JMF, just a Johnny come lately part as I understand it.

    See http://mindprod.com/jgloss/jmf.html
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
     
    Roedy Green, Jan 21, 2006
    #3
  4. Daniel Dyer

    Daniel Dyer Guest

    On Sat, 21 Jan 2006 22:56:08 -0000, Roedy Green
    <> wrote:

    > On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
    > <> wrote, quoted or indirectly
    > quoted someone who said :
    >
    >>
    >> Has anybody managed to get it to work without installing the JMF?

    >
    > It is part of JMF, just a Johnny come lately part as I understand it.
    >
    > See http://mindprod.com/jgloss/jmf.html


    The download page says:

    "The included jar file (mp3plugin.jar) contains a Java Sound plugin as
    well as a Java Media Framework plugin for playing MPEG-2 Layer 3 Audio."

    ....and then goes on to describe two installation steps, one to get it to
    work with Java Sound and an additional step to get it to work with the
    JMF. I'm not using any of the JMF classes directly, I'm just using
    javax.sound.sampled.* rather than javax.media.*, but it only seems to work
    if the JMF is installed. I would expect a ClassDefNotFoundError or
    similar, rather than the UnsupportedAudioFileException that I am getting,
    if it was reliant on the JMF classes.

    Dan.

    --
    Daniel Dyer
    http://www.dandyer.co.uk
     
    Daniel Dyer, Jan 21, 2006
    #4
  5. Daniel Dyer wrote:
    > On Sat, 21 Jan 2006 22:56:08 -0000, Roedy Green
    > <> wrote:
    >
    >> On Sat, 21 Jan 2006 21:30:57 -0000, "Daniel Dyer"
    >> <> wrote, quoted or indirectly
    >> quoted someone who said :
    >>
    >>>
    >>> Has anybody managed to get it to work without installing the JMF?

    >>
    >>
    >> It is part of JMF, just a Johnny come lately part as I understand it.
    >>
    >> See http://mindprod.com/jgloss/jmf.html

    >
    >
    > The download page says:
    >
    > "The included jar file (mp3plugin.jar) contains a Java Sound plugin as
    > well as a Java Media Framework plugin for playing MPEG-2 Layer 3 Audio."
    >
    > ...and then goes on to describe two installation steps, one to get it
    > to work with Java Sound and an additional step to get it to work with
    > the JMF. I'm not using any of the JMF classes directly, I'm just
    > using javax.sound.sampled.* rather than javax.media.*, but it only
    > seems to work if the JMF is installed. I would expect a
    > ClassDefNotFoundError or similar, rather than the
    > UnsupportedAudioFileException that I am getting, if it was reliant on
    > the JMF classes.
    >
    > Dan.
    >


    Daniel:

    I ran into the same problems that you have seen. The MP3 plugin will
    work with JavaSound but it only works with certain format MP3 files.
    Apparently (and I am not that knowledgable in this area) there are many
    different types of MP3 files. JMF will apparently play more different
    file types.

    There is a really good JavaSound email list

    http://java.sun.com/products/java-media/sound/list.html

    and you should look into Tritonus. These fellows have written some
    really handy things, MP3 too, for JavaSound.

    www.tritonus.org

    One of the guys on the list was the Sun guy for JavaSound for a couple
    of years and is really knowledgable and very helpful.

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 22, 2006
    #5
  6. Daniel Dyer

    Daniel Dyer Guest

    On Sun, 22 Jan 2006 02:10:32 -0000, Knute Johnson
    <> wrote:
    > I ran into the same problems that you have seen. The MP3 plugin will
    > work with JavaSound but it only works with certain format MP3 files.
    > Apparently (and I am not that knowledgable in this area) there are many
    > different types of MP3 files. JMF will apparently play more different
    > file types.
    >
    > There is a really good JavaSound email list
    >
    > http://java.sun.com/products/java-media/sound/list.html


    Thanks, I will take a look.

    > and you should look into Tritonus. These fellows have written some
    > really handy things, MP3 too, for JavaSound.
    >
    > www.tritonus.org


    I was looking at the Tritonus stuff, but I wasn't sure exactly what it
    was. It seems to be a pure Java implementation of Java Sound that was
    written primarily for Linux. Is that correct?

    I know the MP3SPI library uses it. I hacked around in the source code to
    try and remove the dependency and see if MP3SPI would work just using the
    base Java Sound classes, but I didn't get it to work properly.

    There's no reason why I can't use Tritonus (or why I can't install JMF), I
    just thought it should be possible to play MP3s without either.

    Thanks,

    Dan.



    --
    Daniel Dyer
    http://www.dandyer.co.uk
     
    Daniel Dyer, Jan 22, 2006
    #6
  7. Daniel Dyer wrote:
    > I was looking at the Tritonus stuff, but I wasn't sure exactly what it
    > was. It seems to be a pure Java implementation of Java Sound that was
    > written primarily for Linux. Is that correct?


    I think you are right, they are primarily Linux guys, but Tritonus will
    run just fine on any Java system.

    > I know the MP3SPI library uses it. I hacked around in the source code
    > to try and remove the dependency and see if MP3SPI would work just
    > using the base Java Sound classes, but I didn't get it to work properly.
    >
    > There's no reason why I can't use Tritonus (or why I can't install JMF),
    > I just thought it should be possible to play MP3s without either.


    The nice thing about the Tritonus is that it is just a couple of JAR
    files any you are ready to go. Ask around on the JAVASOUND mailling
    list, I'm sure they can get you running with the plugin. I just didn't
    get where I was going with it and moved on to something else. I'm sure
    it will work.

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 22, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    4
    Views:
    1,622
  2. PilotYid
    Replies:
    1
    Views:
    660
    Andrew Thompson
    Oct 31, 2005
  3. James Harvey

    Thread friendly MP3/OGG playback

    James Harvey, Feb 2, 2006, in forum: Java
    Replies:
    1
    Views:
    453
    Douwe
    Feb 3, 2006
  4. Replies:
    0
    Views:
    2,910
  5. Replies:
    1
    Views:
    142
Loading...

Share This Page