Screenshot or take a picture on AR

I added this script Capturing a screenshot | Learn PlayCanvas but when I put it in my script the button doesn’t appear

What type of AR project are you doing? WebXR? Artoolkit? 8th Wall?


I imagine that should work fine. Has the DOM object been added to the webpage document?

Can you post your project here please?

oh ya sorry here’s my project

The DOM button needs to be on a higher z-index then the WebGL canvas (which is currently on 1). On the CSS for the div class .container, add z-index to 2 and it will appear

it worked thanks. but screenshots only take entities?

Yes, that’s correct as the code is tied to what the PlayCanvas is rendering. The video is a separate DOM.

Not 100% how to go about this without either compositing the images together or rendering the camera feed into a texture or rendering the video on the screenshot canvas first.

This is a better version of the screen project that uses rendertargets and offscreen canvas to make the screenshot:

From here, you will be able extend this to perhaps render the video first on the canvas?

I thought it would work like taking a picture.

yeah maybe i will try to find it

I’m afraid there is no API exposed in the browser to do this :frowning: