How to stream mp3 using pure Java

自作多情 提交于 2019-12-17 13:55:21

问题


Is it possible to stream mp3s using pure Java? If so, what are the best resources to implement this.

If not, are any other music formats streamable using Java only?


回答1:


As Mario says, JMF - Java Media Framework is a good starting point.

What Mario does not say is that Sun killed MP3 support since 2.1.1b as detailed in the "My Lost Streaming MP3 Article" blog entry.

So you need to add a plugin to support MP3:
the JMF Formats list does mention MP3 (under the ACM -- Window's Audio Compression Manager support -- section), but only for Windows, and not with JMF alone.




回答2:


You could use MP3SPI from JavaZoom to stream MP3 files

As it says on their webpage: "MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer, .... "

People have already used it to build applicatons that stream from Shoutcast


Hope this helps




回答3:


I think you can use the Java Media Framework from SUN to achieve what you want. Being this the official SUN implementation this would be the way to go. I am pretty sure that the actual streaming is native though.

I looked in the FAQ and I found the following answer:

Q: Will JMF 2.1.1 support streaming?

Yes. JMF 2.1.1 provides RTP/RTSP streaming support.

JMF 2.1.1 also provides HTTP and FTP streaming support on the client side.



来源:https://stackoverflow.com/questions/657921/how-to-stream-mp3-using-pure-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!