在WinForms C#app中显示IP cam feed

时间:2013-03-14 09:13:20

标签: c# webbrowser-control ip-camera

我正在尝试在我的C#WinForms应用中显示来自IP cam的视频。我只需要显示视频,而不是相机菜单等。我正在考虑使用WebBrowser控件并以某种方式更改参数。如果您对此方法或任何其他方面有任何建议,请提供帮助。我不知道从哪里开始。 这是默认的IP cam页面:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<title>IP CAMERA</title>
<link href="style/css.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript" src="js/localization.js"></SCRIPT>
<SCRIPT language="JavaScript" src="js/commfunc.js"></SCRIPT>
<SCRIPT language="JavaScript" src="js/axobjdef.js"></SCRIPT>
<script language="JavaScript" src="js/slider.js"></script>
<SCRIPT language="JavaScript" src="js/vlc.js"></SCRIPT>
<SCRIPT language="Javascript" src="js/plugin_detect.js"></SCRIPT>

<style type="text/css">

.statusBarL{
background-image:url("./style/image/vlc/img_Liveview_L.png");
background-repeat:no-repeat;
height:25px;
width:7px;
}

.statusBarM{
background-image:url("./style/image/vlc/img_Liveview_M.png");
background-repeat: repeat-x;
height:25px;
overflow:hidden;
}

.statusBarR{
background-image:url("./style/image/vlc/img_Liveview_R.png");
background-repeat:no-repeat;
height:25px;
width:7px;
}

.live_btn{
display:block;
float:left;
}

</style>

<script type="text/JavaScript">
<!--
var PLUGIN_LANG=0;
//var INITMODE = "Player";
var VIEW_SIZE = getViewSize();
var PROTOCOL_TYPE=getProtocol();
var INITMODE = "none";
var CAPTEXT = "Live View";
var STATUSBAR = 1;
var TOOLBAR = 1;
var CONTEXTMENU = 0;
var AUTOSTART=1;
var TOOLBARCONF = "stream+rec+mic+zoom+time";
var CheckMac = (navigator.platform.toLowerCase().indexOf("mac") < 0) ? false : true;

GetDeviceInfo_A('view','General.Network.RTSP.Enabled&group=General.Network.RTP.R0.Multicast');
var RTSPEnabled = GetQueryVariable('General.Network.RTSP.Enabled');
var TypeIndex = getCookies("TypeIdx");

if(TypeIndex == null)
{
  if(getOs().indexOf("IE") >= 0)
  {
    TypeIndex = "ocx";
  }else{
    if(CheckMac)
    {
      TypeIndex = "quicktime";
    }else{
      TypeIndex = "vlc";
    }
  }
}

GetDeviceInfo_A('view','Image');
switch(getVideoFmt())
{
    default:
      case '1':
        CHANNEL = 1;
        break;
    case '2':
        if(RTSPEnabled == "1")
        {
          CHANNEL = 1;
          setVideoFmt(1);
        }else{
          CHANNEL = 2;
        }
        break;
}

if(CheckMac && TypeIndex != "jpg")
{
  TypeIndex = "quicktime";
}

function mouseOver(index)
{
  if(index=="Liveview_Play" || index=="Liveview_Sound" ||
     index=="Liveview_Talk" || index=="Liveview_Record")
  {
    EID(index).src = eval("'./style/image/vlc/btn_Liveview_"+EID(index).title+"_h.png'");
  }else{
    EID(index).src = eval("'./style/image/vlc/btn_"+index+"_h.png'");
  }
}

function mouseOut(index)
{
  if(index=="Liveview_Play" || index=="Liveview_Sound" ||
     index=="Liveview_Talk" || index=="Liveview_Record")
  {
    EID(index).src = eval("'./style/image/vlc/btn_Liveview_"+EID(index).title+"_e.png'");
  }else{
    EID(index).src = eval("'./style/image/vlc/btn_"+index+"_e.png'");
  }
}

