Create a play/pause button with an HTML element

This code snippet will let you control the Player object with a click event.

The Javascript

/* Instantiate the global sp object; include models & views */
var sp = getSpotifyApi(1);
var models = sp.require("sp://import/scripts/api/models");
var player = models.player;

$('#play-me').click(function(){
    player.playing = !(player.playing);
    if (player.playing == true) {
        $('#play-me').empty().append('Playing!');
    } else {
        $('#play-me').empty().append('Paused');
    }
});

The HTML

<div id="play-me"></div>

The CSS

<style>
    #play-me {
        width:600px;
        height:40px;
        border:1px solid #333;
        font:italic 2.5em Georgia, serif;
        text-align:center;color:#000;
    }
</style>

Live Example