gpt4 book ai didi

c# - Dll未找到异常 : Unable to load DLL 'libvlc' : The specified module could not be found

转载 作者:太空宇宙 更新时间:2023-11-03 19:39:16 35 4
gpt4 key购买 nike

我正在使用 LibVLCSharp(Vlc nuget 包)设置视频播放器。我已经安装了VideoLAN.LibVLC.WindowsLibVLCSharp.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: Unable to load DLL 'libvlc': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

我不知道如何解决这个问题,因为在 bin/debug 文件夹中我看到一个名为“libvlc”的文件夹,里面有文件夹“win-x64”和“win-x86”。

我的临时解决方案:

  1. Project 中将我的程序设置为 x32 >> Properties
  2. libvlc.dlllibvlccore.dll 以及 lua、语言环境、插件和皮肤的整个文件夹复制到我的调试文件夹中。

这目前有效,但我需要一个实用的解决方案,因为我在项目中已经有了 VideoLAN.LibVLC.Windows

最佳答案

关于c# - Dll未找到异常 : Unable to load DLL 'libvlc' : The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56230470/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com