private void FrmOCXPlay_Load(object sender, EventArgs e) { try { this.panel1.Parent = this; this.panel1.Dock = DockStyle.Fill; if (AxOxcNGClient.GetInstance().g_axNGSWebClient1 != null) { this.panel1.Controls.Add(AxOxcNGClient.GetInstance().g_axNGSWebClient1); } AxOxcNGClient.GetInstance().g_axNGSWebClient1.Parent = this.panel1; AxOxcNGClient.GetInstance().g_axNGSWebClient1.Dock = DockStyle.Fill; AxOxcNGClient.GetInstance().g_axNGSWebClient1.BringToFront(); //toolStripLabel2.Text = titleText; if (this.WindowState == FormWindowState.Minimized) { this.Show(); } } catch (Exception ex) { if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("视频窗口显示异常 :{0}", ex.Message)); } } }
/// <summary> /// 关闭窗口-停止视频流 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void closewindows_button_Click(object sender, EventArgs e) { AxOxcNGClient.GetInstance().g_axNGSWebClient1.StopAllLiveInLayout(); if (this.WindowState == FormWindowState.Normal) { this.Hide(); } }
/// <summary> /// 多窗口播放 /// </summary> /// <param name="playno"></param> /// <param name="splitcount"></param> /// <param name="windows"></param> /// <param name="streammod"></param> /// <returns></returns> public int PlayCallEx(string playno, int splitcount, int windows, int streammod = 0) { int iRet = 0; try { if (publicfunction.g_lastSplitCount != splitcount) { AxOxcNGClient.GetInstance().g_axNGSWebClient1.SetLayout(splitcount); publicfunction.g_lastSplitCount = splitcount; if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("设置分屏数量: {0}", splitcount)); } } if (string.IsNullOrEmpty(playno)) { publicfunction.stopTimer(); MessageBox.Show("视频播放id为空,请输入正确播放id"); if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("视频播放id为空,请输入正确播放id")); } return(iRet); } iRet = AxOxcNGClient.GetInstance().g_axNGSWebClient1.StartLiveByIdEx(playno.ToString(), streamstatus, 0, windows); if (iRet != 1) { publicfunction.stopTimer(); Console.WriteLine("视频播放失败"); return(iRet); } streamstatus = streammod; m_playno = playno.ToString(); if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("播放视频源:{0},分屏数量: {1},播放窗口:{2},视频流模式: {3}", playno, splitcount, windows, streammod)); } } catch (Exception ex) { Console.WriteLine("视频播放异常:" + ex.Message); } return(iRet); }
/// <summary> /// 播放标准视频 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton2_Click(object sender, EventArgs e) { //辅主码流 try { if (streamstatus != 1) { streamstatus = 1; AxOxcNGClient.GetInstance().g_axNGSWebClient1.StartLiveById(m_playno, streamstatus, 0); if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("切换为辅流播放")); } } } catch (Exception ex) { Console.WriteLine("辅码流错误信息:" + ex.Message); } }
public int CloseWindows(int indexwindows) { int iRet = 0; try { iRet = AxOxcNGClient.GetInstance().g_axNGSWebClient1.StopLiveInLayout(indexwindows); if (iRet != 1) { publicfunction.stopTimer(); Console.WriteLine("关闭视窗失败"); return(iRet); } if (publicfunction.g_IsRecLog == "Yes") { RecordLog.GetInstance().WriteLog(Level.Info, string.Format("关闭指定窗口 :{0}", indexwindows)); } } catch (Exception ex) { Console.WriteLine("关闭视窗失败:" + ex.Message); } return(iRet); }