// Base queries which can be used directly or as the basis for custom queries.// The groupingType for these queries is preset to the appropriate type for the query.+(MPMediaQuery*)albumsQuery;+(MPMediaQuery*)artistsQuery;+(MPMediaQuery*)songsQuery;+(MPMediaQuery*)playlistsQuery;+(MPMediaQuery*)podcastsQuery;+(MPMediaQuery*)audiobooksQuery;+(MPMediaQuery*)compilationsQuery;+(MPMediaQuery*)composersQuery;+(MPMediaQuery*)genresQuery;
MPMediaPropertyPredicate*artistNamePredicate=[MPMediaPropertyPredicatepredicateWithValue:@"Happy the Clown"forProperty:MPMediaItemPropertyArtistcomparisonType:MPMediaPredicateComparisonEqualTo];MPMediaQuery*quert=[[MPMediaQueryalloc]init];[quertaddFilterPredicate:artistNamePredicate];quert.groupingType=MPMediaGroupingArtist;NSArray*itemsFromArtistQuery=[quertitems];NSArray*collectionsFromArtistQuery=[quertcollections];
// Returns the value for the given entity property.// MPMediaItem and MPMediaPlaylist have their own properties-(id)valueForProperty:(NSString*)property;// Executes a provided block with the fetched values for the given item properties, or nil if no value is available for a property.// In some cases, enumerating the values for multiple properties can be more efficient than fetching each individual property with -valueForProperty:.-(void)enumerateValuesForProperties:(NSSet*)propertiesusingBlock:(void(^)(NSString*property,idvalue,BOOL*stop))blockNS_AVAILABLE_IOS(4_0);
// Playing media items with the applicationMusicPlayer will restore the user's iPod state after the application quits.+(MPMusicPlayerController*)applicationMusicPlayer;// Playing media items with the iPodMusicPlayer will replace the user's current iPod state.+(MPMusicPlayerController*)iPodMusicPlayer;
// Call -play to begin playback after setting an item queue source. Setting a query will implicitly use MPMediaGroupingTitle.-(void)setQueueWithQuery:(MPMediaQuery*)query;-(void)setQueueWithItemCollection:(MPMediaItemCollection*)itemCollection;
而不是这个属性:
123
// Returns the currently playing media item, or nil if none is playing.// Setting the nowPlayingItem to an item in the current queue will begin playback at that item.@property(nonatomic,copy)MPMediaItem*nowPlayingItem;
//A URL pointing to the media item,//from which an AVAsset object (or other URL-based AV Foundation object) can be created, with any options as desired. //Value is an NSURL object.MP_EXTERNNSString*constMPMediaItemPropertyAssetURL;