In libspotify, when does the the PlaylistContainer become invalid (or: what is the lifetime of it)?

68 Views Asked by At

This question is mostly a question on the workings of libspotify on a conceptual level. I have tried various (unsuccessful) pieces of code, of which I cannot get a firm grasp, because I feel I don't fully understand how the library works.

The docs state that the sp_session_playlistcontainer gets the "playlist container for the currently logged in user". This leads me to believe that the PlaylistContainer is only valid in the time a user is logged in. For starters: is this correct?

The thing that is most unclear is what happens when a user is not explicitly logged out, but the connection somehow gets disrupted. For instance, when the ConnectionState becomes disconnected, offline or undefined and, after some time, returns to logged in.

I mostly investigated the 'disconnected scenario', and found that after returning to the logged in state, I could not get the PlaylistContainer to work properly again, either by keeping the original reference or retrieving a new reference. Most probably there is some error in code, but since I don't know what I should expect, I don't know what part is relevant to show here.

The question is thus: at what points in time does the PlaylistContainer become 'invalid', and should I get a new reference to that object? It would be nice if the answer could give insight the entire lifetime of the PlaylistContainer, in addition to my specific situation.

0

There are 0 best solutions below