function mouseDown(index)
{
  if(index=="Liveview_Play" || index=="Liveview_Sound" ||
     index=="Liveview_Talk" || index=="Liveview_Record")
  {
    EID(index).src = eval("'./style/image/vlc/btn_Liveview_"+EID(index).title+"_p.png'");
  }else{
    EID(index).src = eval("'./style/image/vlc/btn_"+index+"_p.png'");
  }
}

function mouseUp(index)
{
  switch(index)
  {
    case 'Play':
      EID("Liveview_Play").title = "Pause";
      mouseOver("Liveview_Play");
      break;
    case 'Pause':
      EID("Liveview_Play").title = "Play";
      mouseOver("Liveview_Play");
      break;
    case 'Stop':
      mouseOver("Liveview_Stop");
      EID("Liveview_Play").title = "Play";
      mouseOut("Liveview_Play");
      break;
    case 'Sound':
      EID("Liveview_Sound").title = "SoundMute";
      mouseOver("Liveview_Sound");
      break;
    case 'SoundMute':
      EID("Liveview_Sound").title = "Sound";
      mouseOver("Liveview_Sound");
      break;
    case 'Talk':
      EID("Liveview_Talk").title = "TalkMute";
      break;
    case 'TalkMute':
      EID("Liveview_Talk").title = "Talk";
      break;
    default:
  }
}

function changeVolume(value)
{
    if(value != 0 && EID("Liveview_Sound").title != "Sound")
    {
      EID("Liveview_Sound").title = "Sound";
      VLC_DoAct("Sound");
      mouseOut("Liveview_Sound");

    }
    A_SLIDERS[0].f_setValue(value);
    VLC_DoUpdateVolume(value);
}

var VLC_Version = PluginDetect.getVersion("vlc");
var VLC_Polling_Timer = null;

function onLoad()
{
  if( TypeIndex == "vlc" && navigator.platform.toLowerCase().indexOf("mac") < 0 )
  {
    if(VLC_Version != null)
    {
      EShow("vlc_control","");
      var i=0;
      while(EID("statusBor"+i))
      {
        EID("statusBor"+i).style.borderRight = "1px solid #000";
        i++;
      }
      EShow("table1","");
      EShow("table2","none");
      VLC_Polling_Timer = setTimeout("CheckVlcPlaying()",5000);
    }else{
      EShow("table1","none");
      EShow("table2","");
    }
  }else{
    EShow("table1","");
    EShow("table2","none");
    if( TypeIndex == "ocx")
    {
      AxMediaControl.Play(1);          
    } 
  }
}

function CheckVlcPlaying()
{
  if(VLC_Polling_Timer != null)
  {
    clearTimeout(VLC_Polling_Timer);
  }


  var vlc = getVLC("vlc");
  if( vlc )
  {
    if(VLC_Pause_Flag == false && EID("Liveview_Play").title == "Pause")
    {
      if(!vlc.playlist.isPlaying)
      {
        window.location.reload(true);
      }
    }
  }

  VLC_Polling_Timer = setTimeout("CheckVlcPlaying()",5000);
}

function onUnload()
{
  if(TypeIndex == "ocx")
  {
    onAxobjUnload();
  }else if(TypeIndex == "vlc"){
    if(VLC_Version != null)
    {
      VLC_DoStop();
    }
  }
}

//-->
</script>
</head>
<body leftmargin="0" topmargin="0" onLoad="onLoad()" onUnload="onUnload()">

