title: JavaFX 8 Media Player Progress Slider
body: <p>So, I have been developing a Media Player application using JavaFX for some time. Unfortunately I have come accross a problem which I don't know how to fix. The slider in my GUI that is supposed to show the video's progress is not working properly. It ends too early. So the video continues until it ends, but the slider has already stopped.</p>
  
  <p>Any help would be greatly appreciated. </p>
  
  <pre><code>Double time = player.getTotalDuration().toSeconds();
  
      player.currentTimeProperty().addListener((ObservableValue&lt;? extends Duration&gt; observable, Duration oldValue, Duration newValue) -&gt; {
          slider.setValue(newValue.toSeconds());
      });
      slider.setOnMouseClicked((MouseEvent mouseEvent) -&gt; {
          player.seek(Duration.seconds(slider.getValue()));
      });
  </code></pre>