Spotify App API: Play specific track from album

前端 未结 1 683
感情败类
感情败类 2021-01-16 13:47

Trying to play a specific track from an album with the player view. It works all good when using

player.play(objTrack, objTrack.album);

But

相关标签:
1条回答
  • 2021-01-16 14:18

    If you have the current track number I suppose you got it from a track object. Here is my way:

    // trackObj <- The track object
    
    var album = m.Album.fromURI('spotify:album:7Kmmw7Z5D2UD5MVwdm10sT', function(album) {
        var player = new v.Player();
        player.track = trackObj;
        album.get = function() {
            return trackObj;
        }
        player.context = album;
        document.body.appendChild(player.node);
    });
    
    0 讨论(0)
提交回复
热议问题