Using iPhone audio files in own app - copy the audio file - is that possible?
I like the user to pick an audio file from the available list of audio and copy it into my own app. In the retrieved items of userMediaItemCollection in the Apple sample code "AddMusic
" there is the property: MPMediaItemPropertyAssetURL
. But I cant get to it, since I get the error "MPMediaItemPropertyAssetURL undeclared
" - although I imported MPMediaItem.h
.
In the apple doc it says:
MPMediaItemPropertyAssetURL
A URL pointing to the media item, from which an AVAsset object (or other URL-based AV Foundation object) can be created, with any options as desired. Value is an NSURL object.
The URL has the custom scheme of ipod-library. For example, a URL might look like this: ipod-library://item/item.m开发者_高级运维4a?id=12345
Usage of the URL outside of the AV Foundation framework is not supported.
Available in iPhone OS 4.0 and later.
Declared in MPMediaItem.h
Does that mean, it is not possible to access the audio files for own use?
Is there a workaround?
Many thanks
I learned that there is NO way of doing this. As I wrote in the comment - just use MPMediaItemPropertyPersistentID.....
This is an old thread but you can copy a MPMediaItem. You need to use AVAssetExportSession
though and not NSFileManager
You should be able to use AVURLAsset, and pass in that URL to the initializer.
精彩评论