1
I am having difficulty starting this application along with an audio "Mixx.mp3". I have no errors, but the sound does not play.
public class MostrarLuta {
URL som = MostrarLuta.class.getResource("mixx.mp3");
AudioClip Som = Applet.newAudioClip(som);
public static void main(String[] args) {
TelaInicial telaInicial = new TelaInicial();
telaInicial.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//telaInicial.setSize(1366, 768); // tamanho da tela
telaInicial.setLocationRelativeTo(null); // centraliza o JFrame
telaInicial.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
telaInicial.setVisible(true);
MostrarLuta music = new MostrarLuta();
System.out.println(music.som);
System.out.println("\n"+music.Som);
music.Som.play();
}
}
Already installed mp3 plugin in java? https://www.oracle.com/technetwork/java/javase/download-137625.html
– Augusto Vasques
already installed, but it didn’t work. The solution I found was to convert mp3 audio to wav .
– danieltorresBR