video player – Why cant i play .avi movies in my JavaFX MediaPlayer

video player – Why cant i play .avi movies in my JavaFX MediaPlayer

JavaFX 2.2 doesnt play avi movies.

You should convert your avi movie to a format with JavaFX understands. Likely the best candidate format would be H.264 encoded video in a MP4 container. You can use utilities like ffmpeg to perform this kind of conversion.

The list of media containers, codecs and protocols supported by JavaFX is detailed in the JavaFX 2.2 media javadoc.

Additionally, ensure that your target machine meets the system requirements for the media type you wish to play.

You also need to supply the correct protocol to the media source when you try to play the media. From your stack trace it looks like you are trying to play your media from the file system, therefore you need to include the file: protocol in the media source string as specified in the Media constructor javadoc. For example:

Media media = new Media(file:/c:/media/warandpeace.mp4);

video player – Why cant i play .avi movies in my JavaFX MediaPlayer

Leave a Reply

Your email address will not be published. Required fields are marked *