问题
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