2017-08-25 3 views
0

Ich versuche, Media Player für Clients mit vlcj ohne Notwendigkeit zu erstellen, VLC in ihren PCs von VLC zu installieren.Kann nicht enthalten vlc Bibliothek in Java-Anwendung

ich nehme diesen Code von der offiziellen Website von VLC es funktionieren, bis ich EmbeddedMediaPlayerComponent add() es Fehler erhalten

wenn ich

neue NativeDiscovery() verwenden, entdecken().

es gut arbeiten, weil ich VLC

in meinem PC installiert, aber wenn ich

private static final String NATIVE_LIBRARY_SEARCH_PATH = „C: \\ Programme Files \\ VideoLAN VLC \\ ";

NativeLibrary.addSearchPath (RuntimeUtil.getLibVlcLibraryName(), NATIVE_LIBRARY_SEARCH_PATH);

Native.loadLibrary (RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);

dieses Fehlerprotokoll

ist
14:49:08.471 [main]     INFO             uk.co.caprica.vlcj.Info - vlcj: 3.10.1 
14:49:08.482 [main]     INFO             uk.co.caprica.vlcj.Info - java: 1.8.0_131 Oracle Corporation 
14:49:08.482 [main]     INFO             uk.co.caprica.vlcj.Info - java home: C:\Program Files\Java\jre1.8.0_131 
14:49:08.483 [main]     INFO             uk.co.caprica.vlcj.Info - os: Windows 10 10.0 amd64 


V: 2.2.6 Umbrella 
14:49:08.831 [AWT-EventQueue-0]  DEBUG    uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent - args=[--video-title=vlcj video output, --no-snapshot-preview, --quiet-synchro, --sub-filter=logo:marq, --intf=dummy] 
14:49:08.841 [AWT-EventQueue-0]  DEBUG        uk.co.caprica.vlcj.player.MediaPlayerFactory - initX=null 
14:49:08.853 [AWT-EventQueue-0]  INFO         uk.co.caprica.vlcj.binding.LibVlcFactory - vlc: 2.2.6 Umbrella, changeset 2.2.6-0-g1aae789 
14:49:08.854 [AWT-EventQueue-0]  INFO         uk.co.caprica.vlcj.binding.LibVlcFactory - libvlc: C:\Program Files\VideoLAN\VLC\libvlc.dll 
14:49:08.854 [AWT-EventQueue-0]  DEBUG        uk.co.caprica.vlcj.player.MediaPlayerFactory - MediaPlayerFactory(libvlc=Proxy interface to Native Library <C:\Program Files\VideoLAN\VLC\[email protected]>,libvlcArgs=[--video-title=vlcj video output, --no-snapshot-preview, --quiet-synchro, --sub-filter=logo:marq, --intf=dummy]) 
14:49:08.855 [AWT-EventQueue-0]  DEBUG        uk.co.caprica.vlcj.player.MediaPlayerFactory - jna.library.path=null 
14:49:08.856 [AWT-EventQueue-0]  DEBUG        uk.co.caprica.vlcj.player.MediaPlayerFactory - VLC_PLUGIN_PATH=null 
[00000000007ecfc0] core libvlc error: No plugins found! Check your VLC installation. 
14:49:08.887 [AWT-EventQueue-0]  DEBUG        uk.co.caprica.vlcj.player.MediaPlayerFactory - instance=null 
14:49:08.888 [AWT-EventQueue-0]  ERROR        uk.co.caprica.vlcj.player.MediaPlayerFactory - Failed to initialise libvlc 
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Failed to initialise libvlc. 

This is most often caused either by an invalid vlc option being passed when creating a MediaPlayerFactory or by libvlc being unable to locate the required plugins. 

If libvlc is unable to locate the required plugins the instructions below may help: 

In the text below <libvlc-path> represents the name of the directory containing "libvlc.dll" and "libvlccore.dll" and <plugins-path> represents the name of the directory containing the vlc plugins... 

For libvlc to function correctly the vlc plugins must be available, there are a number of different ways to achieve this: 
1. Make sure the plugins are installed in the "<libvlc-path>/plugins" directory, this should be the case with a normal vlc installation. 
2. Set the VLC_PLUGIN_PATH operating system environment variable to point to "<plugins-path>". 

More information may be available in the log. 

