How to take a screenshot by websdk?
The following is my script for take screenshot of AR screen, but it is not working, there is an Uncaught ReferenceError:deepAR is not defined
Would you provide a simple coding for reference, thank you.
Error:
How to take a screenshot by websdk?
The following is my script for take screenshot of AR screen, but it is not working, there is an Uncaught ReferenceError:deepAR is not defined
Would you provide a simple coding for reference, thank you.
Error:
You need to make sure you are accessing the deepAR
variable in the scope where it was declared. You are getting the ReferenceError
because the variable does not exist in the scope.
takeScreenshot
is an async function which returns the image in data:image/png
format. You can see one usage of it here.
Thank you very much, the problem is solved.
do you have example for recording video by websdk?
I don’t have an example but I can write a short snipper which should help you get the idea of how to do it.
document.getElementById('record-button').onclick = async function() {
if (!isRecording) {
// Start the recording
isRecording = true;
await deepAR.startVideoRecording();
} else {
// Stop recording
isRecording = false;
const video = await deepAR.finishVideoRecording();
// Download video
const a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = window.URL.createObjectURL(video);
a.download = "video.mp4";
a.click()
window.URL.revokeObjectURL(a.href);