Mese
Mese

Reputation: 69

JavaFX MediaPlayer Error: Media invalid

I am having a problem with the JavaFX MediaPlayer. For testing purpose I downloaded the example from http://docs.oracle.com/javafx/2/media/playercontrol.htm and added some error-handling. When using the following error-handling

mediaPlayer.setOnError(new Runnable() {

  @Override
  public void run() {
    System.out.println(mediaPlayer.getError().getMessage());
    System.out.println(mediaPlayer.getError().getType());
  }
});

I get this console output:

[com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer@5482fb8f] "Error: Media invalid": "Error: Media invalid"
UNKNOWN

The video is encoded with h264 and aac (for audio) and is having a resolution of 1920x1168px. The error occurs with each video with a resolution greater than 1920x1080px. Vidoes with 1920x1080px or a smaller resolution are working fine. The playback of all videos is working with VLC-Player. I am using Java 7_51.

Does anybody have an idea how I could get the video running, or could it be, that videos with an higher resolution than 1920x1080px are not supported?

Upvotes: 1

Views: 2007

Answers (2)

Samuel Johnston
Samuel Johnston

Reputation: 11

This might have been caused by the video size. Iirc JavaFx mediaPlayers can only play videos up to 1920x1080. Anything noticeably larger than that will throw the Media_Invalid error.

Upvotes: 1

micha137
micha137

Reputation: 1295

This tutorial says "AAC and H.264/AVC decoding have certain platform-dependent limitations, as described in the Release Notes available at http://www.oracle.com/technetwork/java/javase/downloads/." Of course, every release has its own release notes, so the link from the tutorial is quite useless. After some searching one can find this table for Oracle JDK 8 and JRE 8 at the end under the heading "JavaFX Media" (sorry, no anchors on that page), giving platform specific notes about the used implementations. I didn't find or look for an equivalent for JDK 7, since this is a quite old question after all...

Upvotes: 2

Related Questions