• 大小: 57.96MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2022-12-04
  • 语言: C#
  • 标签: C#  播放器  VLC  

资源简介

基于VLC的C#播放器源码 实现的功能: 1:打开播放的音视频文件((1)菜单栏“文件”->“打开”,(2)工具栏(下面)“打开”(3)播放器右键->打开) 2:暂停,继续播放,停止音视频文件 3:进度条和右下角文本框显示播放进度 4:拖动进度条对视频定位播放 5:工具栏(下面)“快进”,“快退”均为5s 6:音量调节 7:菜单栏“文件”下可记录最近播放的三个文件 8:在有记录的情况下,初始状态时双击视频播放区或单击“播放”播放上次关闭时播放的视频

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        string address;
        private VlcPlayer vlcPlayer;
        private bool is_playinig;
        private bool media_is_open;//标记媒体文件是否打开,若未打开则tsbtn_play读ini打开之前的文件,若打开则跳过这步(避免每次都打开文件造成屏幕跳动)
        public Form1()
        {
            InitializeComponent();
            address = Environment.CurrentDirectory;
            
        }
        private void Form1_Load(object sender EventArgs e)
        {
            label_media_name.Hide();
            if (!File.Exists(address + “\\Menu.ini“))
            {
                FileStream fs = new FileStream(address + “\\Menu.ini“ FileMode.Create FileAccess.Write);
                fs.Close();
            }
            string pluginPath = System.Environment.CurrentDirectory + “\\plugins\\“;
            vlcPlayer = new VlcPlayer(pluginPath);
            IntPtr render_wnd = this.panel1.Handle;
            vlcPlayer.SetRenderWindow((int)render_wnd);
            
            tbVideoTime.Text = “00:00:00/00:00:00“;
            is_playinig = false;
            media_is_open = false;
            trackBar2.Value = 50;
            this.Size = new Size(800 600); 
           // readFilePath();
        }


        /// 
        /// 菜单栏文件实现功能
        /// 1 打开待播放文件
        /// 2 记录历史信息
        /// 3 历史信息最多不超过3条
        /// 4 点击历史信息可以实现播放menuitem_Click()
        /// 5 如果点击历史信息不能播放(出现错误)则删除该历史信息item和Menu.ini (方法:try catch)
        /// 6 Menu.ini记录的信息最多不超过3条不重复记录
        /// 7 在历史信息中右键可以选择删除
        /// 

        /// 
        /// 
        /// 
        #region 菜单栏-文件


        /// 
        /// 打开ToolStripMenuItem_Click
        /// 打开文件并将文件目录添加到Menu.ini
        /// 若打开相同文件则不添加(这个有Bug这样的话按tsBtn_play打开的就不是上一个了,因为打开相同的不添加)
        /// 若记录行数超过3个,则先记录后三个数据,再重新建一个Menu.ini(清除数据)接着讲记录的后三个数据写入
        /// 

        /// 
        /// 
        /// 
        private void 打开ToolStripMenuItem_Click(object sender EventArgs e)
        {
            //bool isSame = false;
            openFileDialog1.FileName = ““;
            if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
            { 
                //StreamReader sr0 = new StreamReader(address + “\\Menu.ini“ true);
               // while (sr0.Peek() > -1)
               // {
              //      if ((sr0.ReadLine() == openFileDialog1.FileName)|(openFileDialog1.FileName==““))
              //      {
              //          isSame = true;
               //     }
              //  }
               // sr0.Close();
               // if (is

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     36864  2016-04-24 22:21  mediaPlayer_VLC\mediaPlayer.suo

     文件       1023  2016-04-25 09:50  mediaPlayer_VLC\mediaPlayer_VLC.sln

    ..A..H.     36864  2016-04-25 09:31  mediaPlayer_VLC\mediaPlayer_VLC.suo

    ..A..H.     62464  2016-04-28 10:21  mediaPlayer_VLC\mediaPlayer_VLC.v12.suo

     文件        187  2016-04-24 19:47  mediaPlayer_VLC\WindowsFormsApplication1\App.config

     文件      53760  2016-04-24 19:49  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\AxInterop.WMPLib.dll

     文件     330752  2016-04-25 09:50  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\Interop.WMPLib.dll

     文件     143296  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\libvlc.dll

     文件    2631616  2015-04-13 22:00  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\libvlccore.dll

     文件        115  2016-04-28 09:38  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\Menu.ini

     文件     114112  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libaccess_bd_plugin.dll

     文件      88512  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libaccess_mms_plugin.dll

     文件     115136  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libaccess_realrtsp_plugin.dll

     文件      22464  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libattachment_plugin.dll

     文件     637238  2015-04-13 21:56  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libbluray-j2se-0.7.0.jar

     文件     171968  2015-04-13 21:58  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libcdda_plugin.dll

     文件     554944  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libdshow_plugin.dll

     文件     265152  2015-04-13 21:58  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libdtv_plugin.dll

     文件     245184  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libdvdnav_plugin.dll

     文件     166848  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libdvdread_plugin.dll

     文件      55744  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libfilesystem_plugin.dll

     文件      98752  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libftp_plugin.dll

     文件     127936  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libhttp_plugin.dll

     文件      22976  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libidummy_plugin.dll

     文件      56768  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libimem_plugin.dll

     文件    2158528  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\liblibbluray_plugin.dll

     文件     720832  2015-04-13 21:58  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\liblive555_plugin.dll

     文件      52672  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\librar_plugin.dll

     文件     534976  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\librtp_plugin.dll

     文件      29632  2015-04-13 21:57  mediaPlayer_VLC\WindowsFormsApplication1\bin\Debug\plugins\access\libscreen_plugin.dll

............此处省略751个文件信息

评论

共有 条评论