iphone - Use built-in mic if Headset is plugged in -
iphone - Use built-in mic if Headset is plugged in -
i playing around audiosessions in ios , want utilize built in mic of iphone sound input route if external headset (including mic) plugged in. i'm able observe if headset plugged in using next code:
cfstringref route; uint32 propertysize = sizeof(cfstringref); audiosessioninitialize(null, null, null, null); audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &route); if((route == null) || (cfstringgetlength(route) == 0)){ // silent mode nslog(@"audioroute: silent"); } else { nsstring* routestr = (nsstring*)route; nslog(@"audioroute: %@", routestr); nsrange headsetrange = [routestr rangeofstring : @"headset"]; if(headsetrange.location != nsnotfound) { nslog(@"headset") //route sound in built-in mic. } .... more code
so, ideas how this?
iphone objective-c ios
Comments
Post a Comment