Questions tagged [mpmediaitemcollection]

A media item collection is a sorted set of media items (instances of the MPMediaItem class) from the iPod library. Typically, you use this class by requesting an array of collections from a media query by way of its collections property.

A media item collection is a sorted set of media items (instances of the class) from the iPod library. Typically, you use this class by requesting an array of collections from a media query by way of its collections property.

The grouping type for the media query determines the arrangement of the media items you obtain. You also use the media query collections property to obtain synced playlists.

A media item collection can have a wide range of metadata associated with it. You access this metadata using the valueForProperty: method along with the property keys. You can also access metadata in a batch fashion using the enumerateValuesForProperties:usingBlock: method. In some cases, this is more efficient. Both of these methods are defined in MPMediaEntity (the abstract superclass of ).

External Resources

71 questions
0
votes
1 answer

How to create MPMediaItem from assetURL!.absoluteString?

I am saving (mediaItemCollection.items.first?.assetURL!.absoluteString) to local SQLite DB as String. Now I want to create MPMediaItem object back from saved string i.e assetURL!.absoluteString, Is it possible to create MPMediaItem object from its…
0
votes
1 answer

store multiple song in mpplayer that are being fetch from database having song persistent id

i am trying to store multiple song in mpplayer that are being fetch from database having song persistent id..but only single song is being added .here is what i am doing MPMediaQuery *query = [MPMediaQuery songsQuery]; MPMediaPropertyPredicate…
devonsmith
  • 123
  • 2
  • 11
0
votes
1 answer

Why is the sound not playing?

So this is the code I have: At the press of a button: -(void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection { [self dismissModalViewControllerAnimated:YES]; self.selectedSong =…
Andrew
  • 15,935
  • 28
  • 121
  • 203
0
votes
0 answers

How to get MPMediaItemCollection knowing its item url?

I save item URL: var itemUrl: URL? = nil itemUrl = (qryAlbums.collections[currAlbum].items[currItem].assetURL!) let tempString: String = (track.last?.value(forKey: “url”) as! String?)! track.setValue(itemUrl?.absoluteString, forKey: “url”) now i…
Jay
  • 83
  • 1
  • 1
  • 8
0
votes
2 answers

Play all songs in music

I have this code to play all songs in music library (added via iTunes and downloaded in library from Apple Music). I can not have just the songs. What am I doing wrong? -(IBAction)playAllSongs:(id)sender { MPMediaQuery *songsQuery = [MPMediaQuery…
Joannes
  • 2,569
  • 3
  • 17
  • 39
0
votes
1 answer

Retrieving music from music library and Not able to figure out how can i retrieve the artpictures and names of songs from MPMediaItem

So basically i want to create a music player where all users will be able to play songs which they have in their device with my own customised music player. This code I'm using right now to get the list : import UIKit import MediaPlayer class…
Akshay
  • 11
  • 3
0
votes
0 answers

Saved Core Data items are visible only after relaunching the app

RootVC.swift private let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext private var fetchRecordRequestController: NSFetchedResultsController = NSFetchedResultsController() override func…
0
votes
0 answers

Accessing title of a MPMediaItem from an array, returns nil, although there exists one

Trying to save multiple playlists, and playback at a later time. Here is the code, which configures the logic to display cell data. let temp = rule?.valueForKey("music") as! NSArray musicArray = temp as! [MPMediaItem] print("musicArray =…
Shyam
  • 561
  • 5
  • 22
0
votes
3 answers

call NSString whit multiple parameters

I am a beginner and maybe it is a trivial question. I have this method: -(NSString *)getInfoFormediaItem:(MPMediaItemCollection *)list { NSString *trackCount; if ([list count] > 0) { trackCount = [NSString…
Joannes
  • 2,569
  • 3
  • 17
  • 39
0
votes
1 answer

How to pull the artist value from MPMediaItemCollection

Why does the following result in a tableview full of "Artist" instead of a tableview full of actual artist names? Where did I go wrong? How do I pull the artist value from a collection? All help is appreciated... var tableData =…
0
votes
1 answer

MPMediaQuery.artistsQuery() to show in groups

I know I'm very likely missing something extremely basic here but I'm stuck. Why does the following code produce a table view of each track's artist instead of the artists listed in groups (i.e. why is each artist listed 20-something times instead…
0
votes
1 answer

Transferring Music in iOS via Bluetooth

I have set it up to where music can be sent back and forth between iOS devices, but whenever the music is sent, the receiving phone gets this error: *** Terminating app due to uncaught exception 'MPMediaItemCollectionInitException', reason: 'items…
user2537376
  • 11
  • 1
  • 3
0
votes
2 answers

How can I use AVAssetExportSession to overwrite songs in my iPhone/iPod library?

So supposedly in the iOS 4 SDK you can edit and write to the user's iTunes library. I can successfully load an AVAsset from my iPhone/iPod library, but as a quick test I'm trying to just overwrite the same file right away using AVAssetExportSession…
taber
  • 3,166
  • 4
  • 46
  • 72
0
votes
1 answer

How do I get a mediaItemCollection from the mediaPickerController to play on an AVPlayer?

In my quest to answer this question I came across this in a book. "MPMediaItem, however, has an MPMediaItemPropertyAssetURL key (or assetURL property) whose value is a URL. That gives you a reference to the music file on disk,...having obtained an…
0
votes
1 answer

How to create MPMediaCollection from NSMutableArray?

So I make an app that allows users to create their own playlist, and I'm using MediaPlayer framework from iOS. I have no trouble before I update my X Code to latest version, However I got bellow error warning when I updated my X Code…
Ega Setya Putra
  • 1,645
  • 6
  • 23
  • 51