简体   繁体   中英

Spotify API - Remove all tracks from temporary playlist

I currently have a temporary playlist but I want a button to remove all the tracks from said playlist. How is this done?

if you are using api version 1.0 you can remove all tracks

var myTempPlaylist;
models.Playlist.createTemporary("myTempList").done(function(playlist) { 
    myTempPlaylist = playlist;
    playlist.load("tracks").done(function(loadedPlaylist) {
        //....
    });
});

//remove all  existing tracks from the temp playlist
myTempPlaylist.tracks.clear();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM