I am building a small Swing application that I would like to embed a movie within. Importantly, this application is a WebStart application - and the library should be able to be packaged within the jnlp that I launch -i.e, not dependent on native libraries.
I am aware of and have tried JMF but the format compatibility I believe to be relatively poor when compared to other frameworks out there.
Could someone please provide a sample code snippet of a simple implementation using their recommended library?
Many thanks in advance.
Some considerations for JavaFX as a solution as a Java based media playback framework.
Here is a sample JavaFX app which plays a video:
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.media.*;
import javafx.stage.Stage;
public class VideoPlayerExample extends Application {
public static void main(String[] args) throws Exception { launch(args); }
@Override public void start(final Stage stage) throws Exception {
final MediaPlayer oracleVid = new MediaPlayer(
new Media("http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv")
);
stage.setScene(new Scene(new Group(new MediaView(oracleVid)), 540, 208));
stage.show();
oracleVid.play();
}
}