Closed JimmyAppelt closed 9 years ago
Could you give me some information about the interval you are querying? There was an issue, where GetStatus
would return null after about 10 Minutes running, but this should be resolved by the new spotify client introduced.
I tried with 1000 - 2000 - 3000 - 5000 milliseconds
For example trying to do this withing a timer calling my GetSpotifyTrackInfo() method:
private void GetSpotifyTrackInfo()
{
_spotify.Connect();
var o = _spotify.GetStatus();
textBoxArtist.Text = o.Track.ArtistResource.Name;
textBoxSong.Text = o.Track.TrackResource.Name;
pictureBoxAlbum.ImageLocation = o.Track.GetAlbumArtUrl(AlbumArtSize.Size320);
}
The object o is not null, but the Track object inside o object returns null - lets say 8 out of 10
You should not call the Connect
-Method every time you query, just do it one time when your app starts. Try connecting in the constructor and remove the call in the method and see if it works :)
Ah right :)
I was trying to make my app so it connects automatically to spotify if it is opened after my application starts.
Seems it works fine like you said.
Thanks for swift response !
No Problem, feel free to open another issue if you have any further problems! :+1:
Using the SpotifyAPI.Local
When doing _spotify.GetStatus() after series of time, like i would like to do in a timer.
Every 1 second or 2 seconds or so, the object is not null but the track seems to be null very often.
My purpose is to check spotify very often if there is a new song playing.
I'm binding the Artistname like so:
var o = _spotify.GetStatus(); label.text = o.Track.ArtistResource.Name;
It will spam with NullReferenceException when i try to work with a timer, so the artist and etc. will not update for a pretty long time.