Пример #1
0
 public Broadcaster(IOptions <PlayerConfiguration> playerConfigOptions, IOptions <MusicConfiguration> musicConfigOptions, Messenger messenger, ILoggerFactory loggerFactory) : base(loggerFactory)
 {
     this.messenger             = messenger;
     this.playConfig            = playerConfigOptions.Value;
     this.musicConfig           = musicConfigOptions.Value;
     webPlayerBroadcastInterval = musicConfig.WebPlayerBroadcastInterval;
     InitialiseQueue();
 }
Пример #2
0
 public override void ReplacePlayConfiguration(PlayerConfiguration pc)
 {
     base.ReplacePlayConfiguration(pc);
     if (mfp != null)
     {
         mfp.PlayerConfiguration = pc;
     }
 }
Пример #3
0
 public DeviceManager(PlayerConfiguration playerConfiguration, string musicServerUrl, DeviceIdentifier identifier,
                      Broadcaster broadcaster, ILoggerFactory lf)
 {
     this.playerConfiguration = playerConfiguration;
     this.musicServerUrl      = musicServerUrl;
     this.loggerFactory       = lf;
     this.log         = loggerFactory.CreateLogger <DeviceManager>();
     this.identifier  = identifier;
     this.broadcaster = broadcaster;
     log.Information($"player configuration: {playerConfiguration.ToJson()}");
 }
Пример #4
0
        public WindowsDeviceManager(PlayerConfiguration playerConfiguration, string musicServerUrl, DeviceIdentifier identifier,
                                    Broadcaster broadcaster, ILoggerFactory loggerFactory) : base(playerConfiguration, musicServerUrl, identifier, broadcaster, loggerFactory)
        {
            log = loggerFactory.CreateLogger <WindowsDeviceManager>();
            var enumerator = new MMDeviceEnumerator();

            mmDevice = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active)
                       .SingleOrDefault(x => x.FriendlyName == identifier.DeviceName);
            if (mmDevice == null)
            {
                log.Error($"{identifier.DeviceName} not found");
            }
            else
            {
                log.LogInformation($"using device {mmDevice.FriendlyName}, {mmDevice.DeviceFriendlyName}");
            }
        }
Пример #5
0
 public DeviceManagerFactory(IHostingEnvironment env, IOptionsMonitor <PlayerConfiguration> playerConfigurationOptions,
                             IHostedService hs, ILoggerFactory lf)
 {
     this.env = env;
     this.schedulerService = hs as SchedulerService;
     managers                 = new Dictionary <DeviceIdentifier, DeviceManager>(new DeviceComparer());
     loggerFactory            = lf;
     log                      = loggerFactory.CreateLogger <DeviceManagerFactory>();
     musicServerUrl           = null;
     this.playerConfiguration = playerConfigurationOptions.CurrentValue;
     playerConfigurationOptions.OnChangeWithDelay((opt) =>
     {
         this.playerConfiguration = opt;
         foreach (var item in managers)
         {
             item.Value.ReplacePlayConfiguration(this.playerConfiguration);
         }
     });
 }
Пример #6
0
 public WasapiManager(PlayerConfiguration playerConfiguration, string musicServerUrl, DeviceIdentifier identifier,
                      Broadcaster broadcaster, ILoggerFactory loggerFactory) : base(playerConfiguration, musicServerUrl, identifier, broadcaster, loggerFactory)
 {
 }
Пример #7
0
 public virtual void ReplacePlayConfiguration(PlayerConfiguration pc)
 {
     this.playerConfiguration = pc;
 }