• 大小: 29.12MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-03
  • 语言: C#
  • 标签: C#  vlc  

资源简介

文件中包含工程及plugins,VS可以直接运用,若生产release版本,将相应的文件复制到release中。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace vlc.net
{
    public partial class Form1 : Form
    {
        private VlcPlayer vlc_player_;
        private bool is_playinig_;

        public Form1()
        {
            InitializeComponent();
            string pluginPath = System.Environment.CurrentDirectory + “\\plugins\\“;
            vlc_player_ = new VlcPlayer(pluginPath);
            IntPtr render_wnd = this.panel1.Handle;
            vlc_player_.SetRenderWindow((int)render_wnd);

            tbVideoTime.Text = “00:00:00/00:00:00“;

            is_playinig_ = false;
        }

        private void btnStart_Click(object sender EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                vlc_player_.PlayFile(ofd.FileName);
                trackBar1.SetRange(0 (int)vlc_player_.Duration());
                trackBar1.Value = 0;
                timer1.Start();
                is_playinig_ = true;
            }
        }

        private void btnReset_Click(object sender EventArgs e)
        {
            if (is_playinig_)
            {
                vlc_player_.Stop();
                trackBar1.Value = 0;
                timer1.Stop();
                is_playinig_ = false;
            }
        }

        private void timer1_Tick(object sender EventArgs e)
        {
            if (is_playinig_)
            {
                if (trackBar1.Value == trackBar1.Maximum)
                {
                    vlc_player_.Stop();
                    timer1.Stop();
                }
                else
                {
                    trackBar1.Value = trackBar1.Value + 1;
                    tbVideoTime.Text = string.Format(“{0}/{1}“ 
                        GetTimeString(trackBar1.Value) 
                        GetTimeString(trackBar1.Maximum));
                }
            }
        }

        private string GetTimeString(int val)
        {
            int hour = val / 3600;
            val %= 3600;
            int minute = val / 60;
            int second = val % 60;
            return string.Format(“{0:00}:{1:00}:{2:00}“ hour minute second);
        }

        private void trackBar1_Scroll(object sender EventArgs e)
        {
            if (is_playinig_)
            {
                vlc_player_.SetPlayTime(trackBar1.Value);
                trackBar1.Value = (int)vlc_player_.GetPlayTime();
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-03-01 20:01  player\
     目录           0  2013-03-01 19:10  player\player\
     文件        7441  2013-03-01 19:43  player\player\Form1.Designer.cs
     文件        2743  2013-03-01 19:43  player\player\Form1.cs
     文件        6011  2013-03-01 19:43  player\player\Form1.resx
     文件         479  2011-06-29 14:55  player\player\Program.cs
     目录           0  2011-12-21 19:41  player\player\Properties\
     文件        1426  2011-06-29 14:55  player\player\Properties\AssemblyInfo.cs
     文件        2842  2011-06-29 14:55  player\player\Properties\Resources.Designer.cs
     文件        5612  2011-06-29 14:55  player\player\Properties\Resources.resx
     文件        1092  2011-06-29 14:55  player\player\Properties\Settings.Designer.cs
     文件         249  2011-06-29 14:55  player\player\Properties\Settings.settings
     文件       11308  2011-12-21 18:33  player\player\VlcPlayer.cs
     目录           0  2013-03-01 19:06  player\player\bin\
     目录           0  2013-03-01 19:42  player\player\bin\Debug\
     文件      111104  2012-12-13 08:12  player\player\bin\Debug\libvlc.dll
     文件     2286592  2012-12-13 08:13  player\player\bin\Debug\libvlccore.dll
     目录           0  2013-03-01 19:48  player\player\bin\Debug\plugins\
     目录           0  2013-03-01 19:37  player\player\bin\Debug\plugins\3dnow\
     文件       37376  2012-12-13 08:13  player\player\bin\Debug\plugins\3dnow\libmemcpy3dn_plugin.dll
     目录           0  2013-03-01 19:37  player\player\bin\Debug\plugins\access\
     文件       34816  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_attachment_plugin.dll
     文件       93696  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_bd_plugin.dll
     文件       45056  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_ftp_plugin.dll
     文件       91648  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_http_plugin.dll
     文件       47104  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_imem_plugin.dll
     文件       79360  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_mms_plugin.dll
     文件       39936  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_rar_plugin.dll
     文件       72192  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_realrtsp_plugin.dll
     文件       37376  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_smb_plugin.dll
     文件       35328  2012-12-13 08:13  player\player\bin\Debug\plugins\access\libaccess_tcp_plugin.dll
............此处省略334个文件信息

评论

共有 条评论