AudioFileOpenURL ipod library

2019-05-07 12:18发布

问题:

I want to play music from iPod library using AudioFileOpenURL or ExtAudioFileOpenURL.

CFURLRef fileURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL];
AudioFileOpenURL(fileURL,a,b,&id);
//or ExtAudioFileOpenURL

But it doesn't work! How can I deal with it?Thank you!

回答1:

This isn't going to work because MPMediaItem asset URLs are only valid within AV Foundation. You can use that asset URL to open an AVURLAsset, get an AVAssetReader, etc., but you can't open it using any CoreAudio interfaces.

Check out the AV Foundation programming guide for more info - in particular, you'll want to check out AVPlayer and friends:

http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html



标签: audio ipod