I want to play device songs using avplayer in my app. In NSLog i m getting array value ===> " 18023427656013653237", " 15946441828903552798", " 10791915036547881152", " 17986655796364263078" // Now i want to what are these values .....
I have tried this.....
-(IBAction)SelectSongs:(id)sender
{
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeAny];
picker.delegate = self;
picker.allowsPickingMultipleItems =YES;
picker.prompt = @"Select songs from the list";
[self presentViewController:picker animated:YES completion:^(void) {}];
}
-(void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection
{
if (mediaItemCollection)
{
NSMutableArray *medialibraryArray;
medialibraryArray=[[NSMutableArray alloc]init];
[medialibraryArray addObject:mediaItemCollection.items];// Modified
NSLog(@"%@=========>",medialibraryArray);
}
[self dismissViewControllerAnimated:YES completion:^(void) {}];}
-(void) mediaPickerDidCancel: (MPMediaPickerController *) mediaPicker
{
[self dismissViewControllerAnimated:YES completion:^(void) {}];
}
// Thanks in Advance
You're going to get all the songs in your library with this so the printout might take a while! Read up on MPMediaItem Class Reference and media queries to see how to get a subset of your entire music library.