Код: Выделить всё
#import "AudioSessionManager.h"
#import
@implementation AudioSessionManager
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(configureAudioSession:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
@try {
AVAudioSession *session = [AVAudioSession sharedInstance];
// Set category
[session setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionAllowBluetooth |
AVAudioSessionCategoryOptionDefaultToSpeaker
error:nil];
// Set mode
[session setMode:AVAudioSessionModeVoiceChat error:nil];
// Activate session
[session setActive:YES error:nil];
resolve(@(YES));
}
@catch (NSException *exception) {
reject(@"session_config_error", @"Failed to configure AVAudioSession", nil);
}
}
@end
Подробнее здесь: https://stackoverflow.com/questions/797 ... native-ios