我正在尝试编写一个 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);
谢谢你的帮助 !