File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import '../support/disposable.dart';
41
41
import '../support/platform.dart' ;
42
42
import '../support/region_url_provider.dart' ;
43
43
import '../support/websocket.dart' show WebSocketException;
44
+ import '../track/audio_management.dart' ;
44
45
import '../track/local/audio.dart' ;
45
46
import '../track/local/video.dart' ;
46
47
import '../track/track.dart' ;
@@ -244,6 +245,10 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
244
245
logger.warning ('could not fetch region settings $e ' );
245
246
}));
246
247
}
248
+
249
+ // configure audio for native platform
250
+ await NativeAudioManagement .start ();
251
+
247
252
try {
248
253
await engine.connect (
249
254
_regionUrl ?? url,
@@ -936,6 +941,8 @@ extension RoomPrivateMethods on Room {
936
941
// clean up engine
937
942
await engine.cleanUp ();
938
943
944
+ await NativeAudioManagement .stop ();
945
+
939
946
// reset params
940
947
_name = null ;
941
948
_metadata = null ;
Original file line number Diff line number Diff line change 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
+ import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
15
16
import 'package:synchronized/synchronized.dart' as sync;
16
17
17
18
import '../hardware/hardware.dart' ;
@@ -159,3 +160,24 @@ Future<NativeAudioConfiguration> defaultNativeAudioConfigurationFunc(
159
160
? NativeAudioConfiguration .playAndRecordSpeaker
160
161
: NativeAudioConfiguration .playAndRecordReceiver;
161
162
}
163
+
164
+ class NativeAudioManagement {
165
+ static Future <void > start () async {
166
+ // Audio configuration for Android.
167
+ if (lkPlatformIs (PlatformType .android)) {
168
+ if (Native .bypassVoiceProcessing) {
169
+ await rtc.Helper .setAndroidAudioConfiguration (
170
+ rtc.AndroidAudioConfiguration .media);
171
+ } else {
172
+ await rtc.Helper .setAndroidAudioConfiguration (
173
+ rtc.AndroidAudioConfiguration .communication);
174
+ }
175
+ }
176
+ }
177
+
178
+ static Future <void > stop () async {
179
+ if (lkPlatformIs (PlatformType .android)) {
180
+ await rtc.Helper .clearAndroidCommunicationDevice ();
181
+ }
182
+ }
183
+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ dependencies:
37
37
uuid : ^4.5.1
38
38
synchronized : ^3.0.0+3
39
39
protobuf : ^3.0.0
40
- flutter_webrtc : ^0.13.1
40
+ flutter_webrtc : ^0.13.1+hotfix.1
41
41
device_info_plus : ^11.3.0
42
42
dart_webrtc : ^1.5.3
43
43
sdp_transform : ^0.3.2
You can’t perform that action at this time.
0 commit comments