Skip to content
11 changes: 9 additions & 2 deletions dogfooding/lib/app/app_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class _StreamDogFoodingAppContentState
late final _router = initRouter(_userAuthController);

final _compositeSubscription = CompositeSubscription();
bool? _microphoneEnabledBeforeInterruption;

@override
void initState() {
Expand Down Expand Up @@ -126,10 +127,16 @@ class _StreamDogFoodingAppContentState

RtcMediaDeviceNotifier.instance.handleCallInterruptionCallbacks(
onInterruptionStart: () {
StreamVideo.instance.activeCall?.setMicrophoneEnabled(enabled: false);
final call = StreamVideo.instance.activeCall;
call?.setMicrophoneEnabled(enabled: false);
_microphoneEnabledBeforeInterruption =
call?.state.value.localParticipant?.isAudioEnabled;
},
onInterruptionEnd: () {
StreamVideo.instance.activeCall?.setMicrophoneEnabled(enabled: true);
if (_microphoneEnabledBeforeInterruption == true) {
StreamVideo.instance.activeCall?.setMicrophoneEnabled(enabled: true);
}
_microphoneEnabledBeforeInterruption = null;
},
);
}
Expand Down
Loading