我使用 Xuggler 5.4 制作了屏幕录像机和播放器应用程序。我是在Windows 8 64位环境下开发的。我已将其作为 WebStart 项目并在 MAC 10.8 64 位中启动(.jnlp)。当我运行它时,记录器工作正常,但是当我在我的播放器中打开它时,它会抛出异常
Exception in thread "stopThread" java.lang.RuntimeException : Unhandled and unknown native exception
at com.xuggle.xuggler.XugglerJNI.IContainer_open__SWIG_0( Native Method )
at com.xuggle.xuggler.IContainer.open(IContainer.java:597 )
就 Windows 而言,情况并非如此...... 我对 Xuggler 非常陌生。我不知道这个异常意味着什么。这是我得到这个异常的代码行。
if (container1.open( fileName, IContainer.Type.READ, container1.getContainerFormat()) < 0) {
throw new IllegalArgumentException("could not open file: " + fileName);
}
提前致谢。
P.S:我只使用了相同版本的 Java (1.7.0_65) 和 Oracle。
最佳答案
我得到了解决方案..
我改变了打开容器的方法。
以前的方法:
if (container1.open( fileName, IContainer.Type.READ, container1.getContainerFormat()) < 0) {
throw new IllegalArgumentException("could not open file: " + fileName);
}
新方法:
InputStream inputStream = null ;
try {
inputStream = new FileInputStream(new File("fileName"));
} catch (FileNotFoundException e2) {
logger.error("File not found ");
}
IContainerFormat format = IContainerFormat.make();
format.setInputFormat("flv");
container1 = IContainer.make();
if (container1.open( inputStream , format) < 0) {
throw new IllegalArgumentException("could not open file: " + fileName);
}
这适用于 MAC 操作系统..
奇怪但真实
关于java - Xuggler 与 MAC 操作系统的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25140684/