Reputation: 63
I apologize if I have missed the answer to this elsewhere but I have searched high and low on here, Oracle, and the web and can find no support for my problem.
Short Story: I wrote a JavaFX 2.2.7 based media player, which has been proven to play supported local and remote video files, but won't play HTTP Live Streams. Tried SSCCE Directly from Oracle, Upgraded to JavaFX2.2.21 and also tried running in Java 7 JRE. HTTP Live Streaming does not work.
Backstory:
I have written a JavaFX 2.2.7 based media player embedded in a Java 6 Swing Application (using JPanels etc). I can play a local file of the supported format (e.g Sintel trailor mp4 h264) and can also play remote files of the supported format (for instance an FLV file located directly from oracle.com).
Problem: When I try and use an "HTTP Live Stream" (HLS), nothing plays. Assigning an HTTP Live Streaming URL to a javafx.scene.media.Media object does not seem to work. I end up with a blank player, but there are no exceptions or errors.
I can apparently successfully instantiate a Media object from an HLS URL without errors:
private static final String MEDIA_URL = "http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8";
Media media = new Media(MEDIA_URL);
MediaException ex = media.getError();
if( ex != null ) {
System.out.println("Media Error" + ex.getMessage());
} else {
System.out.println("No Media Error");
}
Program console output: "No Media Error"
Troubleshooting Steps I have Tried:
I thought it was something wrong with my player code so I went to http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/index.html#SAMPLES/Media/Streaming%20Media%20Player and copied the source directly and ran it... Unfortunately the same result occurs. The "Ensemble Streaming Media Player" runs, but simply shows a blank video window. The media controls and sliders are available, but no video plays. (It is important to note that the player works in my web browser, and the Rap video is terrible.)
Based on the Release notes for Java 2.2.7 I was under the impression that HLS was supported. Fearing I was wrong in my assumptions, I tried upgrading to standalone JavaFX 2.2.21 and this did not fix the problem. The result is exactly the same. No exceptions, no errors, and no video.
I cannot upgrade to Java 7 (I am firmly stuck with Java 1.6.0.32 due to project constraints), but for the sake of argument I have attempted running the Ensemble media player code on Java 7, and the result is the same.
Any assistance someone can provide would be greatly appreciated.
(For a SSCCE you can view the code I tried using verbatim at the Oracle Streaming Media Player Link above.)
Thanks in advance to anyone who can assist!
Upvotes: 2
Views: 3239
Reputation: 63
My Conclusion: Http Live Streaming does not work with JavaFX 2.2.7 or 2.2.21 and Java 1.6.0_32.
I believe that I have proven that the problem lies with JavaFX 2.2.7 and JavaFX 2.2.21, and that using the new JavaFX bundled with Jre7 solves the issue.
I created an entirely new project, and added the JavaFX jar files bundled with JRE 7 to my build path. I copied the code from http://download.oracle.com/otndocs/products/javafx/2/samples/Ensemble/index.html#SAMPLES/Media/Streaming%20Media%20Player and it works.
So I performed some modifications to my original Java Eclipse project.
Removed the from build path:
Added to build path:
Still using the Java 1.6.0_32 runtime, I ran my application and everything worked.
Of course, this feels like a giant hack. I am disappointed with the release notes regarding JavaFX 2.2.7.
NOTE: To export my application as a runnable Jar, I also had to pull the JavaFX related ".dll" libraries from JRE 7 and add them to the java.library.path (using a batch script) before running the jar.
Upvotes: 1