Controlling VLC via c#

后端 未结 2 978
暗喜
暗喜 2020-12-09 23:26

I am writing an application that will open vlc, add a file to its playlist, and play it. I am having a few issues on the last 2.

 AXVLC.VLCPlugin alxplugin1          


        
相关标签:
2条回答
  • 2020-12-09 23:50

    C# can access VLC through it's COM layer. First thing to do is to register the axvlc.dll. Open a cmd window and type:

    C:\Windows\System32\regsvr32.exe C:\Program Files (x86)\VideoLAN\VLC\axvlc.dll
    

    You should receive a dialog confirming that your dll was registered successfully. Open VisualStudio and create a new WinForms project and add a reference to the COM VLC COM object. Go to the Form cs file

    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
              public Form1()
              {
                   InitializeComponent();
    
                   AXVLC.VLCPlugin2Class p = new AXVLC.VLCPlugin2Class();
                   p.addTarget("C:\\zk.m4a", null, VLCPlaylistMode.VLCPlayListInsert, 0);
                   p.play();
               }
         }
     }
    

    Note: The VLCPluginClass was deprecated, use VLCPlugin2Class

    0 讨论(0)
  • 2020-12-09 23:51

    The newer version of VLC needs "file:///" in beginning of the file name. It should work if you add this. Please try the following and see if it solves your problem. use: alxplugin1.addTarget("file:///" + "C:\\test.avi", null, AXVLC.VLCPlaylistMode.VLCPlayL­istReplaceAndGo,0);

    0 讨论(0)
提交回复
热议问题