feat(ios) add ability to inject a custom RTCAudioDevice implementation

It allows for full control over the audio handling.
This commit is contained in:
Saúl Ibarra Corretgé
2025-01-28 21:47:55 +01:00
committed by Saúl Ibarra Corretgé
parent e9a8fd5392
commit d6bbe07cf2
2 changed files with 19 additions and 9 deletions

View File

@@ -40,6 +40,13 @@
*/
@property (nonatomic, nullable) JitsiMeetConferenceOptions *defaultConferenceOptions;
/**
* Custom RTCAudioDevice implementation.
* https://github.com/jitsi/webrtc/blob/M124/sdk/objc/components/audio/RTCAudioDevice.h
* https://github.com/mstyura/RTCAudioDevice
*/
@property (nonatomic, strong, nullable) id rtcAudioDevice;
#pragma mark - This class is a singleton
+ (instancetype _Nonnull)sharedInstance;

View File

@@ -54,15 +54,6 @@
- (instancetype)init {
if (self = [super init]) {
#if 0
// Initialize WebRTC options.
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
options.loggingSeverity = RTCLoggingSeverityInfo;
#endif
// Initialize the one and only bridge for interfacing with React Native.
_bridgeWrapper = [[RCTBridgeWrapper alloc] init];
// Initialize the listener for handling start/stop screensharing notifications.
_screenshareEventEmiter = [[ScheenshareEventEmiter alloc] init];
@@ -142,6 +133,16 @@
return;
};
// Initialize WebRTC options.
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
if (_rtcAudioDevice != nil) {
options.audioDevice = _rtcAudioDevice;
}
#if 0
options.loggingSeverity = RTCLoggingSeverityInfo;
#endif
// Initialize the one and only bridge for interfacing with React Native.
_bridgeWrapper = [[RCTBridgeWrapper alloc] init];
}
@@ -249,6 +250,8 @@
}
- (RCTBridge *)getReactBridge {
// Initialize bridge lazily.
[self instantiateReactNativeBridge];
return _bridgeWrapper.bridge;
}