Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking Screenshot of only background on web #146

Open
rohanjariwala03 opened this issue May 26, 2023 · 1 comment
Open

Taking Screenshot of only background on web #146

rohanjariwala03 opened this issue May 26, 2023 · 1 comment

Comments

@rohanjariwala03
Copy link

rohanjariwala03 commented May 26, 2023

  • Using flutter_webrtc package.
  • For capturing image I'm wrapping flutter_webrtc with Screenshot package.
  • It's working good on macOS, iOS, windows. But not working on Web.

Issue

  • On web screenshot package is taking screenshot of background only and not of the flutter_webrtc view.

Tried
flutter run -d web-server --web-port 3344 --release --web-renderer canvaskit --dart-define=BROWSER_IMAGE_DECODING_ENABLED=false

Code

ScreenshotController screenshotController = ScreenshotController();

Widget screenshotWidget() {
   return Screenshot(
                    controller: screenshotController,
                    child: RTCVideoView(
                      ref.read(widget.rtc),
                      objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitContain,
                      mirror: true,
                      filterQuality: FilterQuality.high,
                    ),
                  );
}

Future<void> captureImage() async {
   Uint8List? tempImage = await screenshotController.capture().onError((error, stackTrace) {
                                    debugPrint('error $error');
                                    return null;
                                  });
}

NOTE: Working on MacOs, Windows, iOS and Android

@vborbely
Copy link

vborbely commented Apr 9, 2024

I found that on Web, you have to call Uint8List? tempImage = await screenshotController.capture() with a Duration = 0:

Uint8List? tempImage = await screenshotController.capture( delay: const Duration(milliseconds: 0) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants