You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/StreamVideo/WebRTC/v2/PeerConnection/MediaAdapters/LocalMediaAdapters/LocalVideoMediaAdapter.swift
+46-28Lines changed: 46 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -215,27 +215,44 @@ final class LocalVideoMediaAdapter: LocalMediaAdapting, @unchecked Sendable {
215
215
return
216
216
}
217
217
primaryTrack.isEnabled =true
218
-
219
-
do{
220
-
tryawaitstartVideoCapturingSession()
221
-
}catch{
222
-
log.error(error)
218
+
219
+
// Don't wait for camera to start - do it in parallel
220
+
Task{[weak self]in
221
+
do{
222
+
tryawaitself?.startVideoCapturingSession()
223
+
}catch{
224
+
log.error("Failed to start video capturing session: \(error)")
225
+
}
223
226
}
224
-
225
-
publishOptions
226
-
.forEach{
227
-
self.addTransceiverIfRequired(
228
-
for: $0,
229
-
with:self
230
-
.primaryTrack
231
-
.clone(from:self.peerConnectionFactory)
232
-
)
227
+
228
+
// Clone tracks and setup transceivers (don't block UI thread)
229
+
Task{@MainActor[weak self]in
230
+
guardlet self else{return}
231
+
232
+
// Clone tracks in parallel
233
+
awaitwithTaskGroup(of:(PublishOptions.VideoPublishOptions, RTCVideoTrack)?.self){ group in
0 commit comments