Mac OS JDK 1.8问题VLC控制JAWT无法加载 [英] mac os jdk 1.8 problems vlc control JAWT not load

查看:100
本文介绍了Mac OS JDK 1.8问题VLC控制JAWT无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load JAWT
    at com.sun.jna.Native.getWindowHandle0(Native Method)
    at com.sun.jna.Native$AWT.getComponentID(Native.java:1879)
    at com.sun.jna.Native.getComponentID(Native.java:253)
    at uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface.attach(CanvasVideoSurface.java:69)
    at uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer.attachVideoSurface(DefaultEmbeddedMediaPlayer.java:156)
    at uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer.onBeforePlay(DefaultEmbeddedMediaPlayer.java:315)
    at uk.co.caprica.vlcj.player.DefaultMediaPlayer.play(DefaultMediaPlayer.java:705)
    at uk.co.caprica.vlcj.player.DefaultMediaPlayer.playMedia(DefaultMediaPlayer.java:222)
    at viziosecure360.Travizia.AddPlayer(Travizia.java:675)
    at viziosecure360.Travizia.setDefault(Travizia.java:234)
    at viziosecure360.Travizia$1.run(Travizia.java:187)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

推荐答案

vlcj/LibVLC需要重量级的AWT组件来呈现其视频.

vlcj/LibVLC requires a heavyweight AWT component to render its video.

JDK 1.7和更高版本的OSX不再包含任何AWT.现在,OSX上的UI工具包是完全轻量级的.

There is no longer any AWT in JDK 1.7 and later on OSX. The UI toolkit on OSX is now fully lightweight.

因此在OSX上使用vlcj的最佳方法不再起作用.

So the optimal way of using vlcj on OSX no longer works.

您要做的是使用所谓的而不是嵌入式"媒体播放器.

What you have to do is use the so-called "direct" media player [1] rather than the "embedded" one.

使用直接媒体播放器的缺点是,您必须使用BufferedImage,硬件加速的易失性图像,PixelWriter或其他方式以某种方式自己渲染视频.

The downside to using the direct media player is that you have to render the video yourself somehow, using a BufferedImage, a hardware accelerated volatile image, a PixelWriter or something else.

这种方法通常使用更多的内存和更多的CPU,并且更加不便.

This approach typically uses more memory and more CPU, and is a bit more inconvenient.

从好的方面来说,使用这种方法可以实现流畅的高清视频播放.

On the plus side, it is possible to achieve smooth HD video playback using this method.

从好的方面来说,您可以根据需要以某种方式处理视频缓冲区,并使用此方法轻松地将轻量级的小部件/标签覆盖在视频上方.

Also on the plus side, you can process the video buffer in some way if you want, and easily overlay lightweight widgets/labels on top of the video using this approach.

vlcj测试源中提供了一个示例,该示例显示了执行此操作的一种方法(此处有太多代码无法复制,因此我将提供

There is an example provided in the vlcj test sources that shows one way how to do this (there is too much code to reproduce here so I'll provide a stable link [2]).

项目问题跟踪器[3] 上也有很长的讨论这个主题.

There is also a long discussion in the project issue tracker [3] on this subject.

[1] [2] https://github.com/caprica/vlcj/blob/vlcj-3.0.1/src/test/java/uk/co/caprica/vlcj/test/direct/DirectTestPlayer.Java

[3] https://github.com/caprica/vlcj/issues/205

令人惊讶的是,有一个潜在的解决方案,尽管显然不是最佳选择,它是在使用Wine的OSX上使用Windows 1.7/1.8 JVM.我没有尝试过,但是有人告诉我它有效.

Amazingly there's a potential, though clearly sub-optimal, solution which is to use a Windows 1.7/1.8 JVM on OSX using Wine. I have not tried it but I have been told it works.

这篇关于Mac OS JDK 1.8问题VLC控制JAWT无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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