diff --git a/commet/lib/client/components/voip/voip_session.dart b/commet/lib/client/components/voip/voip_session.dart index 03d755b51..a541ca09b 100644 --- a/commet/lib/client/components/voip/voip_session.dart +++ b/commet/lib/client/components/voip/voip_session.dart @@ -16,6 +16,8 @@ enum VoipState { abstract class ScreenCaptureSource {} +class SdkManagedScreenCaptureSource implements ScreenCaptureSource {} + abstract class VoipSession { Client get client; diff --git a/commet/lib/client/matrix/components/voip_room/matrix_livekit_voip_session.dart b/commet/lib/client/matrix/components/voip_room/matrix_livekit_voip_session.dart index 07ea4a513..d6d4e57e0 100644 --- a/commet/lib/client/matrix/components/voip_room/matrix_livekit_voip_session.dart +++ b/commet/lib/client/matrix/components/voip_room/matrix_livekit_voip_session.dart @@ -253,11 +253,11 @@ class MatrixLivekitVoipSession implements VoipSession { return; } - final src = (source as WebrtcScreencaptureSource).source; - var track = await lk.LocalVideoTrack.createScreenShareTrack( lk.ScreenShareCaptureOptions( - sourceId: src.id, + sourceId: source is SdkManagedScreenCaptureSource + ? null // don't provide a source id and let the SDK handle pick + : (source as WebrtcScreencaptureSource).source.id, maxFrameRate: 30, params: lk.VideoParametersPresets.h1080_169, )); @@ -313,6 +313,9 @@ class MatrixLivekitVoipSession implements VoipSession { if (PlatformUtils.isAndroid) { return WebrtcAndroidScreencaptureSource.getCaptureSource(context); } + if (PlatformUtils.isWeb) { + return SdkManagedScreenCaptureSource(); + } return WebrtcScreencaptureSource.showSelectSourcePrompt(context); }