admin管理员组

文章数量:1332395

I have the artist, track, and album from LastFM API stored in a widget. I would like to play a 30 second snippet of the song from Spotify when a user clicks play. Is it possible to do this? I'm struggling to find a way.. Especially without user authentication / permissions.

Spotify App API: Play specific track from album

This looks promising, but I'm not sure if it's what I'm talking about...

If someone could point me in the right direction (what API calls to use), that would be great! I can figure out the rest from there.

I have the artist, track, and album from LastFM API stored in a widget. I would like to play a 30 second snippet of the song from Spotify when a user clicks play. Is it possible to do this? I'm struggling to find a way.. Especially without user authentication / permissions.

Spotify App API: Play specific track from album

This looks promising, but I'm not sure if it's what I'm talking about...

If someone could point me in the right direction (what API calls to use), that would be great! I can figure out the rest from there.

Share Improve this question edited May 23, 2017 at 11:51 CommunityBot 11 silver badge asked Jul 28, 2014 at 19:51 kwitbkwitb 111 silver badge4 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

In the Spotify API documentation I found a link to this github repo that uses the 30-sec API calls to build a web player you can check out here. I believe you want the track API:

preview_url      string      A link to a 30 second preview (MP3 format) of the track.

You can get the track preview_url from a search response, too.

If you know the artist and track title:

https://api.spotify./v1/search?q=artist:Lady+Gaga+title:Bad+Romance&type=track&limit=1

if you know the ISRC:

https://api.spotify./v1/search?q=isrc:US2J71103806&type=track

本文标签: javascriptPlay a Track Using Spotify Web APIStack Overflow