开发者

How to import music file from iphone music library to iPhone App

In MY iPhone App I am able to browse iphone Music Library even I am importing media file name to my app music file list but while running app next time i am not getting media file name which I imported previously

In My App i am importing songs from one folder "MusicSampler" which is in my APP Folder now On buttonclick I am opening iPod music Library and selecting song (Using mediaPicker) which is added to my song list at buttom, now next time when i am opening my App it loads the all songs from "musicSampler" folder but this tim开发者_StackOverflowe the new added songs previously from iPod-Library are not showing

what I should do to save imported song from iPod music library to my iphone app( either by adding music file to my "MusicSampler" or something else)

Please Help and Suggest

Thanks


Here is an example:

http://www.subfurther.com/blog/2010/07/19/from-iphone-media-library-to-pcm-samples-in-dozens-of-confounding-potentially-lossy-steps/

In sum, you should use CoreAudio or AV Foundation to save mp3 from iPhone Media Library.

I hope that it helps you.


OPEN Music Library of Phone

 MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
    mediaPicker.delegate = self;
    mediaPicker.allowsPickingMultipleItems = YES;
   [self presentViewController:mediaPicker animated:YES completion:nil];

Delegate are

- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
 {
   [self dismissViewControllerAnimated:YES completion:nil];
    MPMediaItem *item = [mediaItemCollection representativeItem];
    player=[[AVAudioPlayer alloc]initWithContentsOfURL:[item     valueForProperty:MPMediaItemPropertyAssetURL] error:nil];
   [player play];
 }

- (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker {

    [self dismissViewControllerAnimated:YES completion:nil];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