Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ios/RCTWebRTC/WebRTCModule+RTCAudioSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
#import <React/RCTBridgeModule.h>

#import "WebRTCModule.h"
#import "WebRTCAudioSession.h"

@implementation WebRTCModule (RTCAudioSession)
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(unlockPeerClosing) {
WebRTCAudioSession* session = [WebRTCAudioSession shared];
[session setAudioSessionEnabled:NO];
return nil;
}

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(lockPeerClosing) {
WebRTCAudioSession* session = [WebRTCAudioSession shared];
[session setAudioSessionEnabled:YES];
return nil;
}

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(audioSessionDidActivate) {
[[RTCAudioSession sharedInstance] audioSessionDidActivate:[AVAudioSession sharedInstance]];
Expand Down
4 changes: 0 additions & 4 deletions ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,7 @@ - (void)checkAudioLevel {
return;
}

WebRTCAudioSession* session = [WebRTCAudioSession shared];

[session closeConnection:^{
[peerConnection close];
}];
}

RCT_EXPORT_METHOD(peerConnectionDispose : (nonnull NSNumber *)objectID) {
Expand Down
20 changes: 20 additions & 0 deletions src/RTCAudioSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ import { NativeModules, Platform } from 'react-native';
const { WebRTCModule } = NativeModules;

export default class RTCAudioSession {
/**
* To be called when close peer connection to fix issue with no mic sound in group call when
*/
static unlockPeerClosing() {
Comment thread
iosDeveloperDenis marked this conversation as resolved.
// Only valid for iOS
if (Platform.OS === 'ios') {
WebRTCModule.unlockPeerClosing();
}
}

/**
* To be called when peer connection closed to fix issue with no mic sound in group call when
*/
static lockPeerClosing() {
// Only valid for iOS
if (Platform.OS === 'ios') {
WebRTCModule.lockPeerClosing();
}
}

/**
* To be called when CallKit activates the audio session.
*/
Expand Down
Loading