Skip to content

Lootwig/spotify_sdk

 
 

Repository files navigation

spotify_sdk

licence pub package

Description

This will be a spotify_sdk package for flutter using both the spotify-app-remote sdk and spotify-auth library. The auth library is needed to get the authentication token to work with the web api.

Setup

Android

From the Spotify Android SDK Quick Start. You need two things:

  1. register your app in the spotify developer portal. You also need to create a sha-1 fingerprint and add this and your package name to the app settings on the dashboard as well as a redirect url.
  2. download the current Spotify Android SDK. Here you need the spotify-app-remote-.aar and spotify-auth-.aar.

After you are all setup you need to add the *.aar files to your Android Project as Modules. See the Spotify Android SDK Quick Start for detailed information.

Important here is the naming so that the package can find the modules.

  • Remote: spotify-app-remote
  • Auth: spotify-auth

Usage

To start using this package you first have to connect to Spotify. To only connect you can do this with connectToSpotifyRemote(...) or getAuthenticationToken(...) in both of these methods you need the client id, given in the spotify dashboard and the redirect url you set in the settings on the dashboard.

await SpotifySdk.connectToSpotifyRemote(clientId: "", redirectUrl: "")

If you want to use the web api aswell you have to use this method to get the authentication token.

var authenticationToken = await SpotifySdk.getAuthenticationToken(clientId: "", redirectUrl: "");

tbd...

Api

Connecting/Authenticating

Function Description Android iOS
connectToSpotifyRemote Connects the App to Spotify ✔️ 👷
getAuthenticationToken Gets the Authentication Token that you can use to work with the Web Api ✔️ 👷
logout logs the user out and disconnects the app connection 👷 👷

Player Api

Function Description Android iOS
getCrossfadeState Gets the current crossfade state ✔️ 👷
getPlayerState Gets the current player state ✔️ 👷
pause Pauses the current track ✔️ 👷
play Plays the given spotifyUri ✔️ 👷
queue Queues given spotifyUri ✔️ 👷
resume Resumes the current track ✔️ 👷
skipNext Skips to next track ✔️ 👷
skipPrevious Skips to previous track ✔️ 👷
seekTo Seeks the current track to the given position in milliseconds ✔️ 👷
seekToRelativePosition Adds to the current position of the track the given milliseconds ✔️ 👷
subscribeToPlayerContext Subscribes to the current player context ✔️ 👷
subscribeToPlayerState Subscribes to the current player state ✔️ 👷
getCrossfadeState Gets the current crossfade state ✔️ 👷
toggleShuffle Cycles through the shuffle modes ✔️ 👷
toggleRepeat Cycles through the repeat modes ✔️ 👷

Images Api

Function Description Android iOS
getImage Get the image from the given spotifyUri 👷 👷

User Api

Function Description Android iOS
addToLibrary Adds the given spotifyUri to the users library ✔️ 👷
getCapabilities tbd 👷 👷
getLibraryState tbd 👷 👷
removeFromLibrary tbd 👷 👷
subscribeToCapabilities tbd 👷 👷
subscribeToUserStatus tbd 👷 👷

Official Spotify Docs

About

Flutter Package to connect the spotify sdk

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 58.4%
  • Kotlin 37.5%
  • Swift 1.5%
  • Ruby 1.5%
  • Objective-C 1.1%