logo
On this page

How to implement screenshot functionality for preview and play stream video on Web platform?

2022-11-16
Products / Plugins:Video Call / Live streaming
Platform / Framework:Web

On the Web platform, when using the "video" tag to render preview and play stream video, developers can implement screenshot functionality through the following methods:

  1. After successful preview/play stream, first use the "drawImage" method of the canvas object to draw the data of the corresponding video object to the canvas;
  2. After drawing is complete, use the canvas's "toDataURL" method to convert the image to a base64 encoded url;
  3. Through the above url, developers can obtain the corresponding screenshot.

Previous

After loading a dynamic PPT file, clicking on the dynamic PPT cannot turn the page. How to handle this?

Next

On the Web platform, after creating a stream through the "createStream" method and assigning a value to the "srcObject" of the video object, why is there no video in the video object?