iphone - Video capture using AVFoundation does not capture any audio -


i'm using following code capture movie file. unfortunately not capture audio. need route microphone session additional input? read somewhere each session can have 1 input? not sure how go this.

    // create session session = [[avcapturesession alloc] init]; session.sessionpreset =  avcapturesessionpresetmedium; input = [avcapturedeviceinput deviceinputwithdevice:[self backfacingcamera] error:nil]; audioinput = [avcapturedeviceinput deviceinputwithdevice:[self backfacingcamera] error:nil]; if(!input){     nslog(@"couldn't create input!"); } output= [[avcapturemoviefileoutput alloc] init] ; [session addinput:input]; [session addoutput:output]; [session startrunning]; 

you need add audioinput input session. also, current code shows audioinput pointing camera. needs point audio device. like:

nsarray *devices = [avcapturedevice deviceswithmediatype:avmediatypeaudio];  [[avcapturedeviceinput alloc] initwithdevice:[devices objectatindex:0] error:nil]; 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -