Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Music player
MPMusicPlayerController *controller = [MPMusicPlayerController iPodMusicPlayer];
MPMediaPropertyPredicate *artistPredicate = [MPMediaPropertyPredicate predicateWithValue:@"The Killers"
forProperty:MPMediaItemPropertyArtist
comparisonType:MPMediaPredicateComparisonContains];
MPMediaQuery *query = [[MPMediaQuery alloc] initWithFilterPredicates:[NSSet setWithArray:@[artistPredicate]]];
for (MPMediaItem *song in query.items) {
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
NSLog(@"Song title %@", songTitle);
}
[controller setQueueWithQuery:query];
[controller play];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.