Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How do you play wma or mp3 files in java?

  1. #1
    Member GoodbyeWorld's Avatar
    Join Date
    Jul 2012
    Location
    Hidden command post deep within the bowels of a hidden bunker somewhere under a nondescrip building
    Posts
    161
    My Mood
    Stressed
    Thanks
    14
    Thanked 25 Times in 25 Posts

    Question How do you play wma or mp3 files in java?

    I was looking at the Sound API pages in the java tutorials. I was planning to use it to run wma files.

    Fortunately, for me, I found, soon into the tutorials, that these API DON'T support the type I have all of my files in (I have a ton of wma files but none of the libraries mentioned support them.)

    I almost thought I heard JavaFx or whatever it's called does, but that sounds foreign and Netbeans lists it as a separate type of java in a way, so I don't know if it would be cross-platform or if it could work with the JavaSE API.) Nor do I know what JavaSX or whatever it's called is really, other than that it's more for internet than application.

    If I wanted a JPanel or Applet acting as the content pane of a JFrame or being in a JFrame, could I use JavaFX (or whatever it's called) or some third party library (that I always tend to end up spending hours on trying to get it to find the jar files when I import them, so I hope I don't need too many jar files!!!! ) would it work with the JavaSE API?

    I don't know much about Java and playing sounds (other than that there is a static method, I think under Toolkit, that will play a system beep) with programs.

    However, I can see that that packages don't support certain types (so much for cross-platform!!!!!!! ) and also that a while back that Oracle took over and that they aren't really updating the Java Sound APIs really that much at all

    So, without having to learn a whole new Java set of standards (assuming JavaFX or whatever it's called is a different set of standards from JavaSE), is there a way to play .wma?


    That's all I seem to have on my computer.


    (I suppose I could create new sounds, though if Oracle isn't updating the library, who knows if even that works anymore , but if you're trying to run a Java Media Player that runs lots of DIFFERENT sound file types, this seems a real setback. )


    I heard you could convert them to MP3s (I heard there were free things that did it, but who knows if the things aren't filled with viruses that'll do it or, even if they're not, that they'll really mess up the quality of the sound and that I might lose the old .wma file in the process even if it doesn't corrupt the sound.)


    But, even if I get a .mp3, I heard the main JavaSE libraries DON'T cover that either, though it was said it was easier to make it run them than .wma files.


    MediaPlayer and the main JavaSE classes don't seem to be able to fit for this type of program (a java media player) that I was planning. Heck, they can't even play any music I have on my computer at all, media player or not.


    Is there a way to get around this? I'm not that familiar with 3rd party apps.

    (No, I don't have any code for this, which is a good thing as if I had tried to use the main JavaSE libraries, I would have spent a lot of time setting it up and learning, only to keep getting weird exceptions and not knowing why I kept getting them.)


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How do you play wma or mp3 files in java?

    This is more of a rant than a question. Can you condense it down to a simple question or two?

    While Java and applications written in Java are as cross-platform as they can be, there will always be proprietary file/data formats to contend with. Even those are occasionally "hacked" so that they can be used by open source software, but there's no guarantee that the hack will survive the owner's next modification to their format.

  3. #3
    Member GoodbyeWorld's Avatar
    Join Date
    Jul 2012
    Location
    Hidden command post deep within the bowels of a hidden bunker somewhere under a nondescrip building
    Posts
    161
    My Mood
    Stressed
    Thanks
    14
    Thanked 25 Times in 25 Posts

    Default Re: How do you play wma or mp3 files in java?

    I was asking, as it seems that they don't cover .wma or even .mp3 files in the JavaSE Sound APIs, is there a third party package that can do it?

    If so, do you have any idea what that third party could be?

Similar Threads

  1. Shoutcasting Internet Radio Streaming and playing Mp3 Files in J2me Midlet(Java):
    By pavankumarragi in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: July 14th, 2012, 02:02 PM
  2. Getting mp3 files from folder and sorting them using hashmap.
    By raamkum in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 31st, 2012, 03:45 PM
  3. Simple program to play 3 sound files
    By LarsAllan in forum Java Theory & Questions
    Replies: 1
    Last Post: May 17th, 2012, 06:58 AM
  4. Java mp3 Player
    By aNGaJe in forum Java Theory & Questions
    Replies: 1
    Last Post: October 21st, 2011, 09:49 AM
  5. Java Mp3 player.
    By alex901 in forum Object Oriented Programming
    Replies: 4
    Last Post: November 18th, 2010, 09:12 AM