如果我创建临时播放列表,请手动添加曲目,然后尝试将其用作图像视图的来源:
var imageForPlaylist = imageView.forPlaylist(playlist, { height: 300, widht: 300 });
结果始终是占位符(quaver 图像)。
这是预期的行为吗?
如果我创建临时播放列表,请手动添加曲目,然后尝试将其用作图像视图的来源:
var imageForPlaylist = imageView.forPlaylist(playlist, { height: 300, widht: 300 });
结果始终是占位符(quaver 图像)。
这是预期的行为吗?
您应该看到马赛克图像。试试这个代码,它会生成一个包含 10 个曲目的临时播放列表:
(function () {
"use strict";
var sp = getSpotifyApi(),
models = sp.require("$api/models"),
views = sp.require("$api/views"),
container = document.getElementById('container');
var tempPlaylist = new models.Playlist();
var playlistUri = 'spotify:user:nowplaylist:playlist:6QHyDeqaPNZ0nyLFJbSKTL';
models.Playlist.fromURI(playlistUri, function (playlist) {
for (var i = 0, l = Math.min(10, playlist.length); i < l; i++) {
var track = playlist.get(i);
tempPlaylist.add(track);
}
});
var player = new views.Player();
player.context = tempPlaylist;
container.appendChild(player.node);
})();
并Image
用播放器渲染: