This code does not work. I took a class ready since it can be found here, but the music does not work. How can I fix this?
private void lblCliqueMouseClicked(java.awt.event.MouseEvent evt){
lblClique.setText("achou");
musica = new Som();
boolean repetir = false;
FileInputStream arquivo = null;
try {
arquivo = new FileInputStream("musica.mp3");
} catch (FileNotFoundException ex) {
Logger.getLogger(TelaProjeto.class.getName()).log(Level.SEVERE, null, ex);
}
musica.tocar(arquivo, repetir);
}
The error mark/reset not supported means the input stream you provided does not support setting a mark and resetting the stream to that mark. To achieve this, just wrap your FileInputStream inside a BufferedInputStream (see http://docs.oracle.com/javase/7/docs/api/java/io/BufferedInputStream.html)
InputStream arquivo=null;
...
arquivo=new BufferedInputStream(new FileInputStream(...));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With