diff --git a/commet/lib/client/components/voip/voip_session.dart b/commet/lib/client/components/voip/voip_session.dart index 03d755b51..b0b76b886 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 WebrtcBrowserScreenCaptureSource 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 ebb5875c8..9d9eba589 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,7 +253,9 @@ class MatrixLivekitVoipSession implements VoipSession { return; } - final src = (source as WebrtcScreencaptureSource).source; + final srcid = source is WebrtcBrowserScreenCaptureSource + ? '' + : (source as WebrtcScreencaptureSource).source.id; var bitrate = (preferences.streamBitrate.value * 1_000_000).toInt(); var framerate = preferences.streamFramerate.value; @@ -273,7 +275,7 @@ class MatrixLivekitVoipSession implements VoipSession { var track = await lk.LocalVideoTrack.createScreenShareTrack( lk.ScreenShareCaptureOptions( - sourceId: src.id, + sourceId: srcid, maxFrameRate: framerate, params: lk.VideoParameters( dimensions: lk.VideoDimensionsPresets.h720_169, @@ -348,6 +350,9 @@ class MatrixLivekitVoipSession implements VoipSession { if (PlatformUtils.isAndroid) { return WebrtcAndroidScreencaptureSource.getCaptureSource(context); } + if (PlatformUtils.isWeb) { + return WebrtcBrowserScreenCaptureSource(); + } return WebrtcScreencaptureSource.showSelectSourcePrompt(context); }