nuget 似乎在构建时将 libvlc.dylib 复制到正确的位置,但找不到 libvlccore.dylib (在输出目录或 nuget 包中)。因此,我得到了这个例外:
Une exception s'est produite : CLR/LibVLCSharp.Shared.VLCException
Une exception non gérée du type 'LibVLCSharp.Shared.VLCException' s'est produite dans LibVLCSharp.dll: 'Failed to load required native libraries.
Have you installed the latest LibVLC package from nuget for your target platform?
Search paths include /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib,/Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib,; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc.dylib,; /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlc.dylib,/Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlccore.dylib'
我尝试从 VLC 播放器安装文件夹中复制 libvlccore.dylib,但它仍然无法工作。我可以在日志中看到它确实加载了它,但仍然抛出异常。
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlccore.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Loading
Cannot find
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Cannot find /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc/osx-x64/lib/libvlc.dylib
Loading
Cannot find
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/libvlc.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlccore.dylib
Loading /Users/yanos/dev/Flower/Flower.Desktop/bin/Debug/net7.0/lib/libvlc.dylib
我在 M1 MacBook Pro 上使用 MacOS 14.5。
Apple Silicon 支持(无论是通过您尝试的 x64,还是本机 ARM)尚未针对 LibVLCSharp 进行测试,因此预计它不起作用。 https://code.videolan.org/videolan/LibVLCSharp/-/issues/363