Questions tagged [mpmediaitem]

Class form Apple MediaPlayer framework. A media item represents a single piece of media (such as one song or one video podcast) in the iPod library.

A media item represents a single piece of media (such as one song or one video podcast) in the iPod library. A media item has an overall unique identifier, accessed using the MPMediaItemPropertyPersistentID property key, as well as specific identifiers for its metadata. These identifiers persists across application launches.

A media item can have a wide range of metadata associated with it. You access this metadata using the valueForProperty: method along with the property keys described in this document. The 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 MPMediaItemCollection.

266 questions
18
votes
7 answers

How to detect if an MPMediaItem represents a DRM-protected audio track on iOS

I would like to know if an MPMediaItem that represents a music track is for a Fairplay/DRM-protected item. Any way to do this?
Charlie Hitchcock
  • 287
  • 1
  • 3
  • 8
18
votes
1 answer

Obtaining iTunes ID to an iPod player item

I have an app that interacts with both the iPod player, and the iTunes Store Web Service Search API. Is there a way to obtain the iTunes ID for a song that I retrieve from my user's iPod library (e.g. via MPMusicPlayerController, or…
twinkle
  • 307
  • 1
  • 12
18
votes
3 answers

MPMediaItems raw song data

I was wondering how to access an MPMediaItem's raw data. Any ideas?
conradev
  • 1,074
  • 1
  • 14
  • 31
17
votes
2 answers

iOS - MPMediaItem Display a Default Artwork

I am currently developing an app that shows what artist, track and album art you're listening to in the Music player. All is going well apart from when I play a song with no artwork I want to be able to show my own default image (as opposed to…
Ben Hutchinson
  • 221
  • 2
  • 8
17
votes
2 answers

iOS 7 SDK - MediaPlayer Framework - Rolling back transaction

The following block of code results in the error message: 2013-09-13 15:27:08.449 Mobile[746:5603] {MediaLibrary} Rolling back transaction. MPMediaQuery *mediaQuery = [MPMediaQuery songsQuery]; NSArray *collections = [mediaQuery collections]; This…
JADurham909
  • 221
  • 2
  • 7
15
votes
1 answer

Play/Pause and Elapsed Time not updating in iOS command center properly

I have a video player that can play from the iOS command center and lock screen. When I toggle a play/pause button in my app, it should update the play/pause button in the command center (MPRemoteCommandCenter) by updating the nowPlayingInfo…
JEL
  • 1,540
  • 4
  • 23
  • 51
13
votes
0 answers

how to resolve when MPMediaItem assetURL is nil?

I'm working on code that looks at the user's videos and passes them along to AVPlayer by way of an AVPlayerItem which takes a URL. To get all the videos on an iOS device, you can do: let videoNumber = MPMediaType.anyVideo.rawValue let predicate =…
11
votes
4 answers

MPMediaQuery search for Artists, Albums, and Songs

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…
morcutt
  • 3,739
  • 8
  • 30
  • 47
10
votes
2 answers

Load songs from iPod Library right after sync

I'm developing an iPhone application that uses the iPod library to play some songs. I load the songs with the code below. The problem is, when running this code right after the device has been synced with iTunes, there is a problem. Apparently the…
Peter
  • 1,495
  • 1
  • 14
  • 21
9
votes
2 answers

Apple Music Offline Files Have no URL?

It seems that the property MPMediaItemPropertyAssetURL on a MPMediaItem returns null when the file is one that was from Apple Music and has been made "available offline". On the other hand, items from my original library which I uploaded to iTunes…
James
  • 291
  • 1
  • 3
  • 13
8
votes
2 answers

URL to MPMediaItem

I have a simple question but I can't find the right answer. I have a song url saved to my database in a path like this. aSound.path = [[item valueForProperty: MPMediaItemPropertyAssetURL] absoluteString]; How to convert back to a MPMediaItem object…
flatronka
  • 1,061
  • 25
  • 51
8
votes
1 answer

How to get Artist picture from MPMediaItem?

I'm searching for a way to get the picture of an Artist through the MediaPlayer library. I've searched in the Apple's Doc, but there is nothing about that. The property "Artwork" refers to the album's cover. Any idea if and how i can get that ?
8
votes
4 answers

How unique is MPMediaItemPropertyPersistentID?

How unique is MPMediaItemPropertyPersistentID? Will it even work when synching the list of IDs to another device connected to the same iTunes Account? I want to implement a iCloud synchronized playlist solution which stores the IDs as a list and I…
miho
  • 11,765
  • 7
  • 42
  • 85
8
votes
3 answers

Pick Music from iOS Library and Send / Save

I have a query regarding Music Files. I want to select 1/more Music files from the Music Library of iPhone/iTouch/iPad and Save in my Documents Folder or Send it to Server. I roughly went through MPMediaPickerController and AddMusic(Sample…
user1280350
7
votes
2 answers

MPMediaItemArtwork returning wrong sized artwork

I'm seeing a consistent issue with MPMediaItemArtwork in that it's returning artwork in a size different to that which I request. The code I'm using is as follows MPMediaItem *representativeItem = [self.representativeItems…
user814037
1
2 3
17 18