My JavaFX MP3 Player 2("Displaying METADATA")

My JavaFX MP3 Player 2("Displaying  METADATA")

This is a continuation of my javafx player ,you can check my previous post on javafx mp3 player here .This is a new implementation that adds a new capability to my media player  that is displaying a file's metadata (data that describes a file )in our case an mp3 file.I just added a VBox with labels and an imageview to my previous javafx player, that displays the metadata,
The data might be artist,year,album,genre,album cover and many more.You can get more info about ID3 tag  at Wikipedia.

A screenshot of the new Implementation.

Code snippets

Javafx Media class has a method that gets metadata and returns the metadata in an ObservableMap<String,Object>.

Heres an basic example of my method i only need album,artist,title,year,album cover metadata.

      Media media=new Media("mp3 file");

     ObservableMap<String,Object> meta_data=media.getMetadata();

     meta_data.addListener(new MapChangeListener<String,Object>(){
          public void onChanged(Change<? extends String, ? extends Object> ch) {  

                   String key=ch.getKey();
                   Object value=ch.getValueAdded();

               case "album":
                   album.setText("Album: "+value.toString());
               case "artist":  
                   artist.setText("Artist: "+value.toString());
               case "title":
                   title.setText("Title: "+value.toString());
               case "year":
                   year.setText("Year: "+value.toString());
               case "image":

Video sample


Popular Posts