<table id="table1" width="640" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;

    </td>
  </tr>
  <tr>
    <td height="450">&nbsp;</td>
    <td align="center" valign="top">
  <script type="text/JavaScript">
  <!--
  GetDeviceInfo_A('view','Image');

  var Codec;
  if(CHANNEL == 3) CHANNEL = 1;
  switch(CHANNEL)
  {
    default:
    case 1:
      Codec = "MPEG4";
      break;
    case 2:
      Codec = "MJPEG";
      break;
  }

  var VideoPath;
  if(Codec == "MPEG4")
  {
    VideoPath = "video.mp4";
  }else if(Codec == "MJPEG"){
    VideoPath = "video.mjpg";
  }

  if(CheckMac)  
  {
    if(TypeIndex == "quicktime")
    {
      var normalSize = VIEW_SIZE;

      if(normalSize == null)
      {
          normalSize = "Medium";
          setViewSize(normalSize);
      }

      if(normalSize == "Medium")
      {
          normalSize = "320x240";
      }else if(normalSize == "Large"){
          normalSize = "640x480";
      }

      if(normalSize.indexOf("x")>=0)
      {
        resolutionW=normalSize.slice(0,normalSize.indexOf("x"));
        resolutionH=normalSize.slice(normalSize.indexOf("x")+1,normalSize.length);
      }

      document.open();
            document.write("<embed SCALE=\"ToFit\" width=\"" + resolutionW + "\" height=\"" + resolutionH + "\"" +
                           " type=\"video/quicktime\" qtsrc=\"rtsp://" + location.hostname + "/" + VideoPath + "\"" +
                           " qtsrcdontusebrowser src=\"quicktime.mov\" autoplay=\"true\" controller=\"true\"\>");
      document.close();

      }else{
        CHANNEL = 3;
        Viewer();
      }
    }else{
      if(TypeIndex != "vlc")
      {
        if(TypeIndex == "jpg")
        {
          CHANNEL = 3;
        }
        Viewer();
      }else{
        if(VLC_Version != null)
        {
          VLC_Viewer(VideoPath);
        }
      }
    }  
    //-->
      </script>
      <br>
    <script FOR="AxMediaControl" EVENT="OnConnectStateNotify(id, msg)">
        if(navigator.appName.toLowerCase().indexOf("microsoft internet explorer") >= 0)
        {
          if(msg=="video lost")
          {
            window.top.leftFrame.location.reload();
            window.top.mainFrame.location.reload();
      }
      else if(msg=="full connect")
          {
            alert(loadLangString("L_Warn_FullConnection",false));
      }
      else if(msg=="mic occupy")
          {
            alert(loadLangString("L_MicOccupy",false));
      }
      }
        </script>
    </div>
    </td>
  </tr>
