Simon Mitchell
Simon Mitchell

Reputation: 35

How to play an Youtube/Spotify playlist shuffling on a website

I am looking to play a Youtube or Spotify playlist shuffling on my website. So when they join my website, they will listen to a song off the playlist. I am guessing youtube would be very easy but I do not know how.

Thankyou

Upvotes: 0

Views: 114

Answers (1)

Aipi
Aipi

Reputation: 2476

You can use YOUTUBE and Spotify API. You will work with Javascript objects and JSON in return. Starting that you can show off a playlist or a youtube search result. Depending what you wanna do.

Read these documentations and if you wanna see some example about it, I am letting an own code with Youtube API: https://github.com/aipi/reampYoutubeAPI

It is good because you have an analytics and can see how often people interact with your API.

A example request code:

var request = gapi.client.youtube.search.list({
     part: "snippet",
     type: "video",
     q: encodeURIComponent($("#input-search").val()).replace(/%20/g, "+"),
     maxResults: 6,
     order: "viewCount",
     publishedAfter: "2015-01-01T00:00:00Z"
});

Upvotes: 0

Related Questions