自己做个小网站,需要用到音乐播放器,没用过..谁能推荐几个好的播放器啊??
还有能说说它的原理最好了。
能把源码和实例发给我那又是大大的好了.. [email protected]最好能轻松换样式,歌词同步的那种呢,像google音乐的播放器,还有播放列表的那种
多谢了,在线等哦..
还有能说说它的原理最好了。
能把源码和实例发给我那又是大大的好了.. [email protected]最好能轻松换样式,歌词同步的那种呢,像google音乐的播放器,还有播放列表的那种
多谢了,在线等哦..
代码如下
<embed src=http://www.digitime.com.cn/happy/juliet.mp3 type=audio/x-pn-realaudio-plugin controls=StatusBar,ControlPanel width=199 height=50 border=0 autostart=true>播放列表你就自己从数据库中读出来了,这应该不难的
import java.awt.*;
import java.awt.event.*;
import java.net.*;import javax.swing.*;
import java.io.File;class AudioPlayDemo extends JFrame implements ActionListener {
boolean looping = false;
File file1 = new File("music\\明天会更好.wav");
AudioClip sound1;
AudioClip chosenClip; JButton playButton = new JButton("播放");
JButton loopButton = new JButton("循环播放");
JButton stopButton = new JButton("停止");
JLabel status = new JLabel("选择播放文件");
JPanel controlPanel = new JPanel();
Container container = getContentPane(); public AudioPlayDemo() {
try {
sound1 = Applet.newAudioClip(file1.toURL());
chosenClip = sound1;
} catch(OutOfMemoryError e){
System.out.println("内存溢出");
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
playButton.addActionListener(this);
loopButton.addActionListener(this);
stopButton.addActionListener(this);
stopButton.setEnabled(false); controlPanel.add(playButton);
controlPanel.add(loopButton);
controlPanel.add(stopButton); container.add(controlPanel, BorderLayout.CENTER);
container.add(status, BorderLayout.SOUTH); setSize(300, 130);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //关闭窗口时退出程序
}public void actionPerformed(ActionEvent event) {
if (chosenClip == null) {
status.setText("声音未载入");
return;
}
Object source = event.getSource(); //获取用户洗涤激活的按钮 if (source == playButton) {
stopButton.setEnabled(true);
loopButton.setEnabled(true);
chosenClip.play();
status.setText("正在播放");
} if (source == loopButton) {
looping = true;
chosenClip.loop();
loopButton.setEnabled(false);
stopButton.setEnabled(true);
status.setText("正在循环播放");
}
if (source == stopButton) {
if (looping) {
looping = false;
chosenClip.stop();
loopButton.setEnabled(true);
} else {
chosenClip.stop();
}
stopButton.setEnabled(false);
status.setText("停止播放");
}
}
public static void main(String s[]) {
new AudioPlayDemo();
}
}
http://www.lanrentuku.com/lanren/musicplayer/
你看看有没有合适的