Skip to content

Latest commit

History

History
60 lines (43 loc) 路 1.7 KB

File metadata and controls

60 lines (43 loc) 路 1.7 KB
title nav
Capture Snapshot
10.1

You can capture a snapshot of the video stream of a local or remote peer's video.

Minimum Requirements

SDK version 1.3.0

How to capture the snapshot

You can capture a snapshot of the video stream of a local or remote peer's video. To capture a snapshot, you call captureSnapshot() method on HMSVideoTrack instance to get a Uint8List containing a snapshot of the video stream.

  HMSVideoTrack videoTrack;
  ...

  //Capture snapshot will return a nullable Uint8List type.
  Uint8List? bytes = await videoTrack.captureSnapshot();

Display image

To display an image use Image.memory widget which will take Uint8List as a parameter and return an Image widget.

  //Show Image in Image Widget
  if (bytes != null) {
    Image imageWidget = Image.memory(bytes);
    //Show image widget in widget tree.
  }

Save Image

To save an image in gallery use a 3rd Party plugin image_gallery_saver which will take Uint8List as one of the parameter and save a image in gallery directly.

  //Save Image in Gallery
  if (bytes != null) {
    Map result = await ImageGallerySaver.saveImage(bytes, quality: 100, name: "imageName");
    //Use 3rd Party Plugin image_gallery_saver to save image in gallery.
  }

To know more about image_gallery_saver plugin click here.

Example Video

Checkout the example video implemented in our sample app: