Reputation: 311
I have created a sample code on Netbeans - Ubuntu 14.04 -the video plays normally outside this ..example from the same path.The path is on my machine only.
package javafxapplication1;
import java.io.File;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;
public class JavaFXApplication1 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
String workingDir = System.getProperty("user.dir");
System.out.println("workingDir"+workingDir);
File f = new File(workingDir, "the_appartition.flv");
//try{
//Media m = new Media(f.toURI().toString());
Media m = new Media("http://192.168.1.251/test/videos/the_appartition.flv");
System.out.println("media "+m.getSource());
MediaPlayer mp = new MediaPlayer(m);
MediaView mv = new MediaView(mp);
StackPane root = new StackPane();
root.getChildren().add(mv);
primaryStage.setScene(new Scene(root, 960, 540));
primaryStage.setTitle("Video Player 1");
primaryStage.show();
mp.play();
/*}
catch(Throwable t)
{
t.printStackTrace();
}*/
}
}
What can be the reason that it shows blank media player without any error/exception.
Upvotes: 0
Views: 1070
Reputation: 36792
There is a fixed JIRA for this issue
[Linux] JavaFX Media does not run on Ubuntu 14.04
It is fixed in Java 8u40 version. If you really want to run this, you might want to download and install the early available version of the JDK from JDK™ 8u40 Early Access Releases
Upvotes: 1