![](/img/trans.png)
[英]System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found
[英]DllNotFoundException: Unable to load DLL 'libvlc': The specified module could not be found
我正在使用LibVLCSharp(Vlc nuget包)設置視頻播放器。 我已經安裝了VideoLAN.LibVLC.Windows和LibVLCSharp.WPF ,到目前為止,在編譯和運行我的代碼之前一切正常。
我的VideoPlayer.xaml.cs文件如下:
using LibVLCSharp.Shared;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using MediaPlayer = LibVLCSharp.Shared.MediaPlayer;
namespace kec_wpf.ui
{
public partial class VideoPlayer : Window
{
LibVLC _libVLC;
MediaPlayer _mediaPlayer;
public VideoPlayer()
{
InitializeComponent();
var label = new Label
{
Content = "TEST",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom,
Foreground = new SolidColorBrush(Colors.Red)
};
test.Children.Add(label);
_libVLC = new LibVLC();
_mediaPlayer = new MediaPlayer(_libVLC);
// we need the VideoView to be fully loaded before setting a MediaPlayer on it.
VideoView.Loaded += (sender, e) => VideoView.MediaPlayer = _mediaPlayer;
}
void StopButton_Click(object sender, RoutedEventArgs e)
{
if (VideoView.MediaPlayer.IsPlaying)
{
VideoView.MediaPlayer.Stop();
}
}
void PlayButton_Click(object sender, RoutedEventArgs e)
{
if (!VideoView.MediaPlayer.IsPlaying)
{
//VlcControl.SourceProvider.MediaPlayer.Play(new Uri("pack://siteoforigin:,,,/assets/content/" + Title + ".mp4"));
VideoView.MediaPlayer.Play(new Media(_libVLC,
"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", FromType.FromLocation));
}
}
}
}
但是當我建立並運行時我得到的錯誤是:
DllNotFoundException:無法加載DLL“libvlc”:找不到指定的模塊。 (來自HRESULT的異常:0x8007007E)
我不知道如何解決這個問題,因為在bin / debug文件夾中我看到一個名為“libvlc”的文件夾,里面有文件夾“win-x64”和“win-x86”。
我的臨時解決方案
Project
>> Properties
中將我的程序設置為x32 libvlc.dll
和libvlccore.dll
以及lua,locale,plugins和skin的整個文件夾復制到我的debug文件夾中。 這現在有效,但我需要一個實用的解決方案因為我已經在項目中有VideoLAN.LibVLC.Windows
。
你忘了打電話給Core.Initialize()嗎?
例如參見: https : //github.com/videolan/libvlcsharp/blob/223a1e86db0b0ffd120247a0ccf7f85c01d2c470/Samples/LibVLCSharp.WPF.Sample/App.xaml.cs#L10
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.