C#基于RealPlayX.ocx视频监控整合程序

软件是基于C#语言进行开发的,运行在.net framework4.0以上的环境中。在每台查看视频监控的机器中借助于“RealPlayX.ocx”技术在网页中运行视频画面。
系统使用的结构图:
在这里插入图片描述
实现代码:
主页前台:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jiankong63413839.aspx.cs" Inherits="Web_Camer.jiankong63413839" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>附属楼监控</title>

<style type="text/css">
.body {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 16px;
	line-height: 5px;
	color: #000;
	background-color: #A7DDFE;
}
</style>
<script src="scripts/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
    function openUrlUrl(ipstr) {
        window.location.href = "Web_Camer.aspx?ipstr=" + ipstr;
        return;
    }
</script> 
</head>

<body>
    <form id="form1" runat="server">
<h1 align="center">附属楼监控</h1>
<table width="100%" border="2" cellpadding="0" cellspacing="0" class="body">
  <tr class="body"> 
    <td width="20%" height="120"  align="center" valign="middle"><input  runat="server" style="height:50px; width:100px" id="button101" type="button" value="101教室" onclick="openUrlUrl('192.168.13.129');" />&nbsp;</td>
    <td width="20%"  align="center" valign="middle"><input runat="server" style="height:50px; width:100px" id="button102" type="button" value="102教室"  onclick="openUrlUrl('192.168.13.128');"/></td>
    <td width="20%"  align="center" valign="middle"><input style="height:50px; width:100px" name="2-3" type="button" value="103教室" id="2-3"  onclick="openUrlUrl('192.168.13.132');"/></td>
    <td width="20%" align="center" valign="middle"><input style="height:50px; width:100px" name="2-4" type="button" value="201教室" id="button201" runat="server"  onclick="openUrlUrl('192.168.13.119');"/>
    <br /><br /><br /><asp:Label ID="Label201" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
      
    <td width="20%"  align="center" valign="middle"><input style="height:50px; width:100px" name="2-5" type="button" value="202教室" id="button202" runat="server"  onclick="openUrlUrl('192.168.13.114');"/>
    <br /><br /><br /><asp:Label ID="Label202" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
  </tr>
  <tr class="body">
    <td height="90" align="center" valign="middle"><input style="height:50px; width:100px" name="2-6" type="button" value="203教室" id="2-6"  onclick="openUrlUrl('192.168.13.126');"/>
    <br /><br /><br /><asp:Label ID="Label203" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
    <td  align="center" valign="middle"><input style="height:50px; width:100px" name="2-7" type="button" value="204教室" id="2-7"  onclick="openUrlUrl('192.168.13.15');"/>
    <br /><br /><br /><asp:Label ID="Label204" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
    <td align="center" valign="middle"><input style="height:50px; width:100px" name="2-8" type="button" value="205教室" id="2-8"  onclick="openUrlUrl('192.168.13.113');"/>
    <br /><br /><br /><asp:Label ID="Label205" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
    <td align="center" valign="middle"><input style="height:50px; width:100px" name="3-2" type="button" value="206教室" id="3-2"  onclick="openUrlUrl('192.168.13.17');"/>
    <br /><br /><br /><asp:Label ID="Label206" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
    <td align="center" valign="middle"><input style="height:50px; width:100px"  name="3-3" type="button" value="207教室" id="3-3"  onclick="openUrlUrl('192.168.13.118');"/>
    <br /><br /><br /><asp:Label ID="Label207" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
  </tr>
  <tr class="body">
    <td height="90"  align="center" valign="middle"><input style="height:50px; width:100px" name="3-4" type="button" value="208教室" id="3-4"  onclick="openUrlUrl('192.168.13.125');"/>
    <br /><br /><br /><asp:Label ID="Label208" runat="server" Text="" style="word-break:break-all;word-wrap:break-word"></asp:Label>
    </td>
  </tr>
  
</table>
    </form>
</body>
</html>

