コード例 #1
0
        private void OnPlayerStateChanged(object sender, EventArgs e)
        {
            if (_mediaSession != null)
            {
                if (_player.IsPlaying)
                {
                    _mediaSession.SetPlaybackState(PlaybackStateCompat.StatePlaying, (_schedule?.NowPlaying?.Position ?? default(TimeSpan)));
                }
                else
                {
                    _mediaSession.SetPlaybackState(PlaybackStateCompat.StateStopped);
                }
            }

            UpdateNotification();

            StateChanged?.Invoke(this, e);
        }
コード例 #2
0
 private void OnPlayerError(object sender, RadioStationErrorEventArgs e)
 {
     _mediaSession?.SetPlaybackState(PlaybackStateCompat.StateError);
     Stop();
     Error?.Invoke(this, e);
 }