private void button9_Click(object sender, EventArgs e) { //OnBnClickedButtonStoppreview(); //OnBnClickedBtnStopplayback(); if (m_iDevice < 0) { return; } if (!HikSDK_iVMS7200.PlayM4_GetPort(ref m_lPort)) { return; } //m_iNetLine default is 1 if (m_iNetLine < 0 || m_iNetLine > 3) { m_iNetLine = 1; } HikSDK_iVMS7200.ST_DEVICE_NETINFO stDeviceRSMrequestInfo = new HikSDK_iVMS7200.ST_DEVICE_NETINFO(); stDeviceRSMrequestInfo.szAccessSrvIP = textBox2.Text; //IP of Register server stDeviceRSMrequestInfo.nAccessSrvPort = Convert.ToUInt16(textBox3.Text); //port of Register server stDeviceRSMrequestInfo.nChan = m_iChannelno; //channel number stDeviceRSMrequestInfo.nNetLine = (byte)m_iNetLine; //Network line(According to the actual situation) stDeviceRSMrequestInfo.nStreamType = comboBox1.SelectedIndex; //Stream type:0 Main stream ; 1:Sub stream stDeviceRSMrequestInfo.nTransPortType = 1; //The way of Stream media server to access stream :0 UDP ; 1TCP stDeviceRSMrequestInfo.szDeviceID = textBox1.Text; //The ID of device StringBuilder sb = new StringBuilder(); pRSMAVDataCallBack_ = pRSMAVDataCallBack; m_lPlayHandle = HikSDK_iVMS7200.PlayRSMAVStreamByTCP(textBox4.Text, Convert.ToUInt16(textBox5.Text), sb, ref stDeviceRSMrequestInfo, pRSMAVDataCallBack_, (IntPtr)0); if (m_lPlayHandle < 0) { HikSDK_iVMS7200.PlayM4_FreePort(m_lPort); m_lPort = -1; } textBox10.Text = "开始预览..."; }
public static extern int PlayRSMAVStream(string pszSrvIP, ushort nSrvPort, StringBuilder pszPrivate, ref ST_DEVICE_NETINFO pDeviceInfo, pRSMAVDataCallBack pfn, IntPtr nUsrData);