Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/07/2012, 13:22
CristtGunners
 
Fecha de Ingreso: julio-2012
Mensajes: 3
Antigüedad: 11 años, 10 meses
Puntos: 0
Exclamación Problema Con AudioFileFormat

String duration;

duration = this.getDurationWithMp3Spi(st);//st es el file que cargo.(El file es de formato mp3)

public String getDurationWithMp3Spi(File file) throws UnsupportedAudioFileException, IOException {

AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(file);
if (fileFormat instanceof AudioFileFormat) {
Map<?, ?> properties = ((AudioFileFormat) fileFormat).properties();
String key = "duration";
Long microseconds = (Long) properties.get(key);
int mili = (int) (microseconds / 1000);
int sec = (mili / 1000) % 60;
int min = (mili / 1000) / 60;
System.out.println("time = " + min + ":" + sec);
String ti = String.valueOf(min)+":"+String.valueOf(sec);
return ti;
} else {
throw new UnsupportedAudioFileException();
}

todo bien solo que al hacer AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(file); falla por que no soporta el tipo de archivo

ayudaaaaa pliss !!