Skip to content

DllNotFoundException: VLCUnityPlugin

Summary

Using slightly edited version of minimalplayback example, everything works in Editor but when exporting a build and running the build.exe, getting DllNotFoundException: VLCUnityPlugin

Minimal project and steps to reproduce

Below is my player class's initializations, works perfectly in editor but not when exported as a build.
Using .NET 2.0 and Windows x64

using UnityEngine;
using System;
using LibVLCSharp;
using UnityEngine.UI;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.IO;

public class VlcPlayerManager : MonoBehaviour
{
    [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
               EntryPoint = "libvlc_media_release")]
    internal static extern void LibVLCMediaRelease(IntPtr media);

    public static VlcPlayerManager _instance;

    LibVLC _libVLC;
    internal MediaPlayer _mediaPlayer;
    internal Media _video;
    MediaTrackList _trackList;
    const int seekTimeDelta = 10000;
    Texture2D tex = null;
    bool playing;
    bool currentMediaWasParsed = false;

    internal RawImage targetTexture;

    private void Awake()
    {
        if (_instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;
        }

        try
        {
//This is FAILING
            Core.Initialize(Application.dataPath);
        } catch (VLCException e)
        {
            Debug.Log(e.Message);
            Debug.Log(e.StackTrace);
        }
        Debug.Log(Application.dataPath);
        _libVLC = new LibVLC("--no-osd", "--verbose=2");
        //Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);
        _libVLC.Log += (s, e) => UnityEngine.Debug.Log(e.FormattedLog); // enable this for logs in the editor
    }
}

What is the current bug behavior?

Player.log throws 2 x DllNotFoundException: VLCUnityPlugin and libvlc or mediaplayer cannot be initialized.

Relevant logs and/or screenshots

Mono path[0] = 'C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Managed'
Mono config path = 'C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/MonoBleedingEdge/etc'
PlayerConnection initialized from C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55436
Multi-casting "[IP] 192.168.0.195 [Port] 55436 [Flags] 2 [Guid] 3472162444 [EditorId] 3063918401 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-7RBMCCU) [Debug] 0 [PackageName] WindowsPlayer" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55436]
PlayerConnection already initialized - listening to [0.0.0.0:55436]
Initialize engine version: 2019.2.9f1 (ebce4d76e6e8)
[XR] Discovering subsystems at path C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce GTX 1070 (ID=0x1b81)
    Vendor:   
    VRAM:     8088 MB
    Driver:   27.21.14.5671
Begin MonoManager ReloadAssembly
- Completed reload, in  1.099 seconds
<RI> Initializing input.

<RI> Input initialized.

<RI> Initialized touch support.

UnloadTime: 0.590600 ms
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Uploading Crash Report
DllNotFoundException: VLCUnityPlugin
  at (wrapper managed-to-native) LibVLCSharp.OnLoad.SetColorSpace(LibVLCSharp.OnLoad/UnityColorSpace)
  at LibVLCSharp.OnLoad.OnBeforeSceneLoadRuntimeMethod () [0x00001] in C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\VLCUnity\Internal\OnLoad.cs:22 
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/VLCUnity/Internal/OnLoad.cs Line: 22)

Odin Serializer ArchitectureInfo initialization with defaults (all unaligned read/writes disabled).
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
TigerForge.OdinSerializer.ArchitectureInfo:.cctor() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Core\Misc\ArchitectureInfo.cs:53)
TigerForge.OdinSerializer.UnitySerializationInitializer:Initialize() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Unity Integration\UnitySerializationInitializer.cs:57)
TigerForge.OdinSerializer.UnitySerializationInitializer:InitializeRuntime() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Unity Integration\UnitySerializationInitializer.cs:88)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/TigerForge.OdinSerializer/Core/Misc/ArchitectureInfo.cs Line: 53)

Odin Serializer detected whitelisted runtime platform WindowsPlayer and memory read test succeeded; enabling all unaligned memory read/writes.
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
TigerForge.OdinSerializer.ArchitectureInfo:SetRuntimePlatform(RuntimePlatform) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Core\Misc\ArchitectureInfo.cs:112)
TigerForge.OdinSerializer.UnitySerializationInitializer:Initialize() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Unity Integration\UnitySerializationInitializer.cs:57)
TigerForge.OdinSerializer.UnitySerializationInitializer:InitializeRuntime() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\TigerForge.OdinSerializer\Unity Integration\UnitySerializationInitializer.cs:88)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/TigerForge.OdinSerializer/Core/Misc/ArchitectureInfo.cs Line: 112)

Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libX11
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libX11.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libX11
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/VLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin.dll
Fallback handler could not load library C:/Users/GamezDanWork/Documents/AnimeWatch/builds/windows/AnimeWatch_Data/Mono/libVLCUnityPlugin
Uploading Crash Report
DllNotFoundException: VLCUnityPlugin
  at (wrapper managed-to-native) LibVLCSharp.Core+Native.SetPluginPath(string)
  at LibVLCSharp.Core.InitializeDesktop (System.String libvlcDirectoryPath) [0x00013] in /builds/mfkl/vlc-unity/tmp/lvs/src/LibVLCSharp/Core/Core.Desktop.cs:86 
  at LibVLCSharp.Core.Initialize (System.String libvlcDirectoryPath) [0x00005] in /builds/mfkl/vlc-unity/tmp/lvs/src/LibVLCSharp/Core/Core.Desktop.cs:54 
  at VlcPlayerManager.Awake () [0x0002a] in C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\VlcPlayerManager.cs:40 
 
