English
Appearance
English
Appearance
Related reference: Scene API / Camera and Photo Capture
The current Web plugin provides photo capture capabilities. You can use the default photo button or fully customize the experience from the host page.
By default, Kivicube shows a photo button at the appropriate time:
web3d scenes it is usually visible relatively earlytrackedTo hide the default button:
await kivicubeIframePlugin.openKivicubeScene(iframe, {
sceneId,
hideTakePhoto: true,
});iframe.addEventListener('ready', async (event) => {
const { api } = event.detail;
const imageUrl = await api.takePhoto();
console.log(imageUrl);
});takePhoto() returns an image URL in the form data:image/png;base64,....
The current implementation:
So the result is usually a composite of "camera view + 3D content".
In some cases, the photo may also contain a watermark.
The photo content matches whatever the iframe currently contains.
The output resolution depends on the device resolution and DPR, so it is not fixed.
The simplest host-layer approach is to assign the returned value directly to an <img>:
const photo = await api.takePhoto();
previewImg.src = photo;
previewDialog.open = true;const photo = await api.takePhoto();
const link = document.createElement('a');
link.href = photo;
link.download = 'kivicube-photo.png';
link.click();A common flow is:
api.takePhoto() when the user clicks