libspotify
|
#include <api.h>
Data Fields | |
void(* | logged_in )(sp_session *session, sp_error error) |
void(* | logged_out )(sp_session *session) |
void(* | metadata_updated )(sp_session *session) |
void(* | connection_error )(sp_session *session, sp_error error) |
void(* | message_to_user )(sp_session *session, const char *message) |
void(* | notify_main_thread )(sp_session *session) |
int(* | music_delivery )(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames) |
void(* | play_token_lost )(sp_session *session) |
void(* | log_message )(sp_session *session, const char *data) |
void(* | end_of_track )(sp_session *session) |
void(* | streaming_error )(sp_session *session, sp_error error) |
void(* | userinfo_updated )(sp_session *session) |
void(* | start_playback )(sp_session *session) |
void(* | stop_playback )(sp_session *session) |
void(* | get_audio_buffer_stats )(sp_session *session, sp_audio_buffer_stats *stats) |
void(* | offline_status_updated )(sp_session *session) |
void(* | offline_error )(sp_session *session, sp_error error) |
void(* | credentials_blob_updated )(sp_session *session, const char *blob) |
void(* | connectionstate_updated )(sp_session *session) |
void(* | scrobble_error )(sp_session *session, sp_error error) |
void(* | private_session_mode_changed )(sp_session *session, bool is_private) |
Session callbacks
Registered when you create a session. If some callbacks should not be of interest, set them to NULL.
void( * sp_session_callbacks::connection_error)(sp_session *session, sp_error error) |
Called when there is a connection error, and the library has problems reconnecting to the Spotify service. Could be called multiple times (as long as the problem is present)
[in] | session | Session |
[in] | error | One of the following errors, from sp_error SP_ERROR_OK SP_ERROR_CLIENT_TOO_OLD SP_ERROR_UNABLE_TO_CONTACT_SERVER SP_ERROR_BAD_USERNAME_OR_PASSWORD SP_ERROR_USER_BANNED SP_ERROR_USER_NEEDS_PREMIUM SP_ERROR_OTHER_TRANSIENT SP_ERROR_OTHER_PERMANENT |
void( * sp_session_callbacks::connectionstate_updated)(sp_session *session) |
Called when the connection state has updated - such as when logging in, going offline, etc.
[in] | session | Session |
void( * sp_session_callbacks::credentials_blob_updated)(sp_session *session, const char *blob) |
Called when storable credentials have been updated, usually called when we have connected to the AP.
[in] | session | Session |
[in] | blob | Blob is a null-terminated string which contains an encrypted token that can be stored safely on disk instead of storing plaintext passwords. |
void( * sp_session_callbacks::end_of_track)(sp_session *session) |
End of track. Called when the currently played track has reached its end.
[in] | session | Session |
void( * sp_session_callbacks::get_audio_buffer_stats)(sp_session *session, sp_audio_buffer_stats *stats) |
Called to query application about its audio buffer
[in] | session | Session |
[out] | stats | Stats struct to be filled by application |
void( * sp_session_callbacks::log_message)(sp_session *session, const char *data) |
Logging callback.
[in] | session | Session |
[in] | data | Log data |
void( * sp_session_callbacks::logged_in)(sp_session *session, sp_error error) |
Called when login has been processed and was successful
[in] | session | Session |
[in] | error | One of the following errors, from sp_error SP_ERROR_OK SP_ERROR_CLIENT_TOO_OLD SP_ERROR_UNABLE_TO_CONTACT_SERVER SP_ERROR_BAD_USERNAME_OR_PASSWORD SP_ERROR_USER_BANNED SP_ERROR_USER_NEEDS_PREMIUM SP_ERROR_OTHER_TRANSIENT SP_ERROR_OTHER_PERMANENT |
void( * sp_session_callbacks::logged_out)(sp_session *session) |
Called when logout has been processed. Either called explicitly if you initialize a logout operation, or implicitly if there is a permanent connection error
[in] | session | Session |
void( * sp_session_callbacks::message_to_user)(sp_session *session, const char *message) |
Called when the access point wants to display a message to the user
In the desktop client, these are shown in a blueish toolbar just below the search box.
[in] | session | Session |
[in] | message | String in UTF-8 format. |
void( * sp_session_callbacks::metadata_updated)(sp_session *session) |
Called whenever metadata has been updated
If you have metadata cached outside of libspotify, you should purge your caches and fetch new versions.
[in] | session | Session |
int( * sp_session_callbacks::music_delivery)(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames) |
Called when there is decompressed audio data available.
[in] | session | Session |
[in] | format | Audio format descriptor sp_audioformat |
[in] | frames | Points to raw PCM data as described by format |
[in] | num_frames | Number of available samples in frames . If this is 0, a discontinuity has occurred (such as after a seek). The application should flush its audio fifos, etc. |
void( * sp_session_callbacks::notify_main_thread)(sp_session *session) |
Called when processing needs to take place on the main thread.
You need to call sp_session_process_events() in the main thread to get libspotify to do more work. Failure to do so may cause request timeouts, or a lost connection.
[in] | session | Session |
void( * sp_session_callbacks::offline_error)(sp_session *session, sp_error error) |
Called when offline synchronization status is updated
[in] | session | Session |
[in] | error | Offline error. Will be SP_ERROR_OK if the offline synchronization error state has cleared |
void( * sp_session_callbacks::offline_status_updated)(sp_session *session) |
Called when offline synchronization status is updated
[in] | session | Session |
void( * sp_session_callbacks::play_token_lost)(sp_session *session) |
Music has been paused because an account only allows music to be played from one location simultaneously.
[in] | session | Session |
void( * sp_session_callbacks::private_session_mode_changed)(sp_session *session, bool is_private) |
Called when there is a change in the private session mode
[in] | session | Session |
[in] | isPrivate | True if in private session, false otherwhise |
void( * sp_session_callbacks::scrobble_error)(sp_session *session, sp_error error) |
Called when there is a scrobble error event
[in] | session | Session |
[in] | error | Scrobble error. Currently SP_ERROR_LASTFM_AUTH_ERROR. |
void( * sp_session_callbacks::start_playback)(sp_session *session) |
Called when audio playback should start
[in] | session | Session |
void( * sp_session_callbacks::stop_playback)(sp_session *session) |
Called when audio playback should stop
[in] | session | Session |
void( * sp_session_callbacks::streaming_error)(sp_session *session, sp_error error) |
Streaming error. Called when streaming cannot start or continue.
[in] | session | Session |
[in] | error | One of the following errors, from sp_error SP_ERROR_NO_STREAM_AVAILABLE SP_ERROR_OTHER_TRANSIENT SP_ERROR_OTHER_PERMANENT |
void( * sp_session_callbacks::userinfo_updated)(sp_session *session) |
Called after user info (anything related to sp_user objects) have been updated.
[in] | session | Session |