Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added autoplay at start

  • Loading branch information...
commit 46f3c72bccc38b0a9e8e380caf4aea44feed67e7 1 parent f8e0fdc
@floreskul authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 index.html
View
14 index.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.