Skip to content

Commit ea70312

Browse files
authored
fixing dispose in lobby view (#629)
1 parent f08f335 commit ea70312

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

dogfooding/lib/screens/lobby_screen.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,21 @@ class _LobbyScreenState extends State<LobbyScreen> {
2828
RtcLocalCameraTrack? _cameraTrack;
2929

3030
final _userAuthController = locator.get<UserAuthController>();
31-
bool _isJoiningCall = false;
3231

3332
void joinCallPressed() {
34-
_isJoiningCall = true;
35-
3633
var options = const CallConnectOptions();
3734

3835
final cameraTrack = _cameraTrack;
3936
if (cameraTrack != null) {
4037
options = options.copyWith(
41-
camera: TrackOption.provided(cameraTrack),
38+
camera: TrackOption.enabled(),
4239
);
4340
}
4441

4542
final microphoneTrack = _microphoneTrack;
4643
if (microphoneTrack != null) {
4744
options = options.copyWith(
48-
microphone: TrackOption.provided(microphoneTrack),
45+
microphone: TrackOption.enabled(),
4946
);
5047
}
5148

@@ -54,11 +51,8 @@ class _LobbyScreenState extends State<LobbyScreen> {
5451

5552
@override
5653
void dispose() {
57-
// Dispose tracks if we closed lobby screen without joining the call.
58-
if (!_isJoiningCall) {
59-
_cameraTrack?.stop();
60-
_microphoneTrack?.stop();
61-
}
54+
_cameraTrack?.stop();
55+
_microphoneTrack?.stop();
6256

6357
_cameraTrack = null;
6458
_microphoneTrack = null;

packages/stream_video_flutter/lib/src/call_screen/lobby_view.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
5656
RtcLocalCameraTrack? _cameraTrack;
5757
List<CallParticipant> _participants = <CallParticipant>[];
5858
Map<String, CallUser> _users = <String, CallUser>{};
59-
bool _isJoiningCall = false;
6059

6160
StreamSubscription<Object>? _fetchSubscription;
6261
StreamSubscription<Object>? _eventSubscription;
@@ -94,7 +93,6 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
9493
}
9594

9695
void onJoinCallPressed() {
97-
_isJoiningCall = true;
9896
var options = const CallConnectOptions();
9997

10098
if (hasCameraEnabled) {
@@ -121,11 +119,8 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
121119

122120
@override
123121
void dispose() {
124-
// Dispose tracks if we closed lobby screen without joining the call.
125-
if (!_isJoiningCall) {
126-
_cameraTrack?.stop();
127-
_microphoneTrack?.stop();
128-
}
122+
_cameraTrack?.stop();
123+
_microphoneTrack?.stop();
129124

130125
_cameraTrack = null;
131126
_microphoneTrack = null;

0 commit comments

Comments
 (0)