public List <CameraSession> GetCameraSessionList(string mediaServerId)
        {
            ResponseStruct rs;
            var            ret = MediaServerApis.GetCameraSessionList(mediaServerId, out rs);

            if (rs.Code != ErrorNumber.None)
            {
                throw new HttpResponseException(JsonHelper.ToJson(rs));
            }

            ret = ret.FindAll(x => x.IsOnline == true);
            foreach (var obj in ret)
            {
                obj.UpTime = (DateTime.Now - obj.OnlineTime).TotalSeconds;
            }
            return(ret);
        }
        /// <summary>
        /// 获取录制状态
        /// </summary>
        /// <param name="sdp"></param>
        /// <returns></returns>
        private bool getDvrOnorOff(StreamDvrPlan sdp)
        {
            var mediaServer = Common.MediaServerList.FindLast(x => x.MediaServerId.Equals(sdp.MediaServerId));

            if (mediaServer != null && mediaServer.IsRunning)
            {
                var sessionList = MediaServerApis.GetCameraSessionList(mediaServer.MediaServerId, out _);
                if (sessionList != null)
                {
                    var obj = sessionList.FindLast(x => x.CameraId.Equals(sdp.CameraId));
                    if (obj != null)
                    {
                        var ret = mediaServer.WebApi.GetRecordStatus(new ReqZLMediaKitStopRecord()
                        {
                            App    = obj.App,
                            Secret = "",
                            Stream = obj.StreamId,
                            Vhost  = obj.Vhost,
                        }, out _);
                        if (ret.Code == 0 && ret.Status != null)
                        {
                            try
                            {
                                lock (Common.CameraSessionLock)
                                {
                                    Common.CameraSessions.FindLast(x => x.CameraId.Equals(obj.CameraId) &&
                                                                   x.MediaServerId.Equals(obj.MediaServerId))
                                    .IsRecord = ret.Status;
                                }
                            }
                            catch
                            {
                                //
                            }

                            return((bool)ret.Status);
                        }
                    }
                }
            }

            return(false);
        }
        /// <summary>
        /// 设置是否启用录制
        /// </summary>
        /// <param name="sdp"></param>
        /// <param name="enable"></param>
        private void setDvrOnorOff(StreamDvrPlan sdp, bool enable)
        {
            var mediaServer = Common.MediaServerList.FindLast(x => x.MediaServerId.Equals(sdp.MediaServerId));

            if (mediaServer != null && mediaServer.IsRunning)
            {
                var sessionList = MediaServerApis.GetCameraSessionList(mediaServer.MediaServerId, out _);
                if (sessionList != null)
                {
                    var obj = sessionList.FindLast(x => x.CameraId.Equals(sdp.CameraId));
                    if (obj != null)
                    {
                        if (enable)
                        {
                            mediaServer.WebApi.StartRecord(new ReqZLMediaKitStartRecord()
                            {
                                App             = obj.App,
                                Secret          = "",
                                Stream          = obj.StreamId,
                                Vhost           = obj.Vhost,
                                Customized_Path = mediaServer.RecordFilePath,
                            }, out _);
                        }
                        else
                        {
                            mediaServer.WebApi.StopRecord(new ReqZLMediaKitStopRecord()
                            {
                                App    = obj.App,
                                Secret = "",
                                Stream = obj.StreamId,
                                Vhost  = obj.Vhost,
                            }, out _);
                        }
                    }
                }
            }
        }