mpmediapickercontrollermpmediaquerympmedialibrary

How to get MPMediaPlaylist's user defined cover image and description?


I know how to get MPMediaQuery's title by:

MPMediaQuery *playlistsQuery = [MPMediaQuery playlistsQuery];

NSArray *items = [playlistsQuery collections];

MPMediaPlaylist *myPlaylist = items.firstObject;

NSLog(@"%@",myPlaylist.name); //"New playlist title"

Does anyone know how to access MPMediaPlaylist's cover & description?

Screenshot - User created Playlist


Solution

  • I haven't figured out the custom playlist artwork, but I do know how to get the playlist description! Here's the answer in Swift 3 syntax:

    let allPlaylists = MPMediaQuery.playlists().collections
    let playlist = allPlaylists.first
    
    // I dunno how to get the custom playlist artwork, 
    // but you can get artwork from items in the playlist:
    let artwork = playlist?.representativeItem?.artwork
    
    // The description is here:
    let description = playlist?.descriptionText