Esempio n. 1
0
        void airplayServer_VolumeChanged(object sender, ShairportSharp.Airplay.VolumeChangedEventArgs e)
        {
            invoke(delegate()
            {
                if (isVideoPlaying)
                {
                    VolumeHandler volumeHandler = VolumeHandler.Instance;
                    if (savedVolume == null)
                    {
                        savedVolume = volumeHandler.Volume;
                    }

                    if (e.Volume == 0)
                    {
                        volumeHandler.Volume = volumeHandler.Minimum;
                    }
                    else if (e.Volume == 1)
                    {
                        volumeHandler.Volume = volumeHandler.Maximum;
                    }
                    else
                    {
                        double factor        = volumeHandler.Maximum / 0.9;
                        volumeHandler.Volume = (int)(factor - factor / Math.Pow(10, e.Volume));
                    }
                }
            }, false);
        }
Esempio n. 2
0
 protected virtual void OnVolumeChanged(VolumeChangedEventArgs e)
 {
     if (VolumeChanged != null)
     {
         VolumeChanged(this, e);
     }
 }
Esempio n. 3
0
        void airplayServer_VolumeChanged(object sender, ShairportSharp.Airplay.VolumeChangedEventArgs e)
        {
            if (!allowVolumeControl)
            {
                return;
            }

            var context = getPlayerContext <AirplayVideoPlayer>();

            if (context != null)
            {
                var pm = ServiceRegistration.Get <IPlayerManager>();
                lock (volumeSync)
                {
                    if (savedVolume == null)
                    {
                        savedVolume = pm.Volume;
                    }

                    if (e.Volume == 0)
                    {
                        pm.Muted = true;
                    }
                    else if (e.Volume == 1)
                    {
                        pm.Volume = 100;
                    }
                    else
                    {
                        double factor = 100 / 0.9;
                        pm.Volume = (int)(factor - factor / Math.Pow(10, e.Volume));
                    }
                }
            }
        }
Esempio n. 4
0
 void session_VolumeChanged(object sender, VolumeChangedEventArgs e)
 {
     OnVolumeChanged(e);
 }