forms中的空引用异常

forms中的空引用异常

本文介绍了vlc.dotnet.forms中的空引用异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

Here's my code:

using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Vlc.DotNet.Forms;
using Vlc.DotNet.Core;
using Vlc.DotNet.Core.Medias;
using Vlc.DotNet.Core.Interops;

namespace vlcMediaPlayer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            VlcControl vlc = new VlcControl();
            Controls.Add(vlc);
            vlc.Location = new Point(100, 100);
            vlc.BackColor = Color.Red;
            vlc.Size = new Size(300, 300);
            MediaBase media = new PathMedia(@"D:\Parafait Home\Signage\Dhoni.mp4");
            vlc.Play(media);     //Here i am getting the exception
           
        }
    }
}





i调试了它......但似乎没有什么不对......请帮帮我......我是新手..



i have debugged it... But nothing seems wrong.. Please help me out here.. I am new..

推荐答案

// Set libvlc.dll and libvlccore.dll directory path
VlcContext.LibVlcDllsPath = @"C:\Program Files (x86)\VideoLAN\VLC"; // CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64;
// Set the vlc plugins directory path
VlcContext.LibVlcPluginsPath = @"C:\Program Files (x86)\VideoLAN\VLC\pugins"; //CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64;
// Ignore the VLC configuration file
VlcContext.StartupOptions.IgnoreConfig = true;
// Enable file based logging
VlcContext.StartupOptions.LogOptions.LogInFile = true;
// Shows the VLC log console (in addition to the applications window)
VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false;
// Set the log level for the VLC instance
VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None;
// Initialize the VlcContext
VlcContext.Initialize();





Valery。



Valery.


这篇关于vlc.dotnet.forms中的空引用异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 22:55