79324478

Date: 2025-01-02 17:19:33
Score: 1.5
Natty:
Report link

@Slaw

Setting the desired rate after play() has no effect. The workaround is to set rate=1 and then the actual rate as below.

MediaPlayer player = new MediaPlayer(new Media("myVideo.mp4"));
...
player.play();          // the rate is 1
player.setRate(2);      // the rate is 2
player.pause();         // the rate is 2

double rate = mediaPlayer.getRate();
player.play();          // the rate is 2, but the player plays the media at rate 1.
mediaPlayer.setRate(1);
mediaPlayer.setRate(rate);  // now the player plays at the rate 2

Mac OS, Java 22, Javafx 24-ea-15.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Slaw
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Evgeny