1

I am working with iphone ipod to read the album and playlist and play it in my application.

My question is that that i get the image from the album i have selected. and it is also working well in my application.

But i never get images from the playlist which i have selected their are different songs in my playlist and also having different image for that songs. for the album i have get the code and it work great. i am new for this and i cant found any reference code for this.

And i am using AVPlayer to play the songs.

So please help me and provide some sample code. for how to get all images from playlist and convert that image to data in iphone.

Please help me.

4

2 に答える 2

3

あなたが探しているのはMPMediaItemPropertyArtworkforMPMediaItemです。ドキュメントに記載されているとおりです。MPMediaItemArtworkドキュメントに記載されているように、アートワーク プロパティを取得した後、オブジェクトを作成できます。

MPMediaItemArtwork オブジェクト、またはメディア アイテム アートワークは、メディア アイテムに関連付けられた音楽アルバム カバー アートなどのグラフィック イメージを表します。メディア アイテムについては、MPMediaItem クラス リファレンスで説明されています。

これで、このようなことができます。であると仮定songしますMPMediaItem:

UIImage *image = nil;

MPMediaItemArtwork *itemArtwork = [song valueForProperty:
                                          MPMediaItemPropertyArtwork];
if(itemArtwork != nil)
     image = [itemArtwork imageWithSize:CGSizeMake(100,100)];

アートワークがimage含まMPMediaItemれているので、それをイメージ ビュー ( [myImageView setImage:image]) に設定します。これは、アートワークが利用可能な場合にのみ機能することに注意してください

お役に立てれば。

于 2012-06-14T13:00:00.627 に答える
0

これにはVTM_AViPodReaderデモを使用できます。

于 2012-06-14T13:41:45.487 に答える