2017-08-25 3 views
0

VLCからVLCをインストールする必要があるため、vlcjを使用してクライアント用のメディアプレーヤーを作成しようとしています。Javaアプリケーションにvlcライブラリを含めることはできません

私はそれがエラーを取得)私はEmbeddedMediaPlayerComponentを(追加するまで、それが正常に動作VLCの公式サイトから、このコードを取る

私が使用している場合

新しいNativeDiscovery()(発見します)。

私は私のPC

でVLCをインストールしますが、私は

プライベート静的最終列NATIVE_LIBRARY_SEARCH_PATH =「Cを使用する場合ので、それが正常に動作:\\プログラム ファイルを\\ VideoLANの\\ VLC ";

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

Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName()、LibVlc.class);私はコメントの権限を持っていないので

これは、エラーログ

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) 

ですあなたは私が私のプロジェクトに

答えて

0

をVLCをバンドルすることができます... が、それは可能です、あなたはより多くを持っています1つのVLCインストールがインストールされていますか? 理由は、64ビットのJDK/JREは32ビットのVLCインストールを使用できないということです。ちょうどVLCJがvlcの間違ったバージョンを見つけて、それからエラーを投げるかもしれないかどうか推測してください。ちょうどここで推測してください。

+0

を見つけることができる私は64ビットのVLCを使用して64ビットJDK – Ahmed

+0

@Ahmed あなたのエラーログを見ているとき、私はこれらの行を参照してください。 'INITX = nullの VLC:2.2.6傘をC:、2.2.6-0-g1aae789 libvlcチェンジセット私にとっては\プログラムファイル\ VideoLANの\ VLC \ libvlc.dll jna.library.path = nullを VLC_PLUGIN_PATH = null'なので をそれがlibVLC 2.2.6であるように思えますjnaへのライブラリパスは見つかりませんでしたか?また、VLC_PLUGIN_PATH環境変数が設定されていない可能性がありますか? – Payerl

1

私の最善の解決策は、自分の発見戦略を書いて、VLCライブラリをアプリケーションにバンドルすることでした。この方法では、VLCのインストールは必要ありません。すべてがアプリに付属しています。あなたはおそらく、未編集の上にリンクされたクラスを使用することができます

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

:ここ

が発見戦略の一例です。ここで

は使用例です:これに加えて、あなたは彼らがリンクのリソースフォルダに含まれているのと同じようにクラスパス上の該当するVLCライブラリを含める必要があります
final boolean found = new NativeDiscovery(new BundledVLCLibsDiscoveryStrategy()).discover(); 
     SwingUtilities.invokeLater(new Runnable() { 
      public void run() { 
       new Main(found); 
      } 
     }); 

プロジェクト。

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

は現在、私はこれだけでは、Windowsに取り組んで持っていますが、MACおよび/またはLinuxのために働いてそれを得ることができる場合、私はPRをいただければと思います!

+0

なぜこれがdownvotedされたかわかりません..完全に機能的なコードで、現在はプロダクションで使用されており、私にとっては有効なアプローチのようです。 –

1

この問題は、VLCJ - 3.10.1、JNA 4.1の組み合わせで観察されました。 私はpom.xmlファイルにJNA 4.2を追加して解決しました。

<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> 

次に、以下のコードを使用してVLC 2.2.6ライブラリを追加しました。

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

あなたはコードexample here

関連する問題