예제 #1
0
        private void InitPlayer(string accessToken)
        {
            if (_spotifyPlayer == null)
            {
                AccessToken = accessToken;

                var playerConfig = new Config(Forms.Context, accessToken, ApiConstants.SpotifyClientId);

                _spotifyPlayer = Spotify.GetPlayer(playerConfig, this, new InitializationObserverDelegate(p =>
                {
                    p.SetConnectivityStatus(_operationCallbackDelegate, GetNetworkConnectivity(Forms.Context));
                    p.AddNotificationCallback(this);
                    p.AddConnectionStateCallback(this);
                    p.Login(accessToken);
                }, throwable => LogStatus(throwable.ToString())));
            }
            else
            {
                _spotifyPlayer.Login(accessToken);
            }
        }