4

I want to take a ScreenShot of video playing inside a video player. But i am not able to adjust my VideoPlayer Inside RepaintBoundary.

RepaintBoundary(
    key: screen,
    child:  Stack(
      children: <Widget>[
        Container(
          child: videoPlayerController.value.initialized ? AspectRatio(
            aspectRatio: videoPlayerController.value.aspectRatio,
            child: VideoPlayer(videoPlayerController),
          ) : Container(color: Colors.red,),
        ),

      ],
    ),
  ),    
sahil shah
  • 41
  • 2

1 Answers1

1

RenderPaintBoundary won't do what your trying to do because that's not how Flutter works.

You'll need to get the frame your looking for separately.

You can make your own implementation as per your use-case, but for now, to keep things simple, use the below plugin.

https://pub.dev/packages/video_thumbnail#-readme-tab-

and whenever you need the current frame of the video make sure that the below snippet gets executed.

Uint8List bytes = await VideoThumbnail.thumbnailData(
  video: path, // Path of that video
  imageFormat: ImageFormat.PNG,
  quality: 100,
  timeMs: videoController.value.position.inMilliseconds,
);

Image image = Image.memory(bytes); // Here's your frame