livekit / client-sdk-flutter

Flutter Client SDK for LiveKit
https://docs.livekit.io
Apache License 2.0
229 stars 109 forks source link

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

Closed CoMatu closed 3 months ago

CoMatu commented 4 months ago

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 (_) {}
cloudwebrtc commented 4 months ago

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.

Yuvraj3905 commented 4 months ago

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

cloudwebrtc commented 4 months ago

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