How to create a media player in Java without JMF?

南笙酒味 提交于 2020-01-06 04:31:07

问题


How to create a media player in Java without using the JMF? Some blogs say it's an old version. I also tried using JMF - this is my code.

public class MediaPlayer {

    public static void main(String[] args) {
         Player p;
         try {
            p = Manager.createPlayer(new URL("http://192.168.1.113/asmitha/1.mp4"));
            p.start();
        } catch (NoPlayerException e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

This is the message I am getting:

LINEAR, Unknown Sample Rate * out * LINEAR, 8000.0 Hz, 16-bit, Stereo, LittleEndian, Signed, class [S

回答1:


JMF 2.1 is the latest version, and that was released a long time ago. JMF will probably not support all codec formats. That is probably why you are not able to play the file. There are also a lot of codec licensing issues.

There is a JMF performance pack for windows & *nix which will support more codecs than the default installation. Try that. If that doesn't work take a look at ffmpeg or VLC-J.



来源:https://stackoverflow.com/questions/7146341/how-to-create-a-media-player-in-java-without-jmf

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