<tr style="height:10px;"></tr>
<tr id="vlc_control" style="display:none;">
  <td></td>

  <td align="center">
    <table cellSpacing="0" cellPadding="0" border="0" bordercolor="#000" style="table-layout:fixed;">
      <tr id="statusBar">
        <td class="statusBarL"></td>
        <td id="statusBor0" class="statusBarM" style="width:80px;">
          <div class="live_btn" style="padding:2px 7px 0px 7px;" id="statusBar0">
            <img id="Liveview_Play" src="./style/image/vlc/btn_Liveview_Pause_e.png" title="Pause"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseUp(this.title)"
                 onClick="VLC_DoAct(this.title)">
          </div>
          <div class="live_btn" style="padding:2px 14px 0px 7px;" id="statusBar1">
            <img id="Liveview_Stop" src="./style/image/vlc/btn_Liveview_Stop_e.png" title="Stop"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseUp(this.title)"
                 onClick="VLC_DoAct(this.title)">
          </div>
        </td>

        <td id="statusBor1" class="statusBarM" style="width:43px;"> <!-- 87 -->
    <!--
          <div class="live_btn" style="padding:2px 7px 0px 14px;" id="statusBar2">
            <img id="Liveview_Record" src="./style/image/vlc/btn_Liveview_Record_e.png" title="Record"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseOver(this.id)"
                 onClick="VLC_DoAct(this.title)">
          </div>
    -->
          <div class="live_btn" style="padding:2px 14px 0px 14px;" id="statusBar3"> <!-- 2 14 0 7 -->
            <img id="Liveview_Snapshot" src="./style/image/vlc/btn_Liveview_Snapshot_e.png" title="Snapshot"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseOver(this.id)"
                 onClick="VLC_DoAct(this.title)">
          </div>
        </td>

        <form name="form1">
        <td class="statusBarM" style="width:150px;"> <!-- 234 -->
          <div class="live_btn" style="padding:1px 0px 0px 14px;" id="statusBar5"> <!-- 1 7 0 14 -->
            <img id="Liveview_Sound" src="./style/image/vlc/btn_Liveview_Sound_e.png" title="Sound"
                 style="cursor:pointer;"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseUp(this.title)"
                 onClick="VLC_DoAct(this.title)">
          </div>


          <div id="soundSlider" class="divStyle" style="padding-top:5px;margin-left:40px;">
          <script style="text/javascript">    
          <!--
              var A_TPL1h = {
                    'b_vertical' : false,'b_watch': true,'n_controlWidth': 105,'n_controlHeight': 10,
                    'n_sliderWidth': 5,'n_sliderHeight': 12,'n_pathLeft' : 0,'n_pathTop' : 1,'n_pathLength' : 100,
                    's_imgControl': 'style/image/blueh_bg.gif','s_imgSlider': 'style/image/blueh_sl.gif','s_imgAlt': '','n_zIndex': 1
                }
                var A_INIT1h = {
                    's_form' : 0,'s_name': 'sliderValue1h','n_minValue' : 0,'n_maxValue' : 100,'n_value' : 30,'n_step' : 1
                }
                new slider(A_INIT1h, A_TPL1h, changeVolume);
            //-->
            </script>
            <input type="hidden" name="soundSlider" id="sliderValue1h" size="2" readonly>
            </div>

          <!--
          <div class="live_btn" style="padding:1px 7px 0px 14px;" id="statusBar6">
            <img id="Liveview_Talk" src="./style/image/vlc/btn_Liveview_TalkMute_e.png" title="TalkMute"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseUp(this.title)"
                 onClick="VLC_DoAct(this.title)">
          </div>
          <div id="talkSlider" class="divStyle" style=""></div>
          -->
        </td>
        </form>
        <!--
        <td class="statusBarM" style="width:44px">
          <div class="live_btn" style="padding:2px 7px 0px 14px;" id="statusBar7">
            <img id="Liveview_Fullscreen"
                 src="./style/image/vlc/btn_Liveview_Fullscreen_e.png" title="Fullscreen"
                 style="cursor:pointer"
                 onMouseOver="mouseOver(this.id)"
                 onMouseOut="mouseOut(this.id)"
                 onMouseDown="mouseDown(this.id)"
                 onMouseUp="mouseOver(this.id)"
                 onClick="VLC_DoAct(this.title)">
          </div>
        </td>
        -->
        <td class="statusBarR"></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
<table id="table2" style="display:none;" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>
      <u><a id="vlc_plugin_help" href="./vlc_help.htm" target="blank" style="color:#00000;">Install VLC plugin to watch streaming.</a></u>  
    </td>
  </tr>
</table>
</body>
<script type="text/JavaScript">
<!--
StyleCustomize("main");
//-->
</script>
</html>

2 个答案:

答案 0 :(得分:1)

这是我朋友的.NET 3.5解决方案。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.IO;

namespace kamera
{
    public partial class Form1 : Form
    {

        //private static String imageUrl = "http://10.10.10.1/now.jpg";
        private static String imageUrl=null;
        private static Thread t ;  
        private static Image webImage;
        private static List<String> kamere;
        System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
        private static int intervalOsvezevanja=3000; //3 sekunde osveževanja
        public Form1()
        {
            InitializeComponent();
            ////timer k pokliče funkcijo vsake 3 sekunde
            //AutoResetEvent autoEvent = new AutoResetEvent(false);
            //TimerCallback tcb = updatePicture;
            //System.Threading.Timer stateTimer = new System.Threading.Timer(tcb, autoEvent, 0, 200);


            t = new Thread(updatePicture);
            t.IsBackground = true;
            t.Start();

            timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
            timer.Interval = (intervalOsvezevanja) ;             // Timer will tick every 0.05 seconds
            timer.Enabled = true;                       // Enable the timer
            timer.Start();                              // Start the timer

            //skrijemo formo za dodajanje kamer
            panelDodajKamero.Hide();

            //inicializacija
            kamere = new List<String>();
            tbNaslovKamere.Text =  "cam-kk-";
            preberiDatoteko();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            pictureBox1.Image = webImage;
        }

