List of usage examples for javafx.scene.media MediaPlayer getError
public final MediaException getError()
null
if there is no error. 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 ww w . j a v a2 s .c om public void run() { System.out.println("Media error occurred: " + player.getError()); } }); return player; }