用VLC media player com组件检查mms地址是否可以收听详解

 

首先上图

有一批mms地址需要检查,于是写了个检查软件.进行检查,主要是 利用vlc控件的axVLCPlugin21.input.state属性进行检查

state值为3 为连接正常,7为无法连接.

第一步

安装 vlc 播放器 地址http://www.videolan.org/vlc/

第二步

建立1个form,在vs左侧添加控件

添加控件 右击工具箱-选择项

添加的时候有俩个,选2.0的版本.

第三步

首先 获取到mms地址 进行播放

        public void Play(string mmsUrl)
        {
            //textBox1.Text = mmsUrl;
            axVLCPlugin21.playlist.stop();
            axVLCPlugin21.playlist.clear();
            int index = axVLCPlugin21.playlist.add(mmsUrl, null, null);
            axVLCPlugin21.playlist.playItem(index);
            axVLCPlugin21.playlist.play();
        }

 再用timer 进行检查播放状态

            var s = axVLCPlugin21.input.state;
            //Util.Log(TTask.ThreadState.ToString());
            ListViewItem item = lvwChannel.Items[CurrentChannelIndex];
            //if (item.SubItems[1].Text != textBox1.Text) return;
            string channelName = item.SubItems[0].Text;
            if (s == 7)
            {
                AppendLog("", string.Format("[{0}]{1}", channelName, "连接失败!!!"));
                item.ForeColor = Color.Red;
                item.SubItems[2].Text = "×耗时" + lblCountDown.Text;
                item.SubItems[3].Text = (int.Parse(item.SubItems[3].Text) + 1).ToString();
                Util.SaveErrorResult(channelName + "," + item.SubItems[1].Text);
                TTask.Interrupt();
            }
            else if (s == 3)
            {
                AppendLog("", string.Format("[{0}]{1}", channelName, "连接成功"));
                item.ForeColor = Color.Green;
                item.SubItems[2].Text = "√耗时" + lblCountDown.Text;
                TTask.Interrupt();
            }
            else if (s == 1)
            {
            }
            else
            {
            Util.Log(s.ToString());
            }

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值