title: video player in javafx with speed control (constant pitch)
body: <p>I am working with video player in javafx. In that video player I want controller like play,pause,stop and speed control.</p>
  
  <p>I have added a scroll bar to adjust speed of video</p>
  
  <p>I want that when adjusting the speed, the pitch of the video must not change.But when i adjust the speed of video its pitch get change.</p>
  
  <p>what will I do to keep constant pitch of video while adjusting the speed?
  Can anyone help ?</p>
  
  <p>Here is my code for seed control in video player :</p>
  
  <pre><code>// Add spped slider
          speedSlider = new Slider();
          HBox.setHgrow(speedSlider, Priority.ALWAYS);
          speedSlider.setMinWidth(10);
          //speedSlider.setMaxWidth(Double.MAX_VALUE);
          speedSlider.setMaxWidth(100);
          speedSlider.setPrefWidth(70);
          speedSlider.setValue(50);
          speedSlider.valueProperty().addListener(new InvalidationListener() 
          {
              public void invalidated(Observable ov) {
                  if (speedSlider.isValueChanging() || speedSlider.isPressed()) {
                      double rate = speedSlider.getValue()/10;
                      if(rate&lt;1)
                          rate = 0.5;
                      else if(rate &lt; 2)
                          rate = 0.6;
                      else if(rate &lt; 3)
                          rate = 0.7;
                      else if(rate &lt; 4)
                          rate = 0.8;
                      else if(rate &lt; 5)
                          rate = 0.9;
                      else if(rate &lt; 6)
                          rate = 1;
                      else if(rate &lt; 7)
                          rate = 1.1;
                      else if(rate &lt; 8)
                          rate = 1.2;
                      else if(rate &lt; 9)
                          rate = 1.3;
                      else
                          rate = 1.4;
                      mp.setRate(rate);
                   }
              }
          });
          mediaBarControl.getChildren().add(speedSlider);
  </code></pre>