ios - AVAudioPlayer can't play while AVCaptureVideoPreviewLayer -


i'm generating .m4a video recorded during avcapturevideopreviewlayer session (using wonderful pbjvision). generate m4a file video captured:

avassetexportsession *exportsession=[avassetexportsession exportsessionwithasset:myasset presetname:avassetexportpresetapplem4a];  nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *audiopath = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@"%@.m4a",audiofilename]]; exportsession.outputurl=[nsurl fileurlwithpath:audiopath]; exportsession.outputfiletype=avfiletypeapplem4a;  [exportsession exportasynchronouslywithcompletionhandler:^{     if (exportsession.status==avassetexportsessionstatusfailed) {         nslog(@"failed");         } else {     [_audiofilepaths setobject:audiopath forkey:audiofilename]     } 

and try play

avaudioplayer *player = [[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:[_audiofilepaths objectforkey:square]] error:&error];  nserror *error; player.numberofloops =0; if (player == nil){     nslog(@"%@", [error description]);     }  else {     [player play];     } 

but nothing plays. not ending video capture session i've verified m4a processed , recorded on device. i've tried loaded mp3s in project dont work.

thought relevant didn't (though put in didviewload call.) avaudioplayer turns off ipod - how work around?

lastly, class within spritekit project.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -