Temuz
Temuz

Reputation: 1413

Playing an external link on the Spotify player

I've been trying to get the Spotify player to play something from a URL.

var sp = getSpotifyApi(1);
var models = sp.require('sp://import/scripts/api/models');

var t = models.Link.fromURL("http://some link here.mp3");
models.player.play(t);

Is this even possible? Am I using Link.fromURL correctly? Every time I run it, the console seems to suggest fromURL doesn't exist.

Upvotes: 0

Views: 1428

Answers (1)

iKenndac
iKenndac

Reputation: 18776

The Spotify Apps API can only play tracks sourced from a Spotify URI, like this:

var t = models.Link.fromURL("spotify:track:4QXxA6ixE222Ely7fAeopM");
models.player.play(t);

All other URLs are unsupported.

Upvotes: 3

Related Questions