Skip to content

Commit

Permalink
Added autoplay at start
Browse files Browse the repository at this point in the history
  • Loading branch information
floreskul committed Apr 25, 2012
1 parent f8e0fdc commit 46f3c72
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.html
Expand Up @@ -7,6 +7,20 @@
<script>
$(document).ready(function () {
sp = getSpotifyApi(1);
models = sp.require("sp://import/scripts/api/models");
player = models.player;
currentPlaylist = new models.Playlist();

// search and play song
var query = "classical";
var search = new models.Search(query);
search.localResults = models.LOCALSEARCHRESULTS.PREPEND;
search.observe(models.EVENT.CHANGE, function() {
if(search.tracks.length) {
player.play(search.tracks[0].uri);
}
});
search.appendNext();
});
</script>
</head>
Expand Down

0 comments on commit 46f3c72

Please sign in to comment.