我正在尝试使用javafx 2.0制作音乐播放器。
我可以获得.mp3文件的详细信息,但我无法获取m4a和.wav歌曲的元数据详细信息。我怎样才能解决这个问题?
ObservableMap<String,Object> meta_data=media.getMetadata();
meta_data.addListener(new MapChangeListener<String,Object>(){
public void onChanged(MapChangeListener.Change<? extends String, ? extends Object> ch) {
if(ch.wasAdded()){
String key=ch.getKey();
Object value=ch.getValueAdded();
switch(key){
case "album":
System.out.println("Albume: "+value.toString());
break;
case "artist":
System.out.println("Artist: "+value.toString());
break;
case "title":
System.out.println("Title: "+value.toString());
break;
case "year":
System.out.println("Year: "+value.toString());
break;
case "genre":
System.out.println("Genre: "+value.toString());
break;
case "image":
image.setImage((Image)value);
break;
}
}
}
});