I want to make the MediaPlayer of the JavaFX library play one song after another. The problem is that I have to determine which song is played next when it finishes playing one, for that reason I need to execute a code when it finishes playing. As the question says, I need an ActionListener. My idea is to execute a code when the state of the mediaplayer is Stop. In the following example I call the reprodutor in a simple way.
private Media musica=null;
static MediaPlayer reproductor = null;
musica = new Media(proximotema);
reproductor = new MediaPlayer(musica);
reproductor.play();
How can I execute a code when 'player' I finish the music and enter the state "STOPPED"?
since thanks