4
MP3 파일에서 앨범 사진을 가져 오려고합니다.MP3 파일/ID3 태그에서 앨범 사진 가져 오기
이 경우 파일을 재생하려면 AVAudioPlayer
을 사용합니다.
MPMusicPlayerController *controller = [MPMusicPlayerController applicationMusicPlayer];
MPMediaItem *current = controller.nowPlayingItem;
MPMediaItemArtwork *artwork = [current valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artwork2 = [artwork imageWithSize:artwork.bounds.size];
[artworkView setImage:artwork2];
그러나 artworkView
가 어떠한 이미지를 포함하지 않습니다
는 여기에 내가이 앨범 사진을 얻을 것이라고 생각 코드 입니다.
나는 조금 붙어 있습니다.
ID3 태그에서 아트웍을 직접 가져올 수있는 방법을 제안하는 사람이 있으면 도움이 될 것입니다.
도움을 주시면 감사하겠습니다.
[item enumerateValuesForProperties:[NSSet setWithObjects:MPMediaItemPropertyTitle,MPMediaItemPropertyAlbumTitle,MPMediaItemPropertyArtist,MPMediaItemPropertyArtwork,nil]
usingBlock:^(NSString *property, id value, BOOL *stop) {
if ([property isEqualToString:MPMediaItemPropertyTitle]){
if (value){
titre=value;
}else {
[email protected]"";
}
}
if ([property isEqualToString:MPMediaItemPropertyArtist]){
if(value){
artist=value;
}else {
[email protected]"";
}
}
if ([property isEqualToString:MPMediaItemPropertyArtwork]){
MPMediaItemArtwork *art=value;
if (art!=nil){
imgV.image=[art imageWithSize:CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.width)];
}
}
}];
: