1

我正在尝试编写一个 Spotify 应用程序,它是一个音乐测验。所以我需要在特定时间开始歌曲并让它们在另一个特定时间结束。我根本不知道该怎么做!带有 # 的 spotify Uri 不起作用。我已经尝试过这段代码,它使歌曲从头开始:

var sp = getSpotifyApi();
var models = sp.require("$api/models");
var views = sp.require("$api/views");

var single_track = models.Track.fromURI('spotify:track:0blzOIMnSXUKDsVSHpZtWL#01:00');
var single_track_playlist = new models.Playlist();
single_track_playlist.add(single_track);
var single_track_player = new views.Player();
single_track_player.track = null; // Don't play the track right away
single_track_player.context = single_track_playlist;

/* Pass the player HTML code to #single-track-player */
var single_track_player_HTML = document.getElementById('single-track-player');
single_track_player_HTML.appendChild(single_track_player.node);

谢谢你的帮助 !

4

2 回答 2

1

尝试更简单的事情:

var player = new views.Player();
player.PlayTrack('spotify:track:0blzOIMnSXUKDsVSHpZtWL', 60000, 10000);

从 1 分钟开始播放 10 秒的曲目。

于 2013-07-21T08:08:52.837 回答
0

Spotify 的服务条款不允许测验或游戏应用。

于 2015-11-19T22:48:07.023 回答