Loading mp4 files
Hi, I have a javafx program.
It has an mp4 file located at Slider/src/slider/universe.mp4
where slider is the main package of the project, in which all the classes are.
When running file from within netbeans 7.2.1,
I am able to load the mp4 file using:
media = new Media(new File("src/slider/universe.mp4").toURI().toURL().toExternalForm().toString());
This works well, and the movie repeats over and over due to:
MediaPlayer player = new MediaPlayer(media);
player.setCycleCount(MediaPlayer.INDEFINITE);
So my problem is: When building the project, I get a jar file, but when running the jar file, it has a problem finding the file.
Basically with the code above, with the jar on my desktop, it gives the exception:
Caused by: MediaException: MEDIA_UNAVAILABLE : C:\Users\colin\Desktop\src\slider\universe.mp4 (The system cannot find the path specified)
And that obviously isn't right.
Can anyone help me get it to work, also I'd like it so the movie repeats, I managed to get it to play through jar file using
media = new Media(this.getClass().getResource("src\slider\universe.mp4").toExternalForm()); But it doesn't repeat using this.
Thanks for any help.