Search code examples
javavideocanvasimportvlcj

Error importing windowscanvas


Hi I am developing a quiz application. For playing audio/video I use vlcj player. I've always displayed the video/audio in a separate JFrame, but now I would like to place it in a jpanel and add it to a Jframe where the question is already displayed.

I've found a post in here where someone tries to do this: here

But when i copy and use this code i get an error with importing this line:

import uk.co.caprica.vlcj.runtime.windows.WindowsCanvas;  

All the other things are imported well. I am using : jna -3.5.2, platform -3.5.2, vlcj- 3.0.1

Anybody knows whats wrong? Am I using a wrong version?

Thanks ahead !


Solution

  • WindowsCanvas was present in old versions of vlcj but is now obsolete.

    It used to be needed to get keyboard and mouse events from the native video surface propagated to the Java application, while video was playing,

    This WindowCanvas used an installation of a native global mouse/keyboard event hook on Windows - which was never an optimal solution - and could cause a fatal JVM crash when your application exited.

    With contemporary versions of vlcj and VLC, this is no longer required and so has been removed.

    Additionally, the Javadoc for EmbeddedMediaPlayer in vlcj states:

    Note that to get mouse and keyboard events delivered via listeners on some platforms (i.e. Windows) you will likely need to invoke setEnableMouseInputHandling(boolean) and setEnableKeyInputHandling(boolean)}