This module contains all the necessary components to interact with the Spotify infrastructure, but doesn't require configuration files or additional system resources.
The core of all components is the Session class, it takes care of connecting, authenticating and setting everything up.
Session.Configurationconf = newSession.Configuration.Builder()
.setCacheEnabled()
.setCacheDir()
.setDoCacheCleanUp()
.setStoreCredentials()
.setStoredCredentialsFile()
.setTimeSynchronizationMethod()
.setTimeManualCorrection()
.setProxyEnabled()
.setProxyType()
.setProxyAddress()
.setProxyPort()
.setProxyAuth()
.setProxyUsername()
.setProxyPassword()
.setRetryOnChunkError()
.build();
Session.Builderbuilder = newSession.Builder(conf)
.setPreferredLocale()
.setDeviceType()
.setDeviceName()
.setDeviceId();
builder.userPass("<username>", "<password>"); // See other authentication methodsSessionsession = builder.create();
session.mercury(); // Mercury clientsession.audioKey(); // Request audio keys for AES decryptionsession.cdn(); // Request content from CDNsession.tokens(); // Request access tokenssession.api(); // Request metadata and other datasession.contentFeeder(); // Request tracks, images, etcsession.search(); // Perform searchYou can also instantiate the player:
PlayerConfigurationconf = newPlayerConfiguration.Builder()
.setAutoplayEnabled()
.setCrossfadeDuration()
.setEnableNormalisation()
.setInitialVolume()
.setLogAvailableMixers()
.setMetadataPipe()
.setMixerSearchKeywords()
.setNormalisationPregain()
.setOutput()
.setOutputPipe()
.setPreferredQuality()
.setPreloadEnabled()
.setReleaseLineDelay()
.setVolumeSteps()
.build();
Playerplayer = newPlayer(conf, session);A proper implementation is available in the Main class of the player.