From 3ef53d476ef07edf9042d79d5324cbefc827c3e8 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Tue, 12 Dec 2023 13:16:46 +0800 Subject: [PATCH] fix bug for fast connect. (#425) --- lib/src/core/room.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index 3799c4f9..7b0a081e 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,