Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error: &setCategoryError];
- if (setCategoryError){
- NSLog(@"Error setting category! %@", [setCategoryError localizedDescription]);
- return NO;
- }
- NSError *error = NULL;
- NSMutableDictionary *options = [NSMutableDictionary dictionaryWithCapacity:5];
- [options setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey]; //format
- [options setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; //sample rate
- [options setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey]; //channels
- //encoder
- [options setValue:[NSNumber numberWithInt:AVAudioQualityHigh] forKey:AVEncoderAudioQualityKey]; //channels
- [options setValue:[NSNumber numberWithInt:16] forKey:AVEncoderBitDepthHintKey]; //channels
- self.audiorecorder = [[AVAudioRecorder alloc] initWithURL:mediaURL settings:options error:&error];
- self.audiorecorder.meteringEnabled = YES;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement