iOS iPod API - get actual song file -
in app wand nowadays media picker, allow user take 1 song, , it's actual mp3 (or other format long playable other ios devices) file.
how can accomplished? how can create object songs file?
i don't know why saying much bs getting rejected app store. i'll give quick rundown on how started.
-present media picker open user's ipod:
mpmediapickercontroller *pickercontroller = [[mpmediapickercontroller alloc] initwithmediatypes:mpmediatypemusic]; pickercontroller.prompt = nslocalizedstring(@"choose song", null); pickercontroller.allowspickingmultipleitems = no; pickercontroller.delegate = self; [self presentviewcontroller:pickercontroller animated:yes completion:nil]; [pickercontroller release];
-wait till user chooses song , callback in mediapicker delegate:
- (void)mediapicker:(mpmediapickercontroller *)mediapicker didpickmediaitems:(mpmediaitemcollection *)mediaitemcollection { mpmediaitem *thechosensong = [[mediaitemcollection items]objectatindex:0]; nsstring *songtitle = [thechosensong valueforproperty:mpmediaitempropertytitle]; nsstring *artist = [thechosensong valueforproperty:mpmediaitempropertyartist]; //then asseturl nsurl *asseturl = [thechosensong valueforproperty:mpmediaitempropertyasseturl]; avurlasset *songasset = [avurlasset urlassetwithurl:asseturl options:nil]; //now have this, either write asset (or part of) disk, access asset directly, send written asset device etc }
ios api file music ipod
No comments:
Post a Comment