title: Check if MIC is locked or used by other iOS application
body: <p>I want to detect whether MIC is currently locked or used by any other iOS application. I didn't get any information to check if MIC is available for use or not ? I don't want to allow user to record video if MIC is already used by some other application , active call , facetime call.</p>
  
  <p>Can anybody tell me the way to solve this issue ?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Update: Adding function to check if MIC is busy</strong></p>
  
  <pre><code>+(BOOL)isMicResourceBusy
  {
      NSError *error = nil;
  
      NSMutableDictionary *recordSettings = [[NSMutableDictionary alloc] initWithCapacity:10];
      NSNumber *formatObject;
      formatObject = [NSNumber numberWithInt: kAudioFormatMPEG4AAC ];
  
      [recordSettings setObject:formatObject forKey: AVFormatIDKey];
      [recordSettings setObject:[NSNumber numberWithFloat:44100.0] forKey: AVSampleRateKey];
      [recordSettings setObject:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
      [recordSettings setObject:[NSNumber numberWithInt:12800] forKey:AVEncoderBitRateKey];
      [recordSettings setObject:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
      [recordSettings setObject:[NSNumber numberWithInt: AVAudioQualityHigh] forKey: AVEncoderAudioQualityKey];
  
      NSURL *soundFileURL = [NSURL fileURLWithPath:[FileUtils getNewFilenameWithPrefix:@"testAudioRecording" ext:@"aac"]];
  
      AVAudioRecorder *audioRecorder = [[AVAudioRecorder alloc]initWithURL:soundFileURL settings:recordSettings error:&amp;error];
  
      if ([audioRecorder prepareToRecord] &amp;&amp; error == nil)
      {
          return NO;
      }
      else
      {
          NSLog(@"Error: %@", error.localizedDescription);
      }
      return YES;
  }
  </code></pre>