Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java mp3 player

import java.io.File;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;

String bip = "song.mp3";
Media hit = new Media(new File(bip).toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(hit);
mediaPlayer.play();
Comment

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();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: instantiate optinal java 8 
Java :: check self permission android write_external_storage 
Java :: arrays.tostring java 
Java :: how to initialize a set in java 
Java :: java does file exist 
Java :: java regex 10 digit number 
Java :: double quotes in string java 
Java :: java get all directories in path 
Java :: jbutton close jframe java 
Java :: print list array 
Java :: filtering out unique values from a list in java 
Java :: java convert java.util.Date to LocalDate 
Java :: break java 
Java :: android get distance between two locations kotlin 
Java :: java while loop example 
Java :: spannable string in android java for color 
Java :: java remove last character 
Java :: compare two character alphabetically java 
Java :: remove first and last character from string in java 
Java :: java get number out of string 
Java :: fill two dimensional array columns by columns java 
Java :: spring boot jackson infinite recursion 
Java :: springboot mongodb test 
Java :: java stream get all max values 
Java :: java clone matrix 
Java :: 123 movies 
Java :: Count Occurrences in Seven Integers Using Java Single Dimension Arrays 
Java :: how to change the value of an arraylist in java 
Java :: java variables 
Java :: retrofit post header 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =