How to create a media player in Java without JMF?
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 (MalformedUR开发者_开发技巧LException 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
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.
精彩评论