File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,17 @@ class Hardware {
8888 /// only supported on iOS for now
8989 bool get forceSpeakerOutput => _forceSpeakerOutput && _preferSpeakerOutput;
9090
91+ // This flag is used to determine if automatic native configuration
92+ // of audio is enabled. If set to false Natvive.configureAudio
93+ // will not be called, and the user is responsible for configuring
94+ // the native audio configuration manually.
95+ bool _isAutomaticConfigurationEnabled = true ;
96+ bool get isAutomaticConfigurationEnabled => _isAutomaticConfigurationEnabled;
97+
98+ void setAutomaticConfigurationEnabled ({required bool enable}) {
99+ _isAutomaticConfigurationEnabled = enable;
100+ }
101+
91102 Future <List <MediaDevice >> enumerateDevices ({String ? type}) async {
92103 var infos = await rtc.navigator.mediaDevices.enumerateDevices ();
93104 var devices = infos
@@ -157,7 +168,9 @@ class Hardware {
157168 }
158169 logger.fine ('configuring for ${audioTrackState } using ${config }...' );
159170 try {
160- await Native .configureAudio (config);
171+ if (_isAutomaticConfigurationEnabled) {
172+ await Native .configureAudio (config);
173+ }
161174 } catch (error) {
162175 logger.warning ('failed to configure ${error }' );
163176 }
Original file line number Diff line number Diff line change @@ -127,7 +127,10 @@ Future<void> _onAudioTrackCountDidChange() async {
127127 if (config != null ) {
128128 logger.fine ('configuring for ${_audioTrackState } using ${config }...' );
129129 try {
130- await Native .configureAudio (config);
130+ if (Hardware .instance.isAutomaticConfigurationEnabled) {
131+ logger.fine ('configuring native audio...' );
132+ await Native .configureAudio (config);
133+ }
131134 } catch (error) {
132135 logger.warning ('failed to configure ${error }' );
133136 }
You can’t perform that action at this time.
0 commit comments