Questions tagged [mpmediaquery]

A media query specifies a set of media items (instances of MPMediaItem) from the iPod library by way of a filter and a grouping type. Filter and grouping type are both optional; an unqualified query matches the entire library.

A media query specifies a set of media items (instances of MPMediaItem) from the iPod library by way of a filter and a grouping type. Filter and grouping type are both optional; an unqualified query matches the entire library.

170 questions
1
vote
2 answers

How to get iTunes ID for a song in the iPhone music library?

I'm querying the iPhone media library using MPMediaQuery and getting a list of all the artists and albums. How do I get the iTunes ID for each artists, album or song so I can uniquely identify it? Just searching by name can be not very accurate.
Shahar Nechmad
  • 391
  • 1
  • 3
  • 4
1
vote
1 answer

Can I use MPMediaQuery to get the year of a song?

I've been reading the iOS iPod library documentation, trying to figure out if there is a way to fecth or filter song and/or albums by the year of publication. The MPMediaItem Class reference states that you can use: NSString *const…
dequin
  • 906
  • 12
  • 19
1
vote
0 answers

Why is my MPMediaItem being deallocated and crashing with EXC_BAD_ACCESS

How is it that this code is crashing when calling tableView.reloadData() ?? func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { let count = self.player.queueForPlayer.count return count } …
horseshoe7
  • 2,745
  • 2
  • 35
  • 49
1
vote
1 answer

is there any media query for desktop which can work only for 1366*768 landscape device only

i have make a sence and it works only for ipad-pro (1366*1024) landscape. It dont disturb my 1366*768 device viewport. let me show the code below: @media only screen and (min-device-width: 1025px) and (max-device-width: 1366px) and…
1
vote
0 answers

How can I remove duplicates from an MPMediaQuery? The effort below has a fatal error

I am making a Music Player app. MPMediaQuery returns duplicates. For example, when I get the list of songs from a certain album (10 songs are on the actually CD), 1 song shows up twice. I don't know why. Maybe I had sampled my old CD for the 1…
James64
  • 123
  • 10
1
vote
1 answer

Query two and more song at one time using the function "addFilterPredicate" by MPMediaItemPropertyPersistentID

My app loads a music playlist automatically when it starts up. In order to do this, I store the song IDs MPMediaItemPropertyPersistentID to a database, and load the songs when the app is starting up next time. The main code is the…
www.ruu.cc
  • 445
  • 1
  • 6
  • 16
1
vote
0 answers

How to get an MPMediaItem from a saved playbackStoreID (i.e. for Apple Music playlist items)

I'm making a music player app that can access and play music and playlists that come from Apple Music and the iOS music library, and I want to be able to save and reload the user's song queue across app launches. If a song is locally stored on a…
Thomas
  • 485
  • 4
  • 15
1
vote
0 answers

Converting a MPMediaItem genre selection into a list of songs

I have an array of genres(in the form of MPMediaItem) that the user picked from a list of genres in their total library. Now I want to get all of the songs from these genres. The array that contains the items is titled: var…
Jordan Heath
  • 114
  • 8
1
vote
0 answers

authorizationStatus() about MPMediaLibrary access

I want to access the media library to display songs list. So on precondition I am checking the authorization status for the media library. When we go for "Don't Allow" in the permission alert, getting the authorization status as .Denied, But app can…
Vishnuvardhan
  • 5,081
  • 1
  • 17
  • 33
1
vote
1 answer

How to convert ReversedRandomAccessCollection to regular collection

I've been trying to find a way to sort my resulting MPMediaQuery so that the results are sorted by date. I've had a lot of difficulty, and then I found the "reversed()" method, but I cannot get the returned data into a format that I can use with the…
wayneh
  • 4,393
  • 9
  • 35
  • 70
1
vote
2 answers

Unable to figure out how to prevent crash with Date type and wrapping in Swift 3

I'm working with MPMediaQuery and specifically Podcasts. I'm having a very difficult time with Optionals and wrapping/unwrapping in this particular case. titleFilter = MPMediaPropertyPredicate(value: selectedPodcastTitle, forProperty:…
wayneh
  • 4,393
  • 9
  • 35
  • 70
1
vote
0 answers

UISearchResultsUpdating and MPMediaItem

I'm having some problems when searching MPMediaItems. The code below will present the view and filter results. It will not clear the results when the search is cancelled (subsequent searches only add criteria to the already filtered data), change…
1
vote
1 answer

How to tell the MediaPlayer which song to play?

I have a tableView with all my songs (imported via MediaPlayer) and when i select a cell of the tableView I want to play the selected song. Right now my code is like this: func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath:…
1
vote
0 answers

loading playlist artwork like in the music app

I'm looking for an solution to display my artwork like in the apple music application. I'm able to load one artwork for the playlist but I want to be able to show 4 of the artworks as a playlist representative. Currently I'm using this code for my…
NoSixties
  • 2,443
  • 2
  • 28
  • 65
1
vote
2 answers

iOS Query via Album MPMediaEntityPersistentID sometimes brings back no songs

I'm writing an app that plays music using Apple's built in MediaPlayer library. I store an array of albums and an array of Ids, and then when one is selected I search for an album using the id. For some reason, some of the albums can't find any…
Tom Ax
  • 566
  • 5
  • 23