Skip to content

Commit fac1e1e

Browse files
committed
change muteMode
1 parent f169c24 commit fac1e1e

2 files changed

Lines changed: 6 additions & 20 deletions

File tree

ios/RCTWebRTC/Utils/AudioDeviceModule/AudioDeviceModule.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ import WebRTC
228228
.eraseToAnyPublisher()
229229
super.init()
230230

231+
_ = source.setMuteMode(.inputMixer)
231232
audioLevelsAdapter.subject = audioLevelSubject
232233
source.observer = self
233234
}
@@ -246,6 +247,7 @@ import WebRTC
246247
/// Reinitializes the ADM, clearing its internal audio graph state.
247248
@objc public func reset() {
248249
_ = source.reset()
250+
_ = source.setMuteMode(.inputMixer)
249251
}
250252

251253
/// Switches between stereo and mono playout while keeping the recording
@@ -258,7 +260,7 @@ import WebRTC
258260
/// means that for outputs where VP is disabled (e.g. stereo) we cannot mute/unmute.
259261
/// - `.restartEngine`: rebuilds the whole graph and requires explicit calling of
260262
/// `initAndStartRecording` .
261-
_ = source.setMuteMode(isPreferred ? .inputMixer : .voiceProcessing)
263+
// _ = source.setMuteMode(isPreferred ? .inputMixer : .voiceProcessing)
262264
/// - Important: We can probably set this one to false when the user doesn't have
263265
/// sendAudio capability.
264266
_ = source.setRecordingAlwaysPreparedMode(false)
@@ -349,8 +351,10 @@ import WebRTC
349351
) {
350352
switch speechActivityEvent {
351353
case .started:
354+
NSLog("[Callingx | AudioDeviceModule] speechActivityStarted")
352355
subject.send(.speechActivityStarted)
353356
case .ended:
357+
NSLog("[Callingx | AudioDeviceModule] speechActivityEnded")
354358
subject.send(.speechActivityEnded)
355359
@unknown default:
356360
break

ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
#import "TrackCapturerEventsEmitter.h"
1919
#import "VideoCaptureController.h"
2020

21-
#if __has_include(<stream_react_native_webrtc/stream_react_native_webrtc-Swift.h>)
22-
#import <stream_react_native_webrtc/stream_react_native_webrtc-Swift.h>
23-
#elif __has_include("stream_react_native_webrtc-Swift.h")
24-
#import "stream_react_native_webrtc-Swift.h"
25-
#endif
26-
2721
@implementation WebRTCModule (RTCMediaStream)
2822

2923
- (VideoEffectProcessor *)videoEffectProcessor
@@ -500,14 +494,10 @@ - (void)removeLocalVideoTrackDimensionDetection:(RTCVideoTrack *)videoTrack {
500494

501495
RTCMediaStreamTrack *track = self.localTracks[trackID];
502496
if (track) {
503-
// Clean up dimension detection for local video tracks
504497
if ([track.kind isEqualToString:@"video"]) {
498+
// Clean up dimension detection for local video tracks
505499
[self removeLocalVideoTrackDimensionDetection:(RTCVideoTrack *)track];
506-
} else {
507-
// disable recording for local audio tracks
508-
[[self audioDeviceModule] setRecording:false error:nil];
509500
}
510-
511501
if (track.isEnabled) {
512502
track.isEnabled = NO;
513503
}
@@ -568,15 +558,7 @@ - (void)removeLocalVideoTrackDimensionDetection:(RTCVideoTrack *)videoTrack {
568558
return;
569559
}
570560

571-
if ([track.kind isEqual:@"audio"]) {
572-
RTCMediaStreamTrack *track = self.localTracks[trackID];
573-
if (track) {
574-
[[self audioDeviceModule] setRecording:enabled error:nil];
575-
}
576-
}
577-
578561
track.isEnabled = enabled;
579-
580562

581563
#if !TARGET_OS_TV
582564
if (track.captureController) { // It could be a remote track!

0 commit comments

Comments
 (0)