Skip to content

Commit f08f335

Browse files
authored
Migrate LobbyView to TrackOptions.enabled (#626)
* Lower the min Android target on example app * Migrate LobbyView TrackOptions to enabled
1 parent d09c2be commit f08f335

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/stream_video_flutter/example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ android {
4747
applicationId "com.example.stream_video_flutter_example"
4848
// You can update the following values to match your application needs.
4949
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50-
minSdkVersion Math.max(flutter.minSdkVersion, 33)
50+
minSdkVersion Math.max(flutter.minSdkVersion, 32)
5151
targetSdkVersion flutter.targetSdkVersion
5252
versionCode flutterVersionCode.toInteger()
5353
versionName flutterVersionName

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
6161
StreamSubscription<Object>? _fetchSubscription;
6262
StreamSubscription<Object>? _eventSubscription;
6363

64+
bool get hasCameraEnabled => _cameraTrack != null;
65+
66+
bool get hasMicrophoneEnabled => _microphoneTrack != null;
67+
6468
Future<void> toggleCamera() async {
65-
if (_cameraTrack != null) {
69+
if (hasCameraEnabled) {
6670
await _cameraTrack?.stop();
6771
return setState(() => _cameraTrack = null);
6872
}
@@ -76,7 +80,7 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
7680
}
7781

7882
Future<void> toggleMicrophone() async {
79-
if (_microphoneTrack != null) {
83+
if (hasMicrophoneEnabled) {
8084
await _microphoneTrack?.stop();
8185
return setState(() => _microphoneTrack = null);
8286
}
@@ -91,20 +95,17 @@ class _StreamLobbyViewState extends State<StreamLobbyView> {
9195

9296
void onJoinCallPressed() {
9397
_isJoiningCall = true;
94-
9598
var options = const CallConnectOptions();
9699

97-
final cameraTrack = _cameraTrack;
98-
if (cameraTrack != null) {
100+
if (hasCameraEnabled) {
99101
options = options.copyWith(
100-
camera: TrackOption.provided(cameraTrack),
102+
camera: TrackOption.enabled(),
101103
);
102104
}
103105

104-
final microphoneTrack = _microphoneTrack;
105-
if (microphoneTrack != null) {
106+
if (hasMicrophoneEnabled) {
106107
options = options.copyWith(
107-
microphone: TrackOption.provided(microphoneTrack),
108+
microphone: TrackOption.enabled(),
108109
);
109110
}
110111

0 commit comments

Comments
 (0)