objective c - AVAssetExportSession not working with ios 7 -


ios 7 ringtone software not work. ios 5 , ios 6 working properly. when run ios 7, duration of ringtone same source file created. needs 40 sec. seems 300-400 seconds.

- (void)convert{      avurlasset *songasset = [avurlasset urlassetwithurl:self.audioplayer.url options:nil];      avassetexportsession *exporter = [[avassetexportsession alloc]                                      initwithasset: songasset                                      presetname: avassetexportpresetapplem4a];      //exporter.outputfiletype = @"com.apple.m4a-audio";      exporter.outputfiletype = avfiletypeapplem4a;      cmtime start = cmtimemakewithseconds(self.audioplayer.currenttime, 1);    cmtime duration = cmtimemakewithseconds(40, 1);    cmtimerange range = cmtimerangemake(start, duration);    exporter.timerange = range;      nsstring *exportfile = [[self kdoc_dosya:self.name] stringbyappendingpathextension:@"m4r"];       if ([[nsfilemanager defaultmanager] fileexistsatpath:exportfile])        [[nsfilemanager defaultmanager] removeitematpath:exportfile error:nil];       nsurl *exporturl = [nsurl fileurlwithpath:exportfile];    exporter.outputurl = exporturl;      [exporter exportasynchronouslywithcompletionhandler:^{          int exportstatus = exporter.status;        switch (exportstatus) {              case avassetexportsessionstatusfailed: {                  nserror *exporterror = exporter.error;                nslog (@"avassetexportsessionstatusfailed: %@", exporterror);                break;            }            case avassetexportsessionstatuscompleted: {                nslog (@"avassetexportsessionstatuscompleted--");                break;            }             case avassetexportsessionstatusunknown: { nslog (@"avassetexportsessionstatusunknown"); break;}            case avassetexportsessionstatusexporting: { nslog (@"avassetexportsessionstatusexporting"); break;}            case avassetexportsessionstatuscancelled: { nslog (@"avassetexportsessionstatuscancelled"); break;}            case avassetexportsessionstatuswaiting: { nslog (@"avassetexportsessionstatuswaiting"); break;}                default: { nslog (@"didn't export status"); break;}            }          }]; } 

do set time range

[songasset inserttimerange:cmtimerangemake(kcmtimezero, songasset.duration)                      oftrack:[[songasset trackswithmediatype:avmediatypeaudio] objectatindex:0]                       attime:kcmtimezero                        error:nil]; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -