用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());
}

 

 

 

posted @   simadi  阅读(1426)  评论(1编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示