at uk.co.caprica.vlcj.player.MediaPlayerFactory.<init>(MediaPlayerFactory.java:300) 
    at uk.co.caprica.vlcj.player.MediaPlayerFactory.<init>(MediaPlayerFactory.java:259) 
    at uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent.onGetMediaPlayerFactory(EmbeddedMediaPlayerComponent.java:349) 
    at uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent.<init>(EmbeddedMediaPlayerComponent.java:217) 
    at tutorial.Tutorial.<init>(Tutorial.java:68) 
    at tutorial.Tutorial$1.run(Tutorial.java:49) 
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) 
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) 
    at java.awt.EventQueue.access$500(Unknown Source) 
    at java.awt.EventQueue$3.run(Unknown Source) 
    at java.awt.EventQueue$3.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 

können Sie mir helfen zu bündeln VLC zu meinem Projekt

Antwort

0

Da ich keinen Kommentar Privilegien ... Ist es möglich, haben Sie mehr dann 1 VLC-Installation installiert? Der Grund für die Frage ist, dass ein 64bit jdk/jre nicht in der Lage ist, eine 32bit VLC-Installation zu verwenden und umgekehrt. Nur raten, ob es sein könnte, dass VLCJ eine falsche Version von vlc findet und dann einen Fehler ausgibt.

+0

i verwendet 64bit VLC und 64-Bit-JDK – Ahmed

+0

@Ahmed Wenn in Ihrem Fehlerprotokoll suchen sehe ich diese Zeilen: 'initx = null vlc: 2.2.6 Regenschirm , ChangeSet 2.2.6-0-g1aae789 libvlc: C: \ Programme \ VideoLAN \ VLC \ libvlc.dll jna.library.path = null VLC_PLUGIN_PATH = null' Für mich scheint es wie libvlc 2.2.6 ist gefunden, aber der Bibliotheksweg zur JNA ist nicht? Scheint auch wie VLC_PLUGIN_PATH Umgebung Variable möglicherweise nicht gesetzt? – Payerl

1

Die beste Lösung für mich war, meine eigene Discovery-Strategie zu schreiben und die VLC-Bibliotheken mit der Anwendung zu bündeln. Auf diese Weise ist eine Installation von VLC nicht erforderlich. Alles kommt mit der App.

Hier ist ein Beispiel für eine Entdeckung Strategie:

https://github.com/johndeverall/BehaviourCoder/blob/master/src/main/java/de/bochumuniruhr/psy/bio/behaviourcoder/BundledVLCLibsDiscoveryStrategy.java

Sie wahrscheinlich die verknüpfte Klasse über ungeschnittene verwenden können.

Hier ist ein Anwendungsbeispiel:

final boolean found = new NativeDiscovery(new BundledVLCLibsDiscoveryStrategy()).discover(); 
     SwingUtilities.invokeLater(new Runnable() { 
      public void run() { 
       new Main(found); 
      } 
     }); 

Zusätzlich zu diesem, werden Sie die entsprechenden VLC-Bibliotheken auf dem Classpath in der gleichen Art und Weise umfassen müssen, dass sie in den Ordner Ressourcen des verknüpften enthalten sind Projekt.

https://github.com/johndeverall/BehaviourCoder/tree/embedded_video_libraries/src/main/resources/lib

Zur Zeit habe ich nur diese auf Windows arbeiten, aber wenn Sie es Arbeit für Mac und/oder Linux bekommen kann ich einen PR schätzen würde!

+0

Nicht sicher, warum dies downvoted wurde .. es ist perfekt funktionaler Code, wird derzeit in der Produktion verwendet, und scheint wie ein gültiger Ansatz für mich. –

1

Ich beobachtete dieses Problem mit VLCJ - 3.10.1, JNA 4.1 Kombination. Ich löste es, indem ich JNA 4.2 in meiner pom.xml Datei hinzufüge.

<dependency> 
    <groupId>uk.co.caprica</groupId> 
    <artifactId>vlcj</artifactId> 
    <version>3.10.1</version> 
</dependency> 
<dependency> 
    <groupId>net.java.dev.jna</groupId> 
    <artifactId>jna</artifactId> 
    <version>4.2.0</version> 
</dependency> 

Dann VLC 2.2.6 Bibliothek unter Verwendung von unten Code hinzugefügt.

NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), System.getProperty("user.dir")+"/lib"); 
System.setProperty("VLC_PLUGIN_PATH", System.getProperty("user.dir")+"/lib/plugins"); 

können Sie finden Code example here