コード例 #1
0
 public void Stop()
 {
     if (airtunesServer != null)
     {
         airtunesServer.Stop();
     }
     if (airplayServer != null)
     {
         airplayServer.Stop();
     }
 }
コード例 #2
0
 void deInit()
 {
     if (airtunesServer != null)
     {
         airtunesServer.Stop();
     }
     if (airplayServer != null)
     {
         airplayServer.Stop();
     }
 }
コード例 #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";
            }
        }