fix SpeakerPhone switch for mobile. (#312)
* fix SpeakerPhone switch for mobile. * update.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:synchronized/synchronized.dart' as sync;
|
||||
|
||||
import '../hardware/hardware.dart';
|
||||
import '../logger.dart';
|
||||
import '../support/native.dart';
|
||||
import '../support/native_audio.dart';
|
||||
@@ -23,6 +24,9 @@ ConfigureNativeAudioFunc onConfigureNativeAudio =
|
||||
|
||||
final _trackCounterLock = sync.Lock();
|
||||
AudioTrackState _audioTrackState = AudioTrackState.none;
|
||||
|
||||
AudioTrackState get audioTrackState => _audioTrackState;
|
||||
|
||||
int _localTrackCount = 0;
|
||||
int _remoteTrackCount = 0;
|
||||
|
||||
@@ -141,7 +145,9 @@ Future<NativeAudioConfiguration> defaultNativeAudioConfigurationFunc(
|
||||
AppleAudioCategoryOption.allowBluetooth,
|
||||
AppleAudioCategoryOption.mixWithOthers,
|
||||
},
|
||||
appleAudioMode: AppleAudioMode.videoChat,
|
||||
appleAudioMode: Hardware.instance.preferSpeakerOutput
|
||||
? AppleAudioMode.videoChat
|
||||
: AppleAudioMode.voiceChat,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
|
||||
import '../support/platform.dart';
|
||||
import '../track/local/audio.dart';
|
||||
import '../track/local/video.dart';
|
||||
import '../types/video_parameters.dart';
|
||||
@@ -132,10 +131,10 @@ class ScreenShareCaptureOptions extends VideoCaptureOptions {
|
||||
@override
|
||||
Map<String, dynamic> toMediaConstraintsMap() {
|
||||
var constraints = super.toMediaConstraintsMap();
|
||||
if (useiOSBroadcastExtension && WebRTC.platformIsIOS) {
|
||||
if (useiOSBroadcastExtension && lkPlatformIs(PlatformType.iOS)) {
|
||||
constraints['deviceId'] = 'broadcast';
|
||||
}
|
||||
if (WebRTC.platformIsDesktop) {
|
||||
if (lkPlatformIsDesktop()) {
|
||||
if (deviceId != null) {
|
||||
constraints['deviceId'] = {'exact': deviceId};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user