Esempio n. 1
0
        /// <summary>
        /// 传递的json数据解析到播放信息类成员
        /// </summary>
        /// <param name="Command"></param>
        /// <returns></returns>
        public PlayFrmInfo CommandParseJsonToCallInfo(string Command)
        {
            JObject     jo          = (JObject)JsonConvert.DeserializeObject(Command);
            PlayFrmInfo playFrmInfo = new PlayFrmInfo
            {
                playno     = jo["playno"].ToString(),
                LocationX  = Int32.Parse(jo["LocationX"].ToString()),
                LocationY  = Int32.Parse(jo["LocationY"].ToString()),
                SizeX      = Int32.Parse(jo["SizeX"].ToString()),
                SizeY      = Int32.Parse(jo["SizeY"].ToString()),
                title      = jo["title"] == null?string.Empty: jo["title"].ToString(),
                streammode = jo["streammode"] == null?Int32.Parse("0") : Int32.Parse(jo["streammode"].ToString())
            };

            if (jo.Property("ptz") == null)
            {
                playFrmInfo.ptz = string.Empty;
                if (publicfunction.g_IsRecLog == "Yes")
                {
                    //Console.WriteLine(string.Format("播放号:{0},不开启控制摄像头功能", playFrmInfo.playno));
                    //RecordLog.GetInstance().WriteLog(Level.Info, string.Format("播放号:{0},不开启控制摄像头功能", playFrmInfo.playno));
                }
            }
            else
            {
                playFrmInfo.ptz = jo["ptz"].ToString();
            }
            return(playFrmInfo);
        }
Esempio n. 2
0
        /// <summary>
        /// 视屏播放功能
        /// </summary>
        /// <param name="playno"></param>
        /// <param name="locationx"></param>
        /// <param name="locationy"></param>
        /// <param name="sizex"></param>
        /// <param name="sizey"></param>
        private static void playvideo(PlayFrmInfo playInfo)
        {
            publicfunction.g_IsContrlPlay = false;
            FrmOCXPlay m_frm = null;

            try
            {
                if (m_lastOcxPlayForm == null)
                {
                    m_frm = new FrmOCXPlay(playInfo.LocationX, playInfo.LocationY, playInfo.SizeX, playInfo.SizeY)
                    {
                        TopMost = true,
                        Text    = playInfo.title
                    };
                }
                else
                {
                    m_frm = m_lastOcxPlayForm;
                }
                m_frm.titleText = playInfo.title;
                m_frm.Show();
                m_lastOcxPlayForm = m_frm;
                //判断是否可控
                if (playInfo.ptz == "ptz")
                {
                    //冗余
                }
                //播放
                if (playInfo.playno.Contains(","))
                {
                    if (playInfo.playno.Split(',')[0] != "" && playInfo.playno.Split(',')[1] != "")
                    {
                        m_frm.showButton_HD();
                        m_frm.showButtonNormal();
                    }
                }
                m_frm.PlayCall(playInfo.playno, playInfo.streammode);
            }
            catch (Exception ex)
            {
                m_frm.Close();
                throw new Exception("ocx视频控件播放失败:" + ex.Message);
            }
        }