コード例 #1
0
        public void SubscribeSwitchStatus(string videoId, Action <int, int> onSwitchStatus)
        {
            Events events = _eventsDict.GetOrAdd(videoId, x => new Events(x));

            events.SwitchStatusEvent += onSwitchStatus;

            ulong cctv1VideoId = CCTV1CameraControl.ToCCTV1Id(videoId);

            checkVideoInfo();
            _info.StartCtrl(cctv1VideoId, TimeSpan.FromSeconds(30));
        }
コード例 #2
0
        private void info_SwitchStatusEvent(ulong cctv1VideoId, int index, int status)
        {
            //Console.WriteLine($"switch:{index}, {status}");
            string videoId = CCTV1CameraControl.FromCCTV1Id(cctv1VideoId);
            Events events  = null;

            if (_eventsDict.TryGetValue(videoId, out events))
            {
                events.FireSwitchStatusEvent(index, status);
            }
        }
コード例 #3
0
        public void UnsubscribeSwitchStatus(string videoId, Action <int, int> onSwitchStatus)
        {
            Events events = null;

            if (_eventsDict.TryGetValue(videoId, out events))
            {
                events.SwitchStatusEvent -= onSwitchStatus;

                if (events.IsSwitchStatusEventNull())
                {
                    ulong cctv1VideoId = CCTV1CameraControl.ToCCTV1Id(videoId);
                    _info.EndCtrl(cctv1VideoId);
                }
            }
        }
コード例 #4
0
        private void tryAddKey(string videoId)
        {
            var            staticInfo = CCTVInfoManager.Instance.GetStaticInfo(videoId);
            ICameraControl cc         = null;

            switch (staticInfo.Platform)
            {
            case  CCTVModels.CCTVPlatformType.CCTV1:
                cc = new CCTV1CameraControl(videoId);
                break;

            case CCTVModels.CCTVPlatformType.CCTV2:
                cc = newCCTV2CameraControl(videoId);
                break;
            }
            if (cc != null)
            {
                _cameraControls.Add(videoId, cc);
            }
        }