@@ -69,6 +69,7 @@ public class FlutterWebRTCPlugin implements MethodCallHandler {
6969 private GetUserMediaImpl getUserMediaImpl ;
7070 final PeerConnectionFactory mFactory ;
7171
72+ private AudioDeviceModule audioDeviceModule ;
7273
7374 public Activity getActivity () {
7475 return registrar .activity ();
@@ -108,7 +109,7 @@ private FlutterWebRTCPlugin(Registrar registrar, MethodChannel channel) {
108109
109110 getUserMediaImpl = new GetUserMediaImpl (this , registrar .context ());
110111
111- AudioDeviceModule audioDeviceModule = JavaAudioDeviceModule .builder (registrar .context ())
112+ audioDeviceModule = JavaAudioDeviceModule .builder (registrar .context ())
112113 .setUseHardwareAcousticEchoCanceler (true )
113114 .setUseHardwareNoiseSuppressor (true )
114115 .setSamplesReadyCallback (getUserMediaImpl .inputSamplesInterceptor )
@@ -302,6 +303,11 @@ public void onMethodCall(MethodCall call, Result notSafeResult) {
302303 double volume = call .argument ("volume" );
303304 mediaStreamTrackSetVolume (trackId , volume );
304305 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 );
305311 } else if (call .method .equals ("getDisplayMedia" )) {
306312 Map <String , Object > constraints = call .argument ("constraints" );
307313 ConstraintsMap constraintsMap = new ConstraintsMap (constraints );
@@ -888,6 +894,14 @@ public void mediaStreamTrackSetVolume(final String id, final double volume) {
888894 }
889895 }
890896
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+
891905 public void mediaStreamTrackRelease (final String streamId , final String _trackId ) {
892906 MediaStream stream = localStreams .get (streamId );
893907 if (stream == null ) {
0 commit comments