/// <summary> /// 实时播放,遍历相应的realplayergrid /// </summary> /// <param name="nvr"></param> /// <param name="channel"></param> public void realPlayInGrid(int nvr, int channel) { // 得到可用的播放窗口 FormRealPlayer player = currentRealPlayerGrid.getPlayer(); // 首先停止当前的播放 if (player.isPlaying) { player.stop(); } player.isPlaying = true; player.nvr = nvr; player.channel = channel; player.realSession = nvrAdapterMgr.realPlay(nvr, channel, player.playerHandle); if (player.realSession >= 0) { //播放成功 player.isPlaying = true; player.setVideoId(nvr, channel); } else { player.isPlaying = false; } }
/// <summary> /// 新窗体播放视频 /// </summary> /// <param name="nvr"></param> /// <param name="channel"></param> public void realPlayInForm(int nvr, int channel) { if (realPlayerForms.Count >= MAX_POP) { return; } FormMain.mainForm.BeginInvoke((Action) delegate { FormRealPlayer player = new FormRealPlayer(this); player.TopMost = true; realPlayerForms.Add(player); player.isPlaying = true; player.realSession = nvrAdapterMgr.realPlay(nvr, channel, player.playerHandle); if (player.realSession >= 0) { //播放成功 player.isPlaying = true; player.setVideoId(nvr, channel); } else { player.isPlaying = false; } player.Show(); }); }