JavaFX : MediaException: MEDIA_UNSUPPORTED : media type not supported

。_饼干妹妹 提交于 2021-01-29 17:56:38

问题


I need to play the 3gp, mov and mp4 videos in the media player. Right now I am using JavaFx media player but it supports only mp4 videos. So what I can do to play the other two formats as well in this player or is there any other solution also available for this. Any help and suggestions please?

jdk = 1.7

JavaFx: 2.1


回答1:


Here is a list of JavaFX supported audio and video formats.

For anything unsupported by JavaFX, you have the option of either converting them to another format or finding a way to decode them inside your application.

There are libraries available for decoding, such as JCodec or Jffmpeg

You will need to do some further research to determine your exact requirements and which formats you will need to support. Some solutions are more difficult than others.




回答2:


The supported media types can be viewed on this page: Introduction to JavaFX Media

Quoting:

Video: FLV containing VP6 video and MP3 audio; MPEG-4 multimedia container with H.264/AVC (Advanced Video Coding) video compression

What you may do is convert your videos to .flc or .mp4 and you will be able to play them with JavaFX MediaPlayer.

Related StackOverflow questions:

Adding other video codecs / DVD support to JavaFX 2.2

How to play other video formats in JavaFX



来源:https://stackoverflow.com/questions/26378999/javafx-mediaexception-media-unsupported-media-type-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!