livekit / client-sdk-flutter

Flutter Client SDK for LiveKit

Home Page:https://docs.livekit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instead of screen sharing, video of the front camera is shown...

CoMatu opened this issue · comments

I have a Flutter web application. I open it in the mobile browser Chrome or Safari on an Android or IOS device.

I start a video call, try to show the screen of the mobile phone, instead there is a demonstration of video from the device's front camera. What could be the problem? What should I check?

try {
          await _livekitRoom.localParticipant?.setScreenShareEnabled(
            true,
            screenShareCaptureOptions: const ScreenShareCaptureOptions(
              params: VideoParametersPresets.screenShareH1080FPS30,
              maxFrameRate: MAX_FRAME_RATE,
            ),
          );
        } catch (_) {}

I think getDisplayMedia does not support for all mobile devices
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia
, so dart-webrtc tries to fall back to getUserMedia
https://github.com/flutter-webrtc/dart-webrtc/blob/main/lib/src/mediadevices_impl.dart#L53-L63

so, I think we should avoid Flutter Web to enable screen sharing on mobile devices, I'll try to make a PR later.

I am facing the same issue, and I want the browser screen sharing. Is there any possibility or any alternative for this.

Since mobile browsers do not support screen sharing, I think the only alternative on mobile is to use flutter native for iOS/Android.