Chirp.Radio.Agent.AudioPlayer.OnPlayStateChanged C# (CSharp) Method

OnPlayStateChanged() protected method

Called when the playstate changes, except for the Error state (see OnError)
Play State changes cannot be cancelled. They are raised even if the application caused the state change itself, assuming the application has opted-in to the callback. Notable playstate events: (a) TrackEnded: invoked when the player has no current track. The agent can set the next track. (b) TrackReady: an audio track has been set and it is now ready for playack. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
protected OnPlayStateChanged ( BackgroundAudioPlayer player, AudioTrack track, PlayState playState ) : void
player BackgroundAudioPlayer The BackgroundAudioPlayer
track AudioTrack The track playing at the time the playstate changed
playState PlayState The new playstate of the player
return void
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Track = GetPreviousTrack();
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }