fix: Fixed track not being correctly passed to localParticipant in FastConnectOptions, causing the camera to apply twice and not be released. (#188)

This commit is contained in:
CloudWebRTC
2022-10-16 22:02:37 +08:00
committed by GitHub
parent a771744d19
commit 306ee473e9
+18 -9
View File
@@ -151,23 +151,32 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
var audio = options.microphone; var audio = options.microphone;
if (audio.enabled != null && audio.enabled == true) { if (audio.enabled != null && audio.enabled == true) {
_localParticipant!.setMicrophoneEnabled(true); if (audio.track != null) {
} else if (audio.track != null) { _localParticipant!
_localParticipant!.publishAudioTrack(audio.track as LocalAudioTrack); .publishAudioTrack(audio.track as LocalAudioTrack);
} else {
_localParticipant!.setMicrophoneEnabled(true);
}
} }
var video = options.camera; var video = options.camera;
if (video.enabled != null && video.enabled == true) { if (video.enabled != null && video.enabled == true) {
_localParticipant!.setCameraEnabled(true); if (video.track != null) {
} else if (video.track != null) { _localParticipant!
_localParticipant!.publishVideoTrack(video.track as LocalVideoTrack); .publishVideoTrack(video.track as LocalVideoTrack);
} else {
_localParticipant!.setCameraEnabled(true);
}
} }
var screen = options.screen; var screen = options.screen;
if (screen.enabled != null && screen.enabled == true) { if (screen.enabled != null && screen.enabled == true) {
_localParticipant!.setScreenShareEnabled(true); if (screen.track != null) {
} else if (screen.track != null) { _localParticipant!
_localParticipant!.publishVideoTrack(screen.track as LocalVideoTrack); .publishVideoTrack(screen.track as LocalVideoTrack);
} else {
_localParticipant!.setScreenShareEnabled(true);
}
} }
} }