Reputation: 23
I'm doing a Java based media-player but I have a problem showing the video in full screen.
When I use components.getMediaPlayer().setFullScreen(true);
I get the following error:
Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError: Unable to load library 'X11': JNA native support (win32-x86/X11.dll) not found in resource path
I use a JVM 32Bit, JNA 3.5.2 and VLCJ 3.0.1.
From what I have seen is loading the 32bit libraries but my OS is 64bit. Is this the problem?
Upvotes: 1
Views: 611
Reputation: 4146
It looks like you are trying to load the X11 library in Windows.
That is not going to work.
vlcj uses the X11 native library on Linux to switch a Java JFrame to full-screen.
On Windows, vlcj provides a different native solution using the Win32 API.
So on Windows you can do something like this when you create your media player:
mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
@Override
protected FullScreenStrategy onGetFullScreenStrategy() {
return new Win32FullScreenStrategy(frame);
}
};
On Linux you would use something like this:
mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
@Override
protected FullScreenStrategy onGetFullScreenStrategy() {
return new XFullScreenStrategy(frame);
}
};
Of course if you want to support either/or, you can make a conditional check at runtime, something like:
mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
@Override
protected FullScreenStrategy onGetFullScreenStrategy() {
if (RuntimeUtil.isWindows()) {
return new Win32FullScreenStrategy(frame);
}
else {
return new XFullScreenStrategy(frame);
}
}
};
Why is full-screen functionality implemented this way?
It is because full-screen functionality using core Java is unreliable - on some Windows versions it may be full-screen apart from the task bar for example, and on some Linux window managers it may not work at all.
To answer your question about 32-bit DLL vs 64-bit OS: what matters here is whether your JVM architecture is 32-bit, i.e. the JVM architecture must match the architecture of the shared libraries that you are trying to load.
Upvotes: 1