@@ -69,6 +69,7 @@ public class FlutterWebRTCPlugin implements MethodCallHandler {
69
69
private GetUserMediaImpl getUserMediaImpl ;
70
70
final PeerConnectionFactory mFactory ;
71
71
72
+ private AudioDeviceModule audioDeviceModule ;
72
73
73
74
public Activity getActivity () {
74
75
return registrar .activity ();
@@ -108,7 +109,7 @@ private FlutterWebRTCPlugin(Registrar registrar, MethodChannel channel) {
108
109
109
110
getUserMediaImpl = new GetUserMediaImpl (this , registrar .context ());
110
111
111
- AudioDeviceModule audioDeviceModule = JavaAudioDeviceModule .builder (registrar .context ())
112
+ audioDeviceModule = JavaAudioDeviceModule .builder (registrar .context ())
112
113
.setUseHardwareAcousticEchoCanceler (true )
113
114
.setUseHardwareNoiseSuppressor (true )
114
115
.setSamplesReadyCallback (getUserMediaImpl .inputSamplesInterceptor )
@@ -302,6 +303,11 @@ public void onMethodCall(MethodCall call, Result notSafeResult) {
302
303
double volume = call .argument ("volume" );
303
304
mediaStreamTrackSetVolume (trackId , volume );
304
305
result .success (null );
306
+ } else if (call .method .equals ("setMicrophoneMute" )) {
307
+ String trackId = call .argument ("trackId" );
308
+ boolean mute = call .argument ("mute" );
309
+ mediaStreamTrackSetMicrophoneMute (trackId , mute );
310
+ result .success (null );
305
311
} else if (call .method .equals ("getDisplayMedia" )) {
306
312
Map <String , Object > constraints = call .argument ("constraints" );
307
313
ConstraintsMap constraintsMap = new ConstraintsMap (constraints );
@@ -888,6 +894,14 @@ public void mediaStreamTrackSetVolume(final String id, final double volume) {
888
894
}
889
895
}
890
896
897
+ public void mediaStreamTrackSetMicrophoneMute (final String id , boolean mute ) {
898
+ try {
899
+ audioDeviceModule .setMicrophoneMute (mute );
900
+ } catch (Exception e ) {
901
+ Log .e (TAG , "setMicrophoneMute(): error" , e );
902
+ }
903
+ }
904
+
891
905
public void mediaStreamTrackRelease (final String streamId , final String _trackId ) {
892
906
MediaStream stream = localStreams .get (streamId );
893
907
if (stream == null ) {
0 commit comments