Example #1
0
        void init()
        {
            PluginSettings settings = settingsWatcher.Settings;

            allowVolumeControl = settings.AllowVolume;
            sendCommands       = settings.SendAudioCommands;
            allowHDStreams     = settings.AllowHDStreams;
            videoBuffer        = settings.VideoBuffer;

            if (airtunesServer != null)
            {
                airtunesServer.Name            = settings.ServerName;
                airtunesServer.Password        = settings.Password;
                airtunesServer.MacAddress      = settings.CustomAddress;
                airtunesServer.Port            = settings.RtspPort;
                airtunesServer.AudioPort       = settings.UdpPort;
                airtunesServer.AudioBufferSize = (int)(settings.AudioBuffer * 1000);
                airtunesServer.Start();
            }

            if (airplayServer != null)
            {
                airplayServer.Name           = settings.ServerName;
                airplayServer.Password       = settings.Password;
                airplayServer.MacAddress     = settings.CustomAddress;
                airplayServer.iOS8Workaround = settings.iOS8Workaround;
                airplayServer.Port           = settings.AirplayPort;
                airplayServer.Start();
            }
        }
Example #2
0
        public void Start()
        {
            pluginIconPath = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Thumbs, "AirPlayer", "airplay-icon.png");
            GUIWindow window = new PhotoWindow();

            window.Init();
            GUIWindowManager.Add(ref window);
            photoWindow = (PhotoWindow)window;

            PluginSettings settings = new PluginSettings();

            allowVolumeControl = settings.AllowVolume;
            sendCommands       = settings.SendCommands;
            allowHDStreams     = settings.AllowHDStreams;
            videoBuffer        = settings.VideoBuffer;

            airtunesServer                          = new RaopServer(settings.ServerName, settings.Password);
            airtunesServer.MacAddress               = settings.CustomAddress;
            airtunesServer.Port                     = settings.RtspPort;
            airtunesServer.AudioPort                = settings.UdpPort;
            airtunesServer.AudioBufferSize          = (int)(settings.AudioBuffer * 1000);
            airtunesServer.StreamStarting          += airtunesServer_StreamStarting;
            airtunesServer.StreamReady             += airtunesServer_StreamReady;
            airtunesServer.StreamStopped           += airtunesServer_StreamStopped;
            airtunesServer.PlaybackProgressChanged += airtunesServer_PlaybackProgressChanged;
            airtunesServer.MetaDataChanged         += airtunesServer_MetaDataChanged;
            airtunesServer.ArtworkChanged          += airtunesServer_ArtworkChanged;
            if (allowVolumeControl)
            {
                airtunesServer.VolumeChanged += airtunesServer_VolumeChanged;
            }
            airtunesServer.Start();

            airplayServer                          = new AirplayServer(settings.ServerName, settings.Password);
            airplayServer.MacAddress               = settings.CustomAddress;
            airplayServer.Port                     = settings.AirplayPort;
            airplayServer.iOS8Workaround           = settings.iOS8Workaround;
            airplayServer.ShowPhoto               += airplayServer_ShowPhoto;
            airplayServer.VideoReceived           += airplayServer_VideoReceived;
            airplayServer.PlaybackInfoRequested   += airplayServer_PlaybackInfoRequested;
            airplayServer.GetPlaybackPosition     += airplayServer_GetPlaybackPosition;
            airplayServer.PlaybackPositionChanged += airplayServer_PlaybackPositionChanged;
            airplayServer.PlaybackRateChanged     += airplayServer_PlaybackRateChanged;
            if (allowVolumeControl)
            {
                airplayServer.VolumeChanged += airplayServer_VolumeChanged;
            }
            airplayServer.SessionStopped += airplayServer_SessionStopped;
            airplayServer.Start();

            g_Player.PlayBackChanged     += g_Player_PlayBackChanged;
            g_Player.PlayBackStopped     += g_Player_PlayBackStopped;
            g_Player.PlayBackEnded       += g_Player_PlayBackEnded;
            GUIWindowManager.OnNewAction += GUIWindowManager_OnNewAction;
        }
Example #3
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (server == null)
            {
                server = new RaopServer(nameTextBox.Text, passwordTextBox.Text)
                {
                    Port            = (int)rtspPortUpDown.Value,
                    AudioPort       = (int)udpPortUpDown.Value,
                    AudioBufferSize = (int)(bufferSizeUpDown.Value * 1000)
                };

                server.StreamStopped           += server_StreamStopped;
                server.StreamStarting          += server_StreamStarting;
                server.StreamReady             += server_StreamReady;
                server.PlaybackProgressChanged += server_PlaybackProgressChanged;
                server.MetaDataChanged         += server_MetaDataChanged;
                server.ArtworkChanged          += server_ArtworkChanged;
                if (allowVolumeCheckBox.Checked)
                {
                    server.VolumeChanged += server_VolumeChange;
                }
                server.Start();

                airplay                          = new AirplayServer(nameTextBox.Text, passwordTextBox.Text);
                airplay.ShowPhoto               += airplay_ShowPhoto;
                airplay.VideoReceived           += airplay_VideoReceived;
                airplay.PlaybackInfoRequested   += airplay_PlaybackInfoRequested;
                airplay.GetPlaybackPosition     += airplay_GetPlaybackPosition;
                airplay.PlaybackPositionChanged += airplay_PlaybackPositionChanged;
                airplay.PlaybackRateChanged     += airplay_PlaybackRateChanged;
                airplay.SessionStopped          += airplay_SessionStopped;
                airplay.SessionClosed           += airplay_SessionClosed;
                airplay.Start();

                panelSettings.Enabled = false;
                buttonStart.Text      = "Stop";
            }
            else
            {
                closeForms();

                airplay.Stop();
                airplay = null;

                server.Stop();
                server = null;
                panelSettings.Enabled = true;
                buttonStart.Text      = "Start";
            }
        }