//为什么我调用系统自带的多媒体播放器可以播放我想要打开的MP3文件,而调用网易云音乐只能打开网易云音乐,但是不会打开我需要打开的MP3文件
package IODemo;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyMp3Demo {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
copyMp3_1();
}
private static void copyMp3_1() throws IOException, InterruptedException {
// TODO Auto-generated method stub
FileInputStream fis = new FileInputStream("惊鸿一面.mp3");
FileOutputStream fos = new FileOutputStream("惊鸿一面之我是SB.mp3");
byte[] buf = new byte[1024];
while ((fis.read(buf)) != -1) {
fos.write(buf);
}
Runtime rt = Runtime.getRuntime();
//调用网易云音乐
// Process p = rt.exec("C:\Program Files (x86)\Netease\CloudMusic\cloudmusic.exe C:\Users\Administrator\Desktop\Java\day13\惊鸿一面.mp3");
//调用系统自带的多媒体播放器
Process p = rt.exec("C:\Program Files (x86)\Windows Media Player\wmplayer.exe C:\Users\Administrator\Desktop\Java\day13\惊鸿一面.mp3");
Thread.sleep(50000);
p.destroy();
fis.close();
fos.close();
}
}