vlc.dotnet.forms中的空引用异常 [英] null reference exception in vlc.dotnet.forms

查看:192
本文介绍了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..

推荐答案

你好。



你可以从 https://vlcdotnet.codeplex.com/ [ ^ ]错误...



下载源https://vlcdotnet.codeplex.com/SourceControl/latest [ ^ ]重新编译它们并且它完美地工作。



您还可以在源代码中找到一个示例winform应用程序,您会发现需要初始化vlc上下文。



Hello.

The compiled files you can download from https://vlcdotnet.codeplex.com/[^] are buggy...

Download the sources https://vlcdotnet.codeplex.com/SourceControl/latest[^] recompile them and it works perfectly.

You will also find a sample winform application in the sources and you will notice that you need to initialise a vlc context.

// 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中的空引用异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