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
3
votes
2 answers

iTunes Match + AVplayer + MPMediaQuery not working

I'm developing an app which makes usage of AVPlayer, MPMediaItem and MPMediaQuery. It works as long as Itunes match. We start with a MPMediaQuery, then we perform some filtering leaving some MPMediaItems, then we have been using AVPlayer because: …
3
votes
1 answer

iPhone4 iOS5 how to save MPMediaItem with Core Data?

I'm trying to save a list of music files that the user has selected from the iPod music library. To do so, I get a list of persistentIDs which I will use to query the library later. I do this as follows: NSNumber* persistentID = [mediaItem…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
3
votes
1 answer

iPhone song lyrics access

I'm trying to get the lyrics for a song on an iOS device and the examples I've found on the web and stackoverflow show getting the song's MPMediaItem (i.e. using a [MPMediaQuery songsQuery] with MPMediaItemPropertyPersistentID as a predicate) and…
Jer
  • 344
  • 3
  • 12
3
votes
2 answers

Error getting artwork for current song

Grabbing album art for current song and using it to change a certain imageView.image generates an error, but no longer crashes. (It did before because I left out the if (!artwork) error handling. Eheh.) This method: -…
Thromordyn
  • 1,581
  • 4
  • 17
  • 45
3
votes
0 answers

MPMediaItemArtwork bounds.size is zero while cover is available in iOS Music

I am trying to get the artwork for the now playing song in the iOS Music app. The artwork is displayed correctly in the iOS Music app however calling MPMediaItemArtwork.bounds.size returns (0,0) meaning MPMediaItemArtwork.image(at: CGSize) fails to…
Eric
  • 41
  • 4
3
votes
1 answer

Field `lyrics` is empty for MPMediaItem of the current playing song in swift, ios 12+

I have the similar problem like: How do I get the lyrics of the currently playing song in Swift 4? - there is no answer here iPhone song lyrics access - answer does not work How to get lyrics for Now Playing song in iOS10 (Swift 3) - answer does…
tohasan
  • 31
  • 3
3
votes
2 answers

Get Video Data in Videos Application

I want my player to play videos that are in Video app. I access Media Library, and want to get list of videos, and when user selected a video, my player get the video data and play it on my own player. How can I get the video data? Notice that I…
rick
  • 1,009
  • 2
  • 10
  • 28
3
votes
0 answers

Bad sound quality using AVAudioEngine for MPMediaItem

I'm trying to apply filters to sound taken from apple music library by using AVAudioEngine: First of all, I get AVAudioFile: NSURL *assetURL = [song valueForProperty:MPMediaItemPropertyAssetURL]; NSError *error; AVAudioFile *audioFile =…
Mateusz
  • 233
  • 3
  • 8
3
votes
1 answer

Unique Id for MPMediaItem rather then persistentID

By using the persistentID for uniquely identify the song but we have the provision in music app to add the same song multiple times to the playlist this tends to have same song many times in the playlist along with same persistentID so I can't able…
Vishnuvardhan
  • 5,081
  • 1
  • 17
  • 33
3
votes
3 answers

Iphone - Writing a media player with lyrics

I want to write a simple media player which displays lyrics that are retrieved from the web. I know once LyricWiki was such a source, but now no longer exists. Does a new API or source for lyrics exist that I can use ? When I do get the lyrics, how…
Idan
  • 5,717
  • 10
  • 47
  • 84
3
votes
0 answers

Can a MPMediaEntityPersistentID be cast to a value which can be saved to NSUserDefaults.standardUserDefaults?

I am trying to save a [MPMediaEntityPersistentID] using NSUserDefaults.standardUserDefaults(); however, I cannot cast the MPMediaEntityPresitstentID to a type which can be saved. Here is the code: import Foundation import AVFoundation import…
George Lee
  • 814
  • 18
  • 34
3
votes
1 answer

Finding a Song from Persistent ID using Swift 2 programming

I am a beginner with Swift programming who is trying to re-write code that I found online that Finds A Song from Persistent ID. The original code is found at this…
3
votes
0 answers

MPMediaItem Returns A Blank/Transparent Music Cover

I having problem on displaying the item artwork of MPMediaItem. Here is the code for setting the music cover image: - (void)updateMusicInfo { if(_localSongList.count != 0) { _currentTrackNumber = [DataHolder…
JLT
  • 3,052
  • 9
  • 39
  • 86
3
votes
1 answer

imageWithSize Flakey with MPMediaItemArtwork in iOS8

In my app, I display album artwork on a button. On an iPhone 5, the button bounds size is 273x269.5. My code to size the artwork has always been very straightforward and nothing has changed. MPMediaItem *currentItem = [musicPlayer…
JeffB6688
  • 3,782
  • 5
  • 38
  • 58
3
votes
1 answer

How to play songs (only songs) from a playlist on iOS?

I'm trying to play songs from an iPod playlist. As far as playlist may have videos too, I want to play only songs in them. MPMusicPlayerController *mp = [MPMusicPlayerController applicationMusicPlayer]; MPMediaQuery *query = [MPMediaQuery…
OtoLeo
  • 363
  • 3
  • 19