Banshee.Streaming.RadioTrackInfo.Play C# (CSharp) Method

Play() public method

public Play ( ) : void
return void
        public void Play()
        {
            if (trying_to_play) {
                return;
            }

            trying_to_play = true;
            SavePlaybackError (StreamPlaybackError.None);

            if (loaded) {
                PlayCore ();
            } else {
                // Stop playing until we load this radio station and play it
                ServiceManager.PlayerEngine.Close (true);

                ServiceManager.PlayerEngine.TrackIntercept += OnTrackIntercept;

                // Tell the seek slider that we're connecting
                // TODO move all this playlist-downloading/parsing logic into PlayerEngine?
                ServiceManager.PlayerEngine.StartSynthesizeContacting (this);

                OnParsingPlaylistStarted ();
                ThreadPool.QueueUserWorkItem (delegate {
                    try {
                        LoadStreamUris ();
                    } catch (Exception e) {
                        trying_to_play = false;
                        Log.Exception (this.ToString (), e);
                        SavePlaybackError (StreamPlaybackError.Unknown);
                        OnParsingPlaylistFinished ();
                        ServiceManager.PlayerEngine.Close ();
                    }
                });
            }
        }

Usage Example

Ejemplo n.º 1
0
        public static RadioTrackInfo OpenPlay(SafeUri uri)
        {
            RadioTrackInfo track = Open(uri);

            if (track != null)
            {
                track.Play();
            }
            return(track);
        }