开发者

How play stream MP3 from URL? (Java) [duplicate]

开发者 https://www.devze.com 2023-03-02 07:17 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to stream mp3 using pure Java
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to stream mp3 using pure Java

I have URL, example http://mysite.ru/1.mp3. I need play this song in开发者_JAVA技巧 desktop.

How to do this?

I know that this question asked many times, but I was not able to find the answer. How to use the library?

update:

I need example


One way would be to download it to a temporary File and use Desktop.open(File).


Java Media Framework can play mp3 files, however, I've never used it with remote files.


If you are interested in pure Java solution then Java Media Framework can help. But if you need to install JMF Mp3 plugin


Using JMF available at http://www.oracle.com/technetwork/java/javase/download-137625.html, have you tried it:

private Player player = Manager.createPlayer(new URL("http://mysite.ru/1.mp3"));    
player.start();

?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号