List of usage examples for javafx.scene.media MediaPlayer setOnError
public final void setOnError(Runnable value)
From source file:filesmodel.SoundModel.java
/** @return a MediaPlayer for the given source which will report any errors it encounters */ public MediaPlayer createPlayer(String mediaSource) { final Media media = new Media(mediaSource); final MediaPlayer player = new MediaPlayer(media); player.setOnError(new Runnable() { @Override/*from w ww.j a v a 2 s.c o m*/ public void run() { System.out.println("Media error occurred: " + player.getError()); } }); return player; }