With the desktop version of Spotify, it's possible to add local MP3 files to playlists and play them. Is this also possible with libspotify?
1 Answers
Not as such - libSpotify is only able to decode audio provided by Spotify's own service. If you want to implement playback of local files, you'll have to do it yourself. Once you have playback, you can, however, integrate Spotify's local files list.
By default, local files in the Spotify client aren't added to the user's account - you can't access that list from elsewhere (this is true of our own client - if you add local files to a client running on computer A, computer B's local files list will be empty).
However, as soon as the user stars a local track or adds it to a playlist, that is accessible from everywhere.
Local files have a different URI, like this: spotify:local:Coldplay:Mylo+Xyloto:Paradise:277
(spotify:local:ARTIST:ALBUM:TRACK:LENGTH_IN_SECONDS
). If you encounter a track with a URI like this, search through your known local files to find one that matches the given data, and play it if it exists.
Viva is an open-source desktop client for Mac OS X that implements local files. It may be a good reference depending on your use case.

- 18,730
- 3
- 35
- 51
-
I tried forwarding local links to the Spotify app but it crashes. Is it supposed to handle those? I don't want to keep local copies on the device for both my app and the official Spotify app for all local files on my playlist. – leolobato Jan 19 '13 at 13:04