[英]java - best way to compare mp3 and wav files with different specifications?
[英]What is the best way to play “*.mp3” files in java?
我可以使用 VLC 或 MPlayer 的接口吗? 我只想要一个能够在 linux 机器上播放歌曲的接口 (Servlet -> Java)。
看起来这就是你想要的, JLayer
String[] libvlcArgs = {...add options here...};
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(libvlcArgs);
FullScreenStrategy fullScreenStrategy = new DefaultFullScreenStrategy(mainFrame);
EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer(fullScreenStrategy);
String[] standardMediaOptions = {"video-filter=logo", "logo-file=vlcj-logo.png", "logo-opacity=25"};
mediaPlayer.setStandardMediaOptions(standardMediaOptions);
mediaPlayer.addMediaPlayerEventListener(new MediaPlayerEventAdapter() {...add implementation here...});
Canvas videoSurface = new Canvas();
mediaPlayer.setVideoSurface(videoSurface);
String mediaPath = "/path/to/some/movie.mpg";
String[] mediaOptions = {};
mediaPlayer.playMedia(mediaPath, mediaOptions);
// Do some interesting things in the application
...
mediaPlayer.release();
mediaPlayerFactory.release();
此任务不需要 JMF。 只需将 JMF 的 mp3plugin.jar 添加到应用程序的运行时类路径中。 然后 Java 声音将能够读取和播放 MP3。
您还可以查看VideoLAN 的 Java 绑定。
无论哪种方式,它都需要一个小程序或 JWS 启动的应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.