English
Appearance
English
Appearance
By default, once assets finish downloading, Kivicube shows a "Start Now" button and waits for the user to click before entering the scene.
It is not just a UI element. It also helps with browser media policy:
You can force-hide it with the hideStart property:
await kivicubeIframePlugin.openKivicubeScene(iframe, {
sceneId,
hideStart: true,
});Or directly in HTML:
<iframe id="kivicubeScene" scene-id="..." hide-start></iframe>Compared with directly using hideStart, it is usually better to:
If your feature depends on a button click to work reliably, a host-layer button coordinated with the default flow is safer than forcing auto-entry.
If you want to keep the native Kivicube Start Now Button and its default behavior, but align it with your host page UI, the advanced Scene / Collection APIs provide:
getStartButtonRect(): Promise<DOMRect | undefined>
setStartButtonRect(rect: Partial<CSSStyleDeclaration>): Promise<void>getStartButtonRect() returns the real getBoundingClientRect() result of the button inside the iframe.setStartButtonRect(rect) merges the given object into the button's inline style. Common fields include position, left, top, right, bottom, width, height, and transform.On a scene page, get SceneApi from the ready event:
let api = null;
iframe.addEventListener('ready', (event) => {
api = event.detail.api;
});On a collection page, get CollectionApi from ready:
let api = null;
iframe.addEventListener('ready', (event) => {
api = event.detail.api;
});hideStart: true is enabled, there is usually no button left to read or adjustdownloadAssetEnd, or once you are sure the button is visiblegetStartButtonRect() may return undefined and setStartButtonRect() may have no effectlet api = null;
iframe.addEventListener('ready', (event) => {
api = event.detail.api;
});
iframe.addEventListener('downloadAssetEnd', async () => {
const rect = await api.getStartButtonRect();
if (!rect) {
return;
}
Object.assign(hostStartButton.style, {
display: 'block',
position: 'fixed',
left: `${rect.left}px`,
top: `${rect.top}px`,
width: `${rect.width}px`,
height: `${rect.height}px`,
pointerEvents: 'none',
});
});This lets you place your own visual button on top of the same position while allowing the click to pass through to the real button inside the iframe, preserving the original user gesture.
await api.setStartButtonRect({
position: 'absolute',
left: '24px',
bottom: '32px',
width: 'calc(100% - 48px)',
height: '52px',
});It is recommended to pass CSS strings with units such as 24px, 52px, or calc(...). Values such as 0 can also be passed directly as numbers.
pointer-events: none so clicks still hit the real button inside the iframe.setStartButtonRect() and align it with host-layer titles, hints, and brand decoration.