spotifyCurrentlyPlaying.js

Share your love of music with the world.

Prerequisites

What do you need to get started?

01/ Last.fm Account

You will need to have a Last.fm account to use.

Create an Account

02/ Last.fm API Access

You will need to have access to the Last.fm API. Be sure to make a note of your API key.

Create an App

03/ Connect Your Last.fm Account to Spotify

You can do this by opening the desktop application and going to "Preferences". You will see a section with the heading "LAST.FM". Enter your username and password to give Spotify access. This is so Spotify can scrobble the songs you play to Last.fm.

Install

Feel free to use whichever method is easiest for your project.

Bower:

$ bower install spotifyCurrentlyPlaying.js

npm:

$ npm install spotifyCurrentlyPlaying.js

CDN:

<script src="https://npmcdn.com/spotifyCurrentlyPlaying.js/dist/spotifyCurrentlyPlaying.min.js"></script>

View on Github Download Repo

Setup

Lets figure out how to make this thing work.

Add the script:

// Place this before the closing body tag
<script src="path/to/spotifyCurrentlyPlaying.min.js"></script>

Create a container:

// This will be used to display the Spotify widget
<div id="spotify-widget"></div>

Call the SCP( ) function:

// You will need to pass your parameters to the function
// You can initialize it with SCP() or SpotifyCurrentlyPlaying()
SCP({
    selector: '#spotify-widget',
    username: 'kjbrum',
    api_key: 'xxxxxxxxxxxxxxx',
    width: '100%',
    height: '370'
});

Results

This is similar to what you will get on your website.

Spread the

Things are better when shared with friends.