## Safari and caching

Prepare the browser runtime before enabling Start. Preparation downloads and initializes static runtime code without creating a session.



```
import { prepareMirrorRuntime } from 'https://api.ikawn.com/sdk/mirror.js';
await prepareMirrorRuntime();
// Enable your Start control after this resolves.
```



The moving SDK entry is revalidated. Versioned SDK and runtime assets use long-lived immutable caching. Let the browser reuse them; do not add random query strings or clear the cache between try-ons.

### Browser implementation checklist

- Use HTTPS, a video track and an explicit camera permission flow. Set autoplay, playsinline and muted before assigning the output stream.

- Handle a rejected video.play() call with a visible Play control. Stop both the API session and local camera tracks when done.

- Cache public static assets only. Never cache session JSON, tokens, balances, prompts or user images in a service worker or browser storage.

- Use onStage and onStats to separate setup from transport observations. Measure advancing decoded frames for perceived startup; a connected transport alone is insufficient.

- Validate camera permission, playback, tab suspension and network switching on your target Safari/iPhone versions. The current release does not establish universal Safari or mobile compatibility.
