mpmediaitem

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

给你一囗甜甜゛ 提交于 2019-12-01 15:11:27
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 ( MPNowPlayingInfoCenter ). I'm not sure why it's not updating. For example, if I pause the video with a custom button in my app, the command center still shows the pause button (meaning the video is still playing which is wrong.) This is how I update the nowPlayingInfo : func updateMPNowPlayingInforCenterMetadata() { guard video != nil else {

Error getting artwork for current song

点点圈 提交于 2019-12-01 07:03:53
问题 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: - (void)handleNowPlayingItemChanged:(id)notification { MPMediaItem *item = self.musicPlayer.nowPlayingItem; CGSize albumCoverSize = self.albumCover.bounds.size; MPMediaItemArtwork *artwork = [item valueForProperty:MPMediaItemPropertyArtwork]; if (artwork) { self.albumCover.image =

iPhone song lyrics access

…衆ロ難τιáo~ 提交于 2019-11-30 07:58:35
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 then retrieving the lyrics using: [mediaItem valueForProperty:MPMediaItemPropertyLyrics] The problem is that this only works if you first open the song in the iPod music app and view the lyric there. Even if you do that the next time you sync it may stop working again. How can we get reliable access to lyrics? Solved: The following approach gets

Pick Music from iOS Library and Send / Save

夙愿已清 提交于 2019-11-30 07:17:45
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 Code) . But, I could only get details of selecting Songs and Playing it. Is it possible to Save those selected Songs , which I can also use to Send to Server ? Thanks Is it possible to save those selected songs, which I can also use to send to server? No, you can only play songs from the iTunes library. The raw audio files are not accessible, probably due to

How Do You Obtain the “Purchase Date” or “Date Added” from MPMediaItems in iPod Library

戏子无情 提交于 2019-11-29 15:18:36
As users download new songs into their iPod Music library from the iTunes Store, I would like to programmatically list those songs in a table view. Is it possible to obtain the "Date Added" or "Purchase Date" from the MPMediaItemCollection? I see there are property keys such as play count and last played date. I know the data exists because it can be viewed in iTunes, but I am not finding it. Any suggestions on where to find this or how to derive it? As you can see in Apple Documentation for MPMediaItem http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMediaItem

iPhone song lyrics access

我怕爱的太早我们不能终老 提交于 2019-11-29 10:24:55
问题 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 then retrieving the lyrics using: [mediaItem valueForProperty:MPMediaItemPropertyLyrics] The problem is that this only works if you first open the song in the iPod music app and view the lyric there. Even if you do that the next time you sync it may

Pick Music from iOS Library and Send / Save

此生再无相见时 提交于 2019-11-29 09:27:44
问题 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 Code). But, I could only get details of selecting Songs and Playing it. Is it possible to Save those selected Songs , which I can also use to Send to Server ? Thanks 回答1: Is it possible to save those selected songs, which I can also use to send to server?

MPMediaItemArtwork is null while cover is available in iTunes

大兔子大兔子 提交于 2019-11-29 07:23:45
The UIImage "image" is always empty ("null") though the cover is shown in the music app by apple. in iOS 7 it works fine, but with iOS 8 I get no cover. Whats wrong with my code, or what has changed in iOS 8? -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { AlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"]; MPMediaItemCollection *song = self.songsList[indexPath.row]; cell.albumName.text = [[song representativeItem] valueForProperty: MPMediaItemPropertyAlbumTitle]; cell.albumArtist.text = [[song representativeItem

MPMediaQuery search for Artists, Albums, and Songs

随声附和 提交于 2019-11-29 02:03:56
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 Kenny Chesney songs (and any songs titles or albums that contain Kenny Chesney in them.) When I make this query and a predicate for each property (song title, album title, artist name), an empty array returns. Here is a bit of code that may give you a better idea of what I am attempting to accomplish: MPMediaPropertyPredicate *songPredicate =

How Do You Obtain the “Purchase Date” or “Date Added” from MPMediaItems in iPod Library

爱⌒轻易说出口 提交于 2019-11-28 08:56:14
问题 As users download new songs into their iPod Music library from the iTunes Store, I would like to programmatically list those songs in a table view. Is it possible to obtain the "Date Added" or "Purchase Date" from the MPMediaItemCollection? I see there are property keys such as play count and last played date. I know the data exists because it can be viewed in iTunes, but I am not finding it. Any suggestions on where to find this or how to derive it? 回答1: As you can see in Apple Documentation