I am trying to play MPMedaiItem in MPMusicPlayerController in iOS. In my case, I have a UITableView that shows songs from a playlist. When I click a cell on a UITableView , I want to play this song using MPMusicPlayerController . And I also want to skip the following songs from the playlist when I click the "Next" button. How can I play it?
Here are some of my codes that write to the didSelected UITableView Method. It doesnβt play anything.
MPMediaItemCollection *songs = [self.arrayOfSongs objectAtIndex:indexPath.row ]; MPMediaItem *item = [songs representativeItem ]; NSLog(@"%@",[item valueForProperty:MPMediaItemPropertyTitle ]); [self.player setNowPlayingItem:[item valueForProperty:MPMediaItemPropertyAssetURL]]; [self.player play ];
source share