diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index 3799c4f92..7b0a081ed 100644 --- a/lib/src/core/room.dart +++ b/lib/src/core/room.dart @@ -202,7 +202,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable { var options = engine.fastConnectOptions!; var audio = options.microphone; - if (audio.enabled != null && audio.enabled == true) { + bool audioEnabled = audio.enabled == true || audio.track != null; + if (audioEnabled) { if (audio.track != null) { _localParticipant!.publishAudioTrack(audio.track as LocalAudioTrack, publishOptions: roomOptions.defaultAudioPublishOptions); @@ -213,7 +214,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable { } var video = options.camera; - if (video.enabled != null && video.enabled == true) { + bool videoEnabled = video.enabled == true || video.track != null; + if (videoEnabled) { if (video.track != null) { _localParticipant!.publishVideoTrack(video.track as LocalVideoTrack, publishOptions: roomOptions.defaultVideoPublishOptions); @@ -224,7 +226,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable { } var screen = options.screen; - if (screen.enabled != null && screen.enabled == true) { + bool screenEnabled = screen.enabled == true || screen.track != null; + if (screenEnabled) { if (screen.track != null) { _localParticipant!.publishVideoTrack( screen.track as LocalVideoTrack,