/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
-(void) mic{ [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: nil]; nil]; NSError *error; recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; if (recorder) { [recorder prepareToRecord]; recorder.meteringEnabled = YES; [recorder record]; levelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES]; } } [recorder updateMeters]; isTimerValid=YES; if([recorder averagePowerForChannel:0]>-25){ //record in progress } }