mpmediapickercontroller

Access device music files from iPhone app programmatically

江枫思渺然 提交于 2019-11-27 15:21:12
问题 I want to access music files which are available on the iPhone and get it listed (or) get the file into my iPhone application some delegats and start playing it. Is it possible to do it ? Similar to how we access images from device photo album using UIImagePickerController delegate methods. Thank you! 回答1: You can reference MPMediaPickerController class . It functions same as UIImagePickerController class. 回答2: -(void)loadDeviceMusic{ MPMediaQuery *everything = [[MPMediaQuery alloc] init];

MPMediaItems raw song data

别等时光非礼了梦想. 提交于 2019-11-27 02:51:45
I was wondering how to access an MPMediaItem's raw data. Any ideas? MIchael you can obtain the media item's data in such way: -(void)mediaItemToData { // Implement in your project the media item picker MPMediaItem *curItem = musicPlayer.nowPlayingItem; NSURL *url = [curItem valueForProperty: MPMediaItemPropertyAssetURL]; AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL: url options:nil]; AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName: AVAssetExportPresetPassthrough]; exporter.outputFileType = @"public.mpeg-4"; NSString *exportFile = [[self