when I run this JavaFX 8 application (video playback test) from Eclipse IDE, everything is fine. Application run video playback in loop indefinitely. But when I run this application from command line:
java -jar test-javafx8-video-playback-jar-with-dependencies.jar
it just playback for some seconds and then freeze the playback. Here is a application source code: test-javafx8-video-playback
Please advise, thanks.
OK, here is a code snippet that plays video:
private void playBallMixingAnimation() {
Media media = new Media(KenoKaironMain.getResourceURIFromProperties(KenoKaironMain.BALL_MIXER_URI_KEY));
MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
mediaPlayer.setMute(true);
mediaPlayer.setAutoPlay(true);
animMediaView.setMediaPlayer(mediaPlayer);
}
As I said, it works in indefinite loop in Eclipse, but not when I start application from command line. Eclipse is using jdk1.8.0_51 and Windows/OSX is using jre1.8.0_51 and I have more than enough RAM for this small application.
Here is what I found out.
It is all about supported media formats. As you might know JavaFX supports this video formats:
FLV container with MP3 and VP6
MPEG-4 container with either AAC, H.264, or both
Only FLV video file with On2's VP6 encoding will play in indefinitely loop both started from Eclipse IDE or from command line.
MPEG-4 container with either AAC or H.264 will play in indefinitely loop only from Eclipse IDE and will freeze after first loop when started from command line.
This I tested using Oracle FLV sample: http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv and confirmed by using this FLV sample: http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv
For the MPEG-4 you can try by your self and make sure that it won't work in indefinitely loop from command line.
My test configuration is: OS X 10.9.5, Java JDK 1.8.0_51, Eclipse Luna (4.4.1) and code snippet I posted above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.