Exemple #1
0
        public VideoSource GetVideoSource(string videoId, int streamId)
        {
            _clientHub.UpdateDefault(CCTVInfoType.StaticInfo);
            CCTVStaticInfo info       = _clientHub.GetStaticInfo(videoId);
            var            streamInfo = info.Streams.FirstOrDefault(_ => _.Index == streamId);

            if (streamInfo != null)
            {
                return(GetVideoSource(videoId, streamInfo.Url));
            }
            return(null);
        }
Exemple #2
0
        private void tryAddKey(string videoId)
        {
            var            staticInfo = _infoSync.GetStaticInfo(videoId);
            ICameraControl cc         = null;

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

            case CCTVModels.CCTVPlatformType.CCTV2:
                cc = newCCTV2CameraControl(videoId);
                break;
            }
            if (cc != null)
            {
                _cameraControls.Add(videoId, cc);
            }
        }
        private StreamInfo findStreamInfo(string videoId, int actualStream)
        {
            CCTVStaticInfo staticInfo = _clientHub.GetStaticInfo(videoId);

            if (staticInfo != null)
            {
                foreach (StreamInfo streamInfo in staticInfo.Streams)
                {
                    ulong id     = 0;
                    int   stream = 1;
                    if (getCctv1UrlInfo(streamInfo.Url, out id, out stream))
                    {
                        if (stream == actualStream)
                        {
                            return(streamInfo);
                        }
                    }
                }
            }
            return(null);
        }