如何在没有 JMF 的情况下用 Java 创建媒体播放器? [英] How to create a media player in Java without JMF?

查看:22
本文介绍了如何在没有 JMF 的情况下用 Java 创建媒体播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用 JMF 的情况下用 Java 创建媒体播放器?有些博客说这是旧版本.我也尝试使用 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 (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

这是我收到的消息:

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

推荐答案

JMF 2.1 是最新版本,很久以前就发布了.JMF 可能不会支持所有编解码器格式.这可能就是您无法播放文件的原因.还有很多编解码器许可问题.

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.

有一个适用于 windows & 的 JMF 性能包*nix 将支持比默认安装更多的编解码器.试试那个.如果这不起作用,请查看 ffmpegVLC-J.

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.

这篇关于如何在没有 JMF 的情况下用 Java 创建媒体播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