主页后台:

  if (!IsPostBack)
            {
                sqlcon.ConnectionString = "server=10.10.10.169;database=database;uid=jw;pwd=123456#";
                sqlcon.Open();
                ds = new DataSet();
                sqlda = new SqlDataAdapter("select kcmc,JCInfo,SKAP,ZJJS_XM,ROOM  FROM [kingo_jwgl1db].[dbo].[V_BRW_Schedule] where room like '北区教学楼%'", sqlcon);
                sqlda.Fill(ds);
                sqlcon.Close();
                sqlda.Dispose();
                dt = ds.Tables[0];
                DayOfWeek  t = DateTime.Now.DayOfWeek;
                string weekstr = null;
                switch (t.ToString())
                {
                    case "Monday": weekstr = "一"; break;
                    case "Tuesday": weekstr = "二"; break;
                    case "Wednesday": weekstr = "三"; break;
                    case "Thursday": weekstr = "四"; break;
                    case "Friday": weekstr = "五"; break;
                    case "Saturday": weekstr = "六"; break;
                    case "Sunday": weekstr = "日"; break;
                }
                string jcstr=null;
                if ((System.DateTime.Now.Hour < 10) && (System.DateTime.Now.Hour >= 8))
                    jcstr = "1-2";
                if ((System.DateTime.Now.Hour < 12) && (System.DateTime.Now.Hour >= 10))
                    jcstr = "3-4";
                if ((System.DateTime.Now.Hour < 16) && (System.DateTime.Now.Hour >= 14))
                    jcstr = "5-6";
                if ((System.DateTime.Now.Hour < 18) && (System.DateTime.Now.Hour >= 16))
                    jcstr = "7-8";
                if ((System.DateTime.Now.Hour < 21) && (System.DateTime.Now.Hour >= 19))
                    jcstr = "9-10";
                DataRow[] dr = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='201教室'");
                try { this.Label201.Text = dr[0].ItemArray[0].ToString() + "老师:" + dr[0].ItemArray[3].ToString(); }
                catch { ;}
                DataRow[] dr202 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='202教室'");
                try { this.Label202.Text = dr202[0].ItemArray[0].ToString() + "老师:" + dr202[0].ItemArray[3].ToString(); }
                catch { ;}
                DataRow[] dr203 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='203教室'");
                try { this.Label203.Text = dr203[0].ItemArray[0].ToString() + "老师:" + dr203[0].ItemArray[3].ToString(); }
                catch { ;}
                DataRow[] dr204 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='204教室'");
                try { this.Label204.Text = dr204[0].ItemArray[0].ToString() + "老师:" + dr204[0].ItemArray[3].ToString(); }
                catch { ;}
                DataRow[] dr205 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='205教室'");
                try
                {
                    this.Label205.Text = dr205[0].ItemArray[0].ToString() + "老师:" + dr205[0].ItemArray[3].ToString();
                }
                catch { ;}
                DataRow[] dr206 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='206教室'");
                try { this.Label206.Text = dr206[0].ItemArray[0].ToString() + "老师:" + dr206[0].ItemArray[3].ToString(); }
                catch
                { ;}
                DataRow[] dr207 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='207教室'");
                try { this.Label207.Text = dr207[0].ItemArray[0].ToString() + "老师:" + dr207[0].ItemArray[3].ToString(); }
                catch { ;}
                DataRow[] dr208 = dt.Select("jcinfo='" + jcstr + "' and skap like '%" + weekstr + "%' and room='208教室'");
                try { this.Label208.Text = dr208[0].ItemArray[0].ToString() + "老师:" + dr208[0].ItemArray[3].ToString(); }
                catch { ;}
            }

视频页代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Web_Camer.aspx.cs" Inherits="Web_Camer.Web_Camer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>视频控件</title>
<style>
body {font-family:"", arial;margin:0 auto; padding:0; }
div,form,img,ul,p {margin: 0 auto; padding: 0; border: 0; overflow:hidden; list-style-type:none; }
h1,h2,h3,h4,h5,h6 { margin:0; padding:0;}
.bigbg{
	width:1280px;
	height:820px;
	position:relative;
	top:50px;
	background:#fff;}
.kuang{
	background:url(img/video_03.gif) no-repeat;
	width:1280px;
	height:820px;
	margin-top:12px;}
.close a{
	background:url(img/1_04.gif) no-repeat;
	width:41px;
	height:36px;
	position:absolute;
	left:618px;
	top:5px;
}
.close a:hover{
	background:url(img/2_04.gif) no-repeat;
	with:41px;
	height:36px;
	position:absolute;
	left:618px;
	top:5px;
}	

.videoscreen{
width:1280px;
	height:720px;
background-color:#999;
	position:absolute;
	right:17px;
	top:45px;
	}

.sfream {
	background:url(img/video_05.jpg) no-repeat;
	width:627px;
	height:42px;
	margin-top:400px;}
	
.play a{
	background:url(img/video_25.gif) no-repeat;
	width:19px;
	height:19px;
	position:absolute;
	left:26px;
	bottom:17px;}
	
.pause a{	background:url(img/video_26.gif) no-repeat;
	width:21px;
	height:19px;
	position:absolute;
	left:46px;
	bottom:17px;
}
.progressbar a{	background:url(img/video_28.gif) no-repeat;
	width:291px;
	height:20px;
	position:absolute;
	left:76px;
	bottom:17px;
}
.snapshot-picture a{	background:url(img/video_16.gif) no-repeat;
	width:25px;
	height:25px;
	position:absolute;
	left:377px;
	bottom:17px;}

.stepback a {	background:url(img/video_18.gif) no-repeat;
	width:24px;
	height:25px;
	position:absolute;
	left:409px;
	bottom:17px;}

.camera a{background:url(img/video_20.gif) no-repeat;
	width:26px;
	height:27px;
	position:absolute;
	left:439px;
	bottom:14px;}
	
.stopcamera a{background:url(img/video_22.gif) no-repeat;
	width:27px;
	height:27px;
	position:absolute;
	left:472px;
	bottom:14px;}
	
.singlescreen a{background:url(img/video_09.gif) no-repeat;
	width:31px;
	height:29px;
	position:absolute;
	left:506px;
	bottom:12px;}
	
.doublescreen a{background:url(img/video_11.gif) no-repeat;
	width:31px;
	height:29px;
	position:absolute;
	left:546px;
	bottom:12px;}
	
.ninescreen a{background:url(img/video_13.gif) no-repeat;
	width:32px;
	height:29px;
	position:absolute;
	left:586px;
	bottom:12px;}
	
.ninescreen a:hover{background:url(img/design_05.gif) no-repeat;
	width:40px;
	height:29px;
	position:absolute;
	left:586px;
	bottom:82px;}

</style>

<script language="javascript">

 
   // var ipstr=request.QueryString("ipstr");
    function StartPreview() {
        //alert("开始");
        var SSOcx = document.getElementById("playOcx");
        SSOcx.SetDeviceInfo("<%=ipstr %>", 37777, 0, "admin", "admin");
        SSOcx.StartPlay();
    }


    function StoptPreview() {
        var SSOcx = document.getElementById("playOcx");
        SSOcx.StopPlay();

    }

    function Capture() {

        var SSOcx = document.getElementById("playOcx");
        var dd = SSOcx.GetCapturePicture("d:\\1.bmp");

    }

    function StartRecord() {

        var SSOcx = document.getElementById("playOcx");
        SSOcx.SaveRealData("d:\\1.avi");
    }

    function StopRecord() {
        var SSOcx = document.getElementById("playOcx");
        SSOcx.StopSaveRealDate();
    }


</script>
</head>

<body onload="javascript:StartPreview();">
<div class="bigbg">
<div class="kuang">
    <div class="videoscreen"> 
    <td width="50%"   align="right" style="padding-right:50px">
    
    
         <object classid="clsid:30209FBC-57EB-4F87-BF3E-740E3D8019D2" codebase="RealPlayX.ocx"
              standby="Waiting..." id="playOcx" width="1280" height="720" name="playOcx" align="center" >
              <param name="_Version" value="65536" valuetype="data"/>
              <param name="_ExtentX" value="2646" valuetype="data"/>
              <param name="_ExtentY" value="1323" valuetype="data"/>
              <param name="_StockProps" value="0" valuetype="data"/>

            <embed width="618" height="360" align="center"></embed>
         </object>
    
    </td>
     </div>

<div class="sfream">
<div class="play"><a href="javascript:StartPreview()">播放</a><br/></div>
<div class="pause"><a href="javascript:StoptPreview()">暂停</a><br /></div>
<div class="progressbar"><a href=""></a></div>
<div class="singlescreen"><a href="javascript:history.go(-1)">返回</a></div>
<div class="doublescreen"><a href=""></a></div>
<div class="ninescreen"><a href=""></a></div>
</div>
</div>
<div class="close"><a href=""></a></div>

</div>




</body>
</html>
public static string ipstr;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ipstr = Request.QueryString["ipstr"];
            }
        }

利用二个网页可以将一幢楼的IP地址的视频监控整合起来,方便日常不定点的基于网页的监视频查看。
源码及支持库下载:资源下载

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刘二光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值