(Filename: /builds/mfkl/vlc-unity/tmp/lvs/src/LibVLCSharp/Core/Core.Desktop.cs Line: 86)

VLC OnDisable
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
VlcPlayerManager:OnDisable() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\VlcPlayerManager.cs:98)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/Scripts/VlcPlayerManager.cs Line: 98)

Featured loaded
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
APIManager:<getFeaturedAnime>b__5_0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\APIManager.cs:49)
RSG.<>c__DisplayClass44_0:<Then>b__0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:754)
RSG.Promise`1:InvokeHandler(Action`1, IRejectable, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:353)
RSG.Promise`1:InvokeResolveHandlers(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:395)
RSG.Promise`1:Resolve(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:462)
Proyecto26.RestClient:Promisify(Promise`1, RequestException, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\RestClientPromise.cs:341)
Proyecto26.<CreateRequestAndRetry>d__0:MoveNext() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\Helpers\HttpBase.cs:23)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at C:\buildslave\unity\build\Runtime\Export\Scripting\Coroutines.cs:17)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/Scripts/APIManager.cs Line: 49)

Online Build Version: 0.1
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
<>c:<getOnlineVersion>b__13_0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\APIManager.cs:137)
RSG.<>c__DisplayClass44_0:<Then>b__0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:754)
RSG.Promise`1:InvokeHandler(Action`1, IRejectable, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:353)
RSG.Promise`1:InvokeResolveHandlers(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:395)
RSG.Promise`1:Resolve(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:462)
Proyecto26.RestClient:Promisify(Promise`1, RequestException, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\RestClientPromise.cs:341)
Proyecto26.<CreateRequestAndRetry>d__0:MoveNext() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\Helpers\HttpBase.cs:23)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at C:\buildslave\unity\build\Runtime\Export\Scripting\Coroutines.cs:17)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/Scripts/APIManager.cs Line: 137)

Update NOT Required
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Config:checkUpdate() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\Config.cs:217)
<>c:<getOnlineVersion>b__13_0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\Scripts\APIManager.cs:139)
RSG.<>c__DisplayClass44_0:<Then>b__0(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:754)
RSG.Promise`1:InvokeHandler(Action`1, IRejectable, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:353)
RSG.Promise`1:InvokeResolveHandlers(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:395)
RSG.Promise`1:Resolve(ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\RSG.Promise\Promise.cs:462)
Proyecto26.RestClient:Promisify(Promise`1, RequestException, ResponseHelper) (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\RestClientPromise.cs:341)
Proyecto26.<CreateRequestAndRetry>d__0:MoveNext() (at C:\Users\GamezDanWork\Documents\AnimeWatch\AnimeWatch\Assets\RestClient\Packages\Proyecto26.RestClient\Helpers\HttpBase.cs:23)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at C:\buildslave\unity\build\Runtime\Export\Scripting\Coroutines.cs:17)
 
(Filename: C:/Users/GamezDanWork/Documents/AnimeWatch/AnimeWatch/Assets/Scripts/Config.cs Line: 217)

Setting up 8 worker threads for Enlighten.
  Thread -> id: 3818 -> priority: 1 
  Thread -> id: 68c0 -> priority: 1 
  Thread -> id: 258c -> priority: 1 
  Thread -> id: 30fc -> priority: 1 
  Thread -> id: 415c -> priority: 1 
  Thread -> id: 6730 -> priority: 1 
  Thread -> id: 6724 -> priority: 1 
  Thread -> id: 4484 -> priority: 1 
##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1619098139783,"processId":23788,"allocatedMemory":974822,"memoryLabels":[{"Default":1048},{"NewDelete":236},{"Thread":-184},{"Manager":320},{"VertexData":432},{"GfxDevice":7408},{"Audio":192},{"Physics":32},{"Serialization":40},{"Terrain":88},{"String":1830},{"DynamicArray":480},{"PoolAlloc":-88},{"WebRequest":961700},{"VR":1288}]}

Environment

  • OS: Windows 10 x64
  • LibVLC version and architecture Unity VLC Plugin (Trial Version)
  • LibVLCSharp version Unity VLC Plugin (Trial Version)
  • VLC Unity plugin version Unity VLC Plugin (Trial Version)
  • Scripting backend used Mono, .Net 2.0

Possible fixes

Core.Initialize(Application.dataPath);