How to use “standardized track listings” in Spotify apps

前端 未结 2 955
一向
一向 2020-12-18 10:29

The Spotify UI guidelines for Spotify apps (at https://developer.spotify.com/technologies/apps/guidelines/design/) say \"When listing tracks in your app, use our standardize

相关标签:
2条回答
  • 2020-12-18 11:05

    Some examples

    sp = getSpotifyApi(1);
    
    var m = sp.require("sp://import/scripts/api/models");
    var v = sp.require("sp://import/scripts/api/views");
    
    // Example 1
    var tpl = new m.Playlist();
    var tempList = new v.List(tpl);
    tpl.add(m.Track.fromURI("spotify:track:4z4t4zEn4ElVPGmDWCzRQf"));
    tpl.add(m.Track.fromURI("http://open.spotify.com/track/7E8JGVhbwWgAQ1DtfatQEl"));
    tpl.add(m.Track.fromURI("spotify:track:40YBc3mR3yyqyYvtesQOMj"));
    tpl.add(m.Track.fromURI("spotify:local:Rolling+Stones:A+Bigger+Bang:Rain+Fall+Down:293"));
    
    document.body.appendChild(tempList.node);
    
    // Example 2
    var pl = m.Playlist.fromURI("spotify:user:username:playlist:424km2k4m24");
    var list = new v.List(pl);
    
    document.body.appendChild(list.node);
    
    // Example 3
    var album = m.Album.fromURI("spotify:album:1vWnB0hYmluskQuzxwo25a");
    var albumList = new v.List(album);
    albumList.node.classList.add("album");
    
    document.body.appendChild(albumList.node);
    
    0 讨论(0)
  • 2020-12-18 11:09

    Thanks for asking, I had exactly the same question too!

    I too get the issue where i get no actual content added - just the wrapper div. Not including api.css makes it work, but the list is obviously not styled. Including css/list.css directly breaks it too. Creating my own copy and selectively commenting out list.css I found the offending rule to be:

    .sp-list > div {
    

    if you change this to be

    .sp-list {
    

    then it renders fine. No idea what is going on. Obviously this solution is not idea because I've just duplicated what's meant to be a common resource...

    0 讨论(0)
提交回复
热议问题