mpmediaquery

Detecting iTunes playlist folders on a device

三世轮回 提交于 2019-12-04 12:18:39
Through iTunes, you can create playlist folders that are nested arbitrarily deep. When you copy those playlist folders to your iOS device, iTunes is able to detect that they're folders, and allows you to drill down to the point where you ultimately get songs. Any idea how they do that?? I've been trying to figure this out for days. When I query for a specific persistentID of a known folder, the only things I can see about it that are different from a playlist that contains songs are: playlist.mediaTypes = 4359 (this is Music|Podcast|Audiobook|Movie|VideoiTunes) whereas a normal playlist will

MPMediaQuery to return local items only

 ̄綄美尐妖づ 提交于 2019-12-04 10:53:03
问题 I want to display a UITableView with only the songs that are currently on the device. If I query all items I (obviously) get all items, including the once that I purchased but not have downloaded. Here is the (part) of the code @property (strong, nonatomic) NSMutableArray *songsList; - (void)viewDidLoad { [super viewDidLoad]; self.tableView.delegate = self; self.tableView.dataSource = self; MPMediaQuery *everything = [[MPMediaQuery alloc] init]; NSArray *itemsFromGenericQuery = [everything

Retrieve list of songs ordered by last play time in iOS

风格不统一 提交于 2019-12-01 04:05:00
I need to obtain a list of the N most recently played songs from an iOS device, in order. The only way I can imagine doing it, at the moment, is by getting all the songs through an MPMediaQuery and manually sort them by lastPlayedDate . This is a potentially expensive operation and I was wondering if there was a better approach. Edit: After some tests, this is a very expensive operation. On a test library of 2500 songs, it took around 20 seconds to: Get all the songs. Assign a date to all songs that had never played (January 1 1970). Order them by date. Fetch the first N entries. Any

Retrieve list of songs ordered by last play time in iOS

对着背影说爱祢 提交于 2019-12-01 01:27:01
问题 I need to obtain a list of the N most recently played songs from an iOS device, in order. The only way I can imagine doing it, at the moment, is by getting all the songs through an MPMediaQuery and manually sort them by lastPlayedDate . This is a potentially expensive operation and I was wondering if there was a better approach. Edit: After some tests, this is a very expensive operation. On a test library of 2500 songs, it took around 20 seconds to: Get all the songs. Assign a date to all

How Do You Obtain the “Purchase Date” or “Date Added” from MPMediaItems in iPod Library

戏子无情 提交于 2019-11-29 15:18:36
As users download new songs into their iPod Music library from the iTunes Store, I would like to programmatically list those songs in a table view. Is it possible to obtain the "Date Added" or "Purchase Date" from the MPMediaItemCollection? I see there are property keys such as play count and last played date. I know the data exists because it can be viewed in iTunes, but I am not finding it. Any suggestions on where to find this or how to derive it? As you can see in Apple Documentation for MPMediaItem http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMediaItem

Access device music files from iPhone app programmatically

最后都变了- 提交于 2019-11-29 02:37:07
I want to access music files which are available on the iPhone and get it listed (or) get the file into my iPhone application some delegats and start playing it. Is it possible to do it ? Similar to how we access images from device photo album using UIImagePickerController delegate methods. Thank you! You can reference MPMediaPickerController class . It functions same as UIImagePickerController class. Samrat Pramanik -(void)loadDeviceMusic{ MPMediaQuery *everything = [[MPMediaQuery alloc] init]; [everything addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:[NSNumber

MPMediaQuery search for Artists, Albums, and Songs

随声附和 提交于 2019-11-29 02:03:56
How can I search the iPod Library in the same manner as the iOS Music application? I want to make general queries that return results for each Artists, Albums, and Songs. For instance, if I search Kenny Chesney I want the songs query to return all Kenny Chesney songs (and any songs titles or albums that contain Kenny Chesney in them.) When I make this query and a predicate for each property (song title, album title, artist name), an empty array returns. Here is a bit of code that may give you a better idea of what I am attempting to accomplish: MPMediaPropertyPredicate *songPredicate =

How Do You Obtain the “Purchase Date” or “Date Added” from MPMediaItems in iPod Library

爱⌒轻易说出口 提交于 2019-11-28 08:56:14
问题 As users download new songs into their iPod Music library from the iTunes Store, I would like to programmatically list those songs in a table view. Is it possible to obtain the "Date Added" or "Purchase Date" from the MPMediaItemCollection? I see there are property keys such as play count and last played date. I know the data exists because it can be viewed in iTunes, but I am not finding it. Any suggestions on where to find this or how to derive it? 回答1: As you can see in Apple Documentation

Access device music files from iPhone app programmatically

江枫思渺然 提交于 2019-11-27 15:21:12
问题 I want to access music files which are available on the iPhone and get it listed (or) get the file into my iPhone application some delegats and start playing it. Is it possible to do it ? Similar to how we access images from device photo album using UIImagePickerController delegate methods. Thank you! 回答1: You can reference MPMediaPickerController class . It functions same as UIImagePickerController class. 回答2: -(void)loadDeviceMusic{ MPMediaQuery *everything = [[MPMediaQuery alloc] init];