|
|
|
|
@ -88,6 +88,7 @@ class CallProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
onSuccess = null;
|
|
|
|
|
isMuted = false;
|
|
|
|
|
isPeerMuted = false;
|
|
|
|
|
isSpeakerOn = false;
|
|
|
|
|
// `CallProvider` is a long-lived singleton (registered once in main.dart),
|
|
|
|
|
// so without resetting these here, toggling the camera off near the end
|
|
|
|
|
// of one video call would leak into the *next* call, making it look like
|
|
|
|
|
@ -176,6 +177,9 @@ class CallProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
case RTCIceConnectionState.RTCIceConnectionStateConnected:
|
|
|
|
|
case RTCIceConnectionState.RTCIceConnectionStateCompleted:
|
|
|
|
|
if (currentStatus != "Connected") {
|
|
|
|
|
// The OS resets the audio route to the earpiece once media
|
|
|
|
|
// actually starts flowing, so re-apply it on connect.
|
|
|
|
|
_applyDefaultAudioRoute();
|
|
|
|
|
_setStatus("Connected");
|
|
|
|
|
_startCallDurationTimer();
|
|
|
|
|
}
|
|
|
|
|
@ -201,11 +205,23 @@ class CallProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
// on this singleton CallProvider (see endSession()).
|
|
|
|
|
isCameraOn = true;
|
|
|
|
|
isPeerCameraOn = true;
|
|
|
|
|
isSpeakerOn = true;
|
|
|
|
|
await _webRTCService.initializeForVideoCall();
|
|
|
|
|
_webRTCService.setCameraEnabled(true);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
isSpeakerOn = false;
|
|
|
|
|
await _webRTCService.initializeForAudioCall();
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _applyDefaultAudioRoute() {
|
|
|
|
|
if (isVideo == true) {
|
|
|
|
|
isSpeakerOn = true;
|
|
|
|
|
_webRTCService.setSpeakerphoneEnabled(true);
|
|
|
|
|
} else {
|
|
|
|
|
_webRTCService.setSpeakerphoneEnabled(isSpeakerOn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|