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:
- 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;
- After drawing is complete, use the canvas's "toDataURL" method to convert the image to a base64 encoded url;
- Through the above url, developers can obtain the corresponding screenshot.
