public StreamingDelegate(SpotifyMusicServiceIos service) { NSNotificationCenter.DefaultCenter.AddObserver(new NSString("sessionUpdated"), (NSNotification obj) => { Debug.WriteLine("Got session updated notification", "stream"); this.service = service; var auth = SPTAuth.DefaultInstance; if (this.Player == null) { NSError error = null; this.Player = SPTAudioStreamingController.SharedInstance(); Debug.WriteLine("Player is " + this.Player == null ? "Null" : "Not null", "stream"); bool success = this.Player.StartWithClientId(auth.ClientID, null, SPOTIFY_CACHE_ENABLED, out error); if (success) { this.Player.Delegate = this; this.Player.PlaybackDelegate = new StreamingPlaybackDelegate(service); if (SPOTIFY_CACHE_ENABLED) { Debug.WriteLine("Spotify cache is enabled", "stream"); this.Player.DiskCache = new SPTDiskCache(1024 * 1024 * 64); } else { Debug.WriteLine("Spotify cache is disabled", "stream"); } } else { this.Player = null; Debug.WriteLine("*** Error: " + error.Description, "stream"); return; } } else { Debug.WriteLine("Player was already not null", "stream"); } Debug.WriteLine("Trying to login with access token", "stream"); this.Player.LoginWithAccessToken(auth.Session.AccessToken); this.service.SomethingChanged(); }); }
public StreamingPlaybackDelegate(SpotifyMusicServiceIos service) { this.service = service; }
public SpotifyAuth(SpotifyMusicServiceIos service) { this.service = service; }