예제 #1
0
        // 得到一个播放器
        public FormRealPlayer getPlayer()
        {
            // 如果有空余的播放器
            foreach (FormRealPlayer pl in this.Controls)
            {
                if (!pl.isPlaying)
                {
                    return(pl);
                }
            }

            // 如果有选中的播放器
            foreach (FormRealPlayer pl in this.Controls)
            {
                if (pl.isSelected)
                {
                    return(pl);
                }
            }

            // 直接得到第一个播放器
            if (this.Controls.Count > 0)
            {
                FormRealPlayer player = (FormRealPlayer)this.GetControlFromPosition(0, 0);
                return(player);
            }

            return(null);
        }
예제 #2
0
        public RealPlayerGrid(PlayerManager mgr, int row, int column)
        {
            this.RowCount    = row;
            this.ColumnCount = column;

            // 设置行属性
            float rowHeight   = 100 / row;
            float columnWidth = 100 / column;

            for (int i = 0; i < row; i++)
            {
                RowStyles.Add(new RowStyle(SizeType.Percent, rowHeight));
            }
            for (int i = 0; i < column; i++)
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Percent, columnWidth));
            }

            // 添加播放器
            for (int r = 0; r < RowCount; r++)
            {
                for (int c = 0; c < ColumnCount; c++)
                {
                    FormRealPlayer player = new FormRealPlayer(mgr);
                    player.Dock            = DockStyle.Fill;
                    player.FormBorderStyle = FormBorderStyle.None;
                    player.TopLevel        = false;
                    this.Controls.Add(player, c, r);
                    player.setGrid(this, c, r);
                    player.Show();
                }
            }
        }
예제 #3
0
        /// <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;
            }
        }
예제 #4
0
        /// <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();
            });
        }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="player"></param>
 public void removeRealPlayer(FormRealPlayer player)
 {
     realPlayerForms.Remove(player);
 }