Exemplo n.º 1
0
        void SetPlayerFullScreen(int index)
        {
            if (isFullScreen)
            {
                SinglePlayer p = Controls.Find("Player" + index, true)[0] as SinglePlayer;
                p.Width    = PlayerWidth;
                p.Height   = PlayerHeight;
                p.IsActive = true;
                switch (index)
                {
                case 1:
                    p.Left = 0;
                    p.Top  = 0;
                    break;

                case 2:
                    p.Left = PlayerWidth + 1;
                    p.Top  = 0;
                    break;

                case 3:
                    p.Left = 0;
                    p.Top  = PlayerHeight + 1;
                    break;

                case 4:
                    p.Left = PlayerWidth + 1;
                    p.Top  = PlayerHeight + 1;
                    break;

                default:
                    break;
                }
                foreach (SinglePlayer pl in Controls)
                {
                    pl.Show();
                }
                isFullScreen = false;
            }
            else
            {
                foreach (SinglePlayer p in Controls)
                {
                    if (p.Index != index)
                    {
                        p.Hide();
                    }
                }
                SinglePlayer player = Controls.Find("Player" + index, true)[0] as SinglePlayer;
                player.Left     = 0;
                player.Top      = 0;
                player.Width    = this.Width;
                player.Height   = this.Height;
                player.IsActive = true;
                isFullScreen    = true;
            }
        }
Exemplo n.º 2
0
        public void Release()
        {
            try
            {
                Player1.Release();
                Player2.Release();
                Player3.Release();
                Player4.Release();

                Player1 = new SinglePlayer();
                Player2 = new SinglePlayer();
                Player3 = new SinglePlayer();
                Player4 = new SinglePlayer();

                PlatformSDK = new P_HIKSDK();
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        void SetPlayerActive(int index)
        {
            if (index != activeIndex)
            {
                SinglePlayer player = null;
                if (activeIndex != 0)
                {
                    player          = Controls.Find("Player" + activeIndex, true)[0] as SinglePlayer;
                    player.IsActive = false;
                }

                player          = Controls.Find("Player" + index, true)[0] as SinglePlayer;
                player.IsActive = true;
                activeIndex     = index;
                if (PluginType == PluginType.PlatForm_Connection_Plugin && PlatformSDK != null)
                {
                    PlatformSDK.VideoInfo = player.VideoInfo;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 播放视频
        /// </summary>
        /// <param name="videotype">视频类型,平台可不传</param>
        /// <param name="ip">ip地址,平台可不传</param>
        /// <param name="port">端口号,平台可不传</param>
        /// <param name="channel">通道号</param>
        /// <param name="username">登录用户名,平台可不传</param>
        /// <param name="password">登录密码,平台可不传</param>
        /// <param name="uuid">uuid</param>
        /// <param name="playerindex">1-4,非必填,默认为当前选中</param>
        public void StartPlay(int videotype, string ip, int port, int channel, string username, string password, string uuid, int playerindex = 0)
        {
            if (playerindex > 4 || playerindex < 0)
            {
                ShowError("错误的播放器编号!");
                return;
            }

            SinglePlayer player = GetPlayer(playerindex);

            switch (PluginType)
            {
            ///直连
            case PluginType.Direct_Connection_Plugin:
                VideoType vt = (VideoType)videotype;

                if (player.IsInit)
                {
                    player.Release();
                }

                switch (vt)
                {
                case VideoType.Haikang:
                    player.SDK = new HKSDK();
                    break;

                case VideoType.Dahua:
                    player.SDK = new DHSDK();
                    break;

                case VideoType.Xinshijie:
                    player.SDK = new XSJSDK();
                    break;

                case VideoType.XiongMai:
                    player.SDK = new XMSDK();
                    break;

                case VideoType.ShangHaiChengFeng:
                    player.SDK = new SHCFSDK();
                    break;

                case VideoType.Platform_Infinova:
                    ShowError("英飞拓平台请通过平台接口接入!");
                    return;

                case VideoType.Platform_Hik:
                    ShowError("海康平台请通过平台接口接入!");
                    return;

                default:
                    ShowError("未知的视频类型!");
                    return;
                }

                LoginInfo linfo = new LoginInfo()
                {
                    Ip       = ip,
                    Port     = port,
                    UserName = username,
                    Password = password
                };

                Video vinfo = new Video()
                {
                    Channel   = channel,
                    Type      = (VideoType)videotype,
                    UUID      = uuid,
                    LoginInfo = linfo
                };

                //ActivePlayer.Release();
                player.VideoInfo = vinfo;
                player.Init();
                player.Login();
                player.StartPlay();
                break;

            //平台
            case PluginType.PlatForm_Connection_Plugin:
                player.VideoInfo.Channel = channel;
                player.VideoInfo.UUID    = uuid;
                player.StartPlay();
                break;

            default:
                ShowError("插件类型错误,请检查是否未初始化!");
                break;
            }
        }