Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

mp3 player Java

public void playSound() {
    try {
        AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("D:/MusicPlayer/fml.mp3").getAbsoluteFile());
        Clip clip = AudioSystem.getClip();
        clip.open(audioInputStream);
        clip.start();
    } catch(Exception e) {
        System.out.println("Error with playing sound.");
        e.printStackTrace();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #player #Java
ADD COMMENT
Topic
Name
3+8 =