Можем ли мы использовать аудио из iTunes, полученное с помощью MPMediaPickerController
, и загрузить его на сервер? Я успешно загрузил записанный звук на сервер без каких-либо проблем. Но, получив URL-адрес актива от MPMediaPickerController
, я не смог преобразовать его для загрузки на сервер.
- (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
MPMediaItem *theChosenSong = [[mediaItemCollection items]objectAtIndex:0];
NSString *songTitle = [theChosenSong valueForProperty:MPMediaItemPropertyTitle];
NSLog(@"song Title: %@", songTitle);
NSURL *assetURL = [theChosenSong valueForProperty:MPMediaItemPropertyAssetURL];
NSLog(@"assetURL: %@", assetURL);
AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL:assetURL options:nil];
NSURL *testURl = theChosenSong.assetURL;
[self serviceUploadAudio:testURl];
[self dismissViewControllerAnimated:YES completion:nil];
}