Save image to Camera roll on iPhone

Hi,
I want to. take the photo and save it to camera roll on iPhone device. Anyone help me to do this function on PlayCanvas, please. Thank you.

Hi @hoanghiep259 and welcome,

A good starting point is this project, it will generate a screenshot from canvas:

https://playcanvas.com/editor/scene/476102

You can then try and downloading the image from the browser, I imagine on iOS that would put the image to the photo gallery:

2 Likes

You can also look to invoke the share feature in the browser https://dev.to/grafton-studio/native-tap-to-share-in-javascript-with-the-web-share-api-current-status-tips-and-limitations-4g4h

2 Likes

Thank you. I’ve already imported the download function. One more thing, how can I screenshot in AR mode?

Right for that you can use the same pipeline, with a small difference, you will need to paste to the canvas first the camera feed and then the contents of the transparent canvas (PlayCanvas).

I am not aware of an example project about that, I think you can find sample code on how to add multiple things on the download image canvas with an online search.

2 Likes