首先上图
有一批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());
}