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
-1
votes
1 answer

UserDefaults to Image code builds, but crashes when ran

I am coming from reading code from a ton of StackOverFlow posts for what seems to be a rather simple procedure, but when I try to implement what I've learned in my own code it fails. In my "ViewController" didSelectRowAt function, I initialized the…
ctm
  • 88
  • 1
  • 1
  • 10
-1
votes
1 answer

Trying to persist a MPMediaItem across launches

I've stored the MPMediaItem returned from MPMediaPickerController by saving its persistentID (which is a MPMediaEntityPersistentID). When I pass this to MPMediaQuery what I get back is a MPMediaEntity (superclass of MPMediaItem). Trying to cast this…
Walt
  • 162
  • 1
  • 7
-1
votes
2 answers

Converting MPMediaItemArtwork from iOS 10 to iOS 9

I'm updating the album art in Control Center by doing this: let image:UIImage = UIImage(named: title)! let artwork = MPMediaItemArtwork.init(boundsSize: image.size, requestHandler: { (size) -> UIImage in return image }) This…
Jacob Cavin
  • 2,169
  • 3
  • 19
  • 47
-1
votes
2 answers

Get a fileURL from MPMediaItem

I am working on a wifi filesharing app. I have to send audio and video files as resources using Multi Peer Connectivity. The problem that i am facing right now is i can't get a fileURL which is required by MPC to send the resource. I need a way to…
ashwin95
  • 11
  • 1
-1
votes
1 answer

How to sort an array of MPMediaItem according to time if the lastPlayedDate is same

I am trying to sort an array of MPMediaItem objects according to the recently played song. The sorting runs fine in case of different dates. But when I play multiple songs on the same date, the sorting fails to do the distinction.
Ghazalah
  • 233
  • 2
  • 14
-1
votes
1 answer

Having trouble displaying title of song currently playing in Swift?

I got it to work but when I select the song to play the title of the song doesn't show up the first time. I have to go back to the media picker and select the songs again for the title of the song to show up. Why doesn't it work the first time I…
coding22
  • 689
  • 1
  • 7
  • 28
-1
votes
1 answer

Possible to disable Search in MPMediaPickerController?

Using an instance of MPMediaPickerController to grab a song as background music to an app I am making. Works great but whenever the search function within the MediaPicker is used, it causes a lag in its presentation every time it is opened after.…
vinchenzio
  • 76
  • 5
-1
votes
1 answer

Is it possible to get video-related meta info for an MPMediaItem?

I'm doing some work with MPMediaItems, and specifically I'm trying to get a list of the videos on a user's device. Now, videos from iTunes will be locked so they can't be played from a third-party app, but user-added videos like home movies are…
Nerrolken
  • 1,975
  • 3
  • 24
  • 53
-1
votes
1 answer

All tableView Cells Show Same Artwork Image for Playlists

I have a tableView which shows a list of playlists from the user's music library. The code I used to get this list is: @implementation playlistsViewController { NSArray *playlists; MPMediaQuery *playlistsQuery; } - (void)viewDidLoad { …
WunDaii
  • 2,322
  • 4
  • 18
  • 26
-2
votes
1 answer

iTunes directory media item returned in unknown format

I wrote the following function that reads through the list of media items in my iTunes directory and returns the music files. I need to return the "song titles" but when I run it the items returned are in an unknown format. I am pretty sure I need…
Sophman
  • 85
  • 2
  • 17
-3
votes
1 answer

Play Song displayed in the table view in iOS

I have displayed all Songs of the iTunes Music Library in a table view. Now I would like to play the selected song in the table view as soon as the user taps on it. Here's my Code: import UIKit import MediaPlayer class ViewController:…
Ruwen
  • 1
  • 4
1 2 3
17
18