Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

could not get audio input stream from input stream

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

following problem:


throws the exception:

Exception in thread "main" javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input stream
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102)
at test.Main.main(Main.java:35)
Java Result: 1



i understand that mp3 is not supported by java, but what really confuses me, theres a java player which is open source, called: jlGui
and it just plays nearly everything, even the mp3 stream... so i checked the source and... i cant get it

the following source is used by jlgui:

and

m_dataSource is a BufferedInputStream without any modification...

please can someone tell me how is that working? i just dont understand it
 
Sheriff
Posts: 22506
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may install support for MP3 earlier, perhaps in a static initializer or something. (This is just a guess though.)
 
olze oli
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your quick reply

sounds interesting, can you give me some informations how this could be achieved?
i just saw a .jar file which looks like the implementation i'm looking for, called mp3spi - it is a part of the player - unfortunatly without documentation (howto)
maybe i can find what i'm looking for in the source...
 
olze oli
Ranch Hand
Posts: 187
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

just copied jl.jar mp3spi.jar and tritonus_share.jar to my classpath and its just working
 
Rob Spoor
Sheriff
Posts: 22506
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just downloaded mp3spi as well, and found out it's using the ServiceLoader mechanism: inside the JAR file, inside the META-INF/services folder, there are two files that will be used by ServiceLoader to inject the MP3 decoder into the Java audio system.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

olze oli wrote:
just copied jl.jar mp3spi.jar and tritonus_share.jar to my classpath and its just working



I download these files and copy en my project, but don't run because always says the message. Are there others things that those?? Can you help me, please???

I've this code:



 
olze oli
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean with "says the message"? The same message as mine in the first post? I noticed that some mp3 files are not recognized. First check on a "regular" mp3 file if its working.
You can use the mp3spi player (on the same site, javalayer) to test if it *should* work. If it does in that player, you can be sure that the problem exists in your application.
Make sure your classpath contains that classes. If so, it should play that file/stream.
 
Damaso Lopez
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

olze oli wrote:What do you mean with "says the message"? The same message as mine in the first post? I noticed that some mp3 files are not recognized. First check on a "regular" mp3 file if its working.
You can use the mp3spi player (on the same site, javalayer) to test if it *should* work. If it does in that player, you can be sure that the problem exists in your application.
Make sure your classpath contains that classes. If so, it should play that file/stream.



Yeah your message "couldn't get audio input stream from input stream" Ok! I prove it, the problem is I do not have any mp3 file, it all comes from UDP. Do you change anything next posts? because after then receive(datagrampacket);
I put this line:

line.write(datagrampacket.getData(),0,datagrampacket.getLenght()); I can listen to the music
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic