Interface: ToolkitApi

Reusable local helpers built on Plot's public APIs.

See

Error handling

Methods

syncedAudio()

syncedAudio(options): SyncedAudio

Creates a synchronized audio object without fetching, playing, or starting readiness.

Parameters

options

SyncedAudioOptions

Immutable URLs/mode and initial local volume/mute.

Returns

SyncedAudio

A reusable local audio object. Call dispose() when finished with it.

Throws

TypeError synchronously for invalid options or URLs.

Example

const music = Plot.toolkit.syncedAudio({ mode: 'loop', src: '/audio/loop.wav' })
await Plot.ready()
await music.play(sharedStartAtGameTimeMs)

unlockAudio()

unlockAudio(): Promise<void>

Enables/resumes shared local audio. The SDK also attempts this automatically on player interaction inside the game, starting from SDK startup. Use this explicit fallback directly in a game button handler when sound remains blocked. Works before Plot.ready(). Never starts readiness or starts stopped/explicitly paused objects. Retry rejected play/resume calls with their original shared arguments; enabling audio alone does not retry a rejected playback request.

Returns

Promise<void>

Resolves once audio can run; rejects with PlotError if blocked/unavailable.