Esempio n. 1
0
        private void ConfigureAndStartPlayer(Uri dataEndpoint, DateTime?startTime)
        {
            lock (this)
            {
                try
                {
                    var config = new PlayerConfiguration()
                    {
                        PipelineFactory = GetPipelineFactory(),
                        TypeFilter      = _filter,
                        Uri             = dataEndpoint
                    };

                    _player = new VxMetadataPlayer(config);

                    _player.Initialize();
                    _player.Start(startTime);

                    LOG.Info($"Started metadata player with RTSP endpoint '{RtspEndpoint}'");
                }
                catch (Exception e)
                {
                    LOG.Error($"Unable to initialize metadata player for  '{RtspEndpoint}', reason={e.Message}");
                }
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="config">The player's configuration</param>
        public VxMetadataPlayer(PlayerConfiguration config)
        {
            _config = config ?? throw new ArgumentNullException("Cannot configure metadata player with null configuration");

            if (_config.Uri == null)
            {
                throw new ArgumentException("Player configuration must provide an RTSP uri.");
            }
            else if (_config.PipelineFactory == null)
            {
                throw new ArgumentException("Player configuration must provide a IPipelineCreator.");
            }

            _isLive      = false;
            _disposed    = false;
            _initialized = false;
            _source      = new VxMetadataSource(_config.Uri, _config.Creds);
        }