        ~Form1() {
            //t.Join();
            t.Abort();
            timer.Stop();
            timer.Dispose();
        }

        private void updatePicture(object stateInfo)
        {
            while (true)
            {
                if (imageUrl != null)
                {
                    try
                    {
                        WebRequest requestPic = WebRequest.Create(imageUrl);
                        WebResponse responsePic = requestPic.GetResponse();
                        webImage = Image.FromStream(responsePic.GetResponseStream());
                        //webImage.Save("C:\\Users\\Public\\kamera\\kamera" + fileName + ".jpg");
                    }
                    catch{}
                }
                Thread.Sleep(intervalOsvezevanja);
            }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (menuStrip1.Visible)
            {
                menuStrip1.Hide();
            }
            else
            {
                menuStrip1.Show();
            }
        }

        private void menjajKamero(String camAddr)
        {
            if (camAddr.Contains("http"))
            {
                imageUrl = camAddr;
            }
            else
            {
                imageUrl = "http://" + camAddr + "/now.jpg"; //link to http://10.10.10.1now.jpg camera live image.
            }
        }

        private void btDodajKamero_Click(object sender, EventArgs e)
        {
            String webAddres;
            if (tbNaslovKamere.Text.Contains("http"))
            {
                webAddres = tbNaslovKamere.Text;
            }
            else
            {
                webAddres = "http://" + tbNaslovKamere.Text + "/now.jpg";
            }
            if (RemoteFileExists(webAddres))
            {
                if (!kamere.Contains(tbNaslovKamere.Text) && !kamere.Contains(webAddres))
                {
                    kamere.Add(tbNaslovKamere.Text);
                    //kamere.Add(webAddres);
                }
                menjajKamero(tbNaslovKamere.Text);
                //menjajKamero(webAddres);
                panelDodajKamero.Hide();
                izpisKamer();
                tbNaslovKamere.Text = "cam-kk-";
            }
            else
            {
                MessageBox.Show("Ne najdem Kamere");
            }
        }

        private void dodajKameroToolStripMenuItem_Click(object sender, EventArgs e)
        {
            panelDodajKamero.Show();
        }

        private void izpisKamer()
        {
            //zanka ki odstrani vse prej dodane kamere
            textBox1.Text = kamereToolStripMenuItem.DropDownItems.Count.ToString();

            foreach (String kamera in kamere)
            {
                kamereToolStripMenuItem.DropDownItems.RemoveByKey(kamera);
            }

            System.IO.StreamWriter file = new System.IO.StreamWriter(System.Environment.CurrentDirectory + "\\kamere.txt");
            foreach (String kamera in kamere)
            {
                ToolStripDropDownButton btTemp = new ToolStripDropDownButton(kamera, null, kameraOnClick, kamera);
                file.WriteLine(kamera);

                //dodamo trenutno kamero, ki je v kamerah.txt
                kamereToolStripMenuItem.DropDownItems.Add(btTemp);
            }
            file.Dispose();
            file.Close();
        }

        private void kameraOnClick(object sender, EventArgs e)
        {
            //tbNaslovKamere.Text+=sender.ToString();
            imageUrl = "http://" + sender.ToString() + "/now.jpg";
        }

        private void izhodToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void preberiDatoteko()
        {
            String vrstica;
            // Read the file as one string.
            if (File.Exists(System.Environment.CurrentDirectory + "\\kamere.txt"))
            {
                kamere = new List<String>();
                StreamReader myFile = new StreamReader(System.Environment.CurrentDirectory + "\\kamere.txt");
                while ((vrstica = myFile.ReadLine()) != null)
                {
                    //zapis v list
                    kamere.Add(vrstica);
                    //doda v meni
                    ToolStripDropDownButton btTemp = new ToolStripDropDownButton(vrstica, null, kameraOnClick, vrstica);
                    kamereToolStripMenuItem.DropDownItems.Add(btTemp);
                }
                myFile.Close();
            }
        }

        private void menuPobrisiKamere()
        {
            foreach (String kamera in kamere)
            {
                kamereToolStripMenuItem.DropDownItems.RemoveByKey(kamera);
            }
            kamere = new List<String>();
        }

        private void odpriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create an instance of the open file dialog box.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            // Set filter options and filter index.
            openFileDialog1.Filter = "Text Files (.txt)|*.txt";
            openFileDialog1.FilterIndex = 1;

            //openFileDialog1.Multiselect = true;
            // Call the ShowDialog method to show the dialog box.
            DialogResult userClickedOK = openFileDialog1.ShowDialog();

            //tbNaslovKamere.Text = userClickedOK.ToString();
            // Process input if the user clicked OK.
            if (userClickedOK.ToString().Equals("OK"))
            {
                menuPobrisiKamere();
                String vrstica;

                // Open the selected file to read.
                System.IO.Stream fileStream = openFileDialog1.OpenFile();
                kamere = new List<String>();
                StreamReader myFile = new StreamReader(fileStream);
                while ((vrstica = myFile.ReadLine()) != null)
                {
                    //zapis v list
                    kamere.Add(vrstica);
                    //doda v meni
                    ToolStripDropDownButton btTemp = new ToolStripDropDownButton(vrstica, null, kameraOnClick, vrstica);
                    kamereToolStripMenuItem.DropDownItems.Add(btTemp);
                }
                myFile.Dispose();
                myFile.Close();
                fileStream.Dispose();
                fileStream.Close();
                myFile.Close();
                fileStream.Close();
            }
        }

        private void pobrišiKamereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            menuPobrisiKamere();
        }

        private void zbrišiShranjeneKamereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            menuPobrisiKamere();
            System.IO.StreamWriter file = new System.IO.StreamWriter(System.Environment.CurrentDirectory + "\\kamere.txt");
            file.Dispose();
            file.Close();
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            Form1 frm1 = new Form1();
            frm1.Size = new Size(100, frm1.Size.Height);
        }

        private bool RemoteFileExists(string url)
        {
            try
            {
                //Creating the HttpWebRequest
                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                //Setting the Request method HEAD, you can also use GET too.
                request.Method = "HEAD";
                //Getting the Web Response.
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                //Returns TRUE if the Status code == 200
                return (response.StatusCode == HttpStatusCode.OK);
            }
            catch
            {
                //Any exception will returns false.
                return false;
            }
        }
    }
}

答案 1 :(得分:0)

您的C#应用​​程序中是否包含任何代码?

首先,我会看看你的代码的这一部分:

 document.open();
 document.write("<embed SCALE=\"ToFit\" width=\"" + resolutionW + "\" height=\"" + resolutionH + "\"" +
                           " type=\"video/quicktime\" qtsrc=\"rtsp://" + location.hostname + "/" + VideoPath + "\"" +
                           " qtsrcdontusebrowser src=\"quicktime.mov\" autoplay=\"true\" controller=\"true\"\>");
 document.close();

在许多IF案例之后,您获得了位置路径和类型。也许你也希望它们在你的C#代码中。然后设置WebBrowser控件的URI路径,看看会发生什么......

webBrowser1.Url = new Uri(myIPCamStringPath);

通常情况下,您可以使用标准浏览器直接连接每个IP-Cam。