I've created a basic JavaFX Media Player. On my Windows 10 OS, everything works fine, and it functions exactly as it's supposed to.
private MediaPlayer initializeMediaPlayer(){
Media media = new Media(getClass().getResource("1-1.mp4").toString());
MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaPlayer.setAutoPlay(true);
mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
mediaPlayer.setRate(1.25);
mediaPlayer.setMute(true);
return mediaPlayer;
}
Yet, when I run this code on Windows 7, the video doesn't loop: it plays for five seconds and at the end of the video, the video just freezes. Given that the video is only 5 seconds long, the loop is absolutely essential for this program to work properly.
Here is what I know about this problem:
- The problem ONLY persists for mp4 files on Windows 7. When ran the program with oracle's example .flv file (i.e. http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv), it worked fine. Converting my mp4 files to flv is not an option.
- The program works fine on all the Windows 10 computers I've run it on. This problem only occurs in Windows 7, but I have not tested it on any other operating systems. I need to eventually run this program in a lab with only Windows 7 computers.
- All the other MediaPlayer parameters (i.e. set autoplay, setMute, and setRate) work fine in both Windows 10 and Windows 7. It's just the setCycleCount attribute that doesn't seem to work on Windows 7.
- On all the test computers, I made sure the Java was updated to the most recent version. I am using Java 8 update 144.