vlc c# 2010 播放rtsp


用网上找来的vlc 1.1.9,用C#做简单的测试程序,可以播放rtsp,地址在源码上,可以自己修改
资源截图
代码片段和文件信息
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();
            vlc_init(false);
            //string pluginPath = System.Environment.CurrentDirectory + “\plugins\“;
            //vlc_player_ = new VlcPlayer(pluginPathfalse);
            //IntPtr render_wnd = this.panel1.Handle;
            //vlc_player_.SetRenderWindow((int)render_wnd);

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

            //is_playinig_ = false;
        }

        public void vlc_init(bool is_record)
        {
            string pluginPath = System.Environment.CurrentDirectory + “\plugins\“;
            vlc_player_ = new VlcPlayer(pluginPath is_record);
            IntPtr render_wnd = this.pictureBox1.Handle; //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 s

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-12-19 14:11  vlc.net
     目录           0  2014-12-19 14:11  vlc.netin
     目录           0  2014-12-19 14:12  vlc.netinDebug
     文件      530451  2014-07-23 07:29  vlc.netinDebugaxvlc.dll
     文件      102400  2011-04-12 08:45  vlc.netinDebuglibvlc.dll
     文件     2279936  2011-04-12 08:45  vlc.netinDebuglibvlccore.dll
     目录           0  2014-12-19 14:12  vlc.netinDebugplugins
     文件       65536  2011-06-07 07:29  vlc.netinDebugpluginsliba52tofloat32_plugin.dll
     文件       30720  2011-06-07 07:29  vlc.netinDebugpluginsliba52tospdif_plugin.dll
     文件       36352  2011-06-07 07:29  vlc.netinDebugpluginsliba52_plugin.dll
     文件       31232  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_attachment_plugin.dll
     文件       90112  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_bd_plugin.dll
     文件       33792  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_fake_plugin.dll
     文件       41472  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_ftp_plugin.dll
     文件       88064  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_http_plugin.dll
     文件       44544  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_imem_plugin.dll
     文件       75776  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_mms_plugin.dll
     文件       30720  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_output_dummy_plugin.dll
     文件       32256  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_output_file_plugin.dll
     文件       35840  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_output_http_plugin.dll
     文件      394240  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_output_shout_plugin.dll
     文件       36352  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_output_udp_plugin.dll
     文件       70144  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_realrtsp_plugin.dll
     文件       34304  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_smb_plugin.dll
     文件       31744  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_tcp_plugin.dll
     文件       32768  2011-06-07 07:29  vlc.netinDebugpluginslibaccess_udp_plugin.dll
     文件       49152  2011-06-07 07:29  vlc.netinDebugpluginslibadjust_plugin.dll
     文件       38912  2011-06-07 07:29  vlc.netinDebugpluginslibadpcm_plugin.dll
     文件       33280  2011-06-07 07:29  vlc.netinDebugpluginslibaes3_plugin.dll
     文件       33792  2011-06-07 07:29  vlc.netinDebugpluginslibaiff_plugin.dll
     文件       33280  2011-06-07 07:29  vlc.netinDebugpluginslibalphamask_plugin.dll
............此处省略282个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)