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
Post a Comment