0

I want to make basic Audio Player app by programatically. If every Audio file contain image then I want that in UIImageView automatically set image from audio file. If any file doesn't contain any image file then it should be set default image.

Like i shown below:

enter image description here

Mehul Solanki
  • 465
  • 7
  • 27
  • 1
    This is relevant http://stackoverflow.com/questions/7814248/is-there-a-way-to-extract-embedded-image-data-from-an-mp3-in-ios?lq=1 – overboming Feb 02 '13 at 15:30

2 Answers2

0

check how you are taking those images. -case its Networking, use SDWebImage, take a look here: https://github.com/rs/SDWebImage

-case those images are saved in a core data (example) make a search in your data, if exists, pick that data and convert it to an image

UIImage * image = [UIImage imagewithData:dataImage];

remember you need to have a database image online or offline. Then just make a search, case exists, put the image, case not, default image.

0

The code that you need can be found in Apple's Example as referenced in the question that overbombing referenced. They make it easy for you:

MPMediaItem *currentItem = [musicPlayer nowPlayingItem];

// Assume that there is no artwork for the media item.
UIImage *artworkImage = noArtworkImage;

// Get the artwork from the current media item, if it has artwork.
MPMediaItemArtwork *artwork = [currentItem valueForProperty: MPMediaItemPropertyArtwork];

// Obtain a UIImage object from the MPMediaItemArtwork object
if (artwork) {
    artworkImage = [artwork imageWithSize: CGSizeMake (30, 30)];
}

I would advise reading through Apple's Example anyway it seems you are doing pretty much exactly what they did.

WolfLink
  • 3,308
  • 2
  • 26
  • 44