- open an Adventure or Directing session
- create a world and show build progress
- save and reattach a world
- stream the live world into a video element
- expose controls appropriate to the selected experience
Install the SDK
- npm
- pnpm
@reactor-models/happy-oyster and React bindings at
@reactor-models/happy-oyster/react.
Mint a client token
Keep the Reactor API key on your server. Exchange it for a short-lived JWT and return only the JWT to the browser:Mount the provider
The mode belongs on the provider, not oncreateWorld(). Use "adventure" for movement controls or
"directing" for text steering:
Create a world
createWorld() accepts parameters for the provider’s mode and resolves when the world reaches
ready.
createWorld() does not take a mode
field.
Reopen a saved world
Worlds persist beyond a session. Reopen one by its encrypted id:Start and stop a travel
Mount<HappyOysterVideo /> before starting. Once the current world is ready:
endTravelSession() ends the live travel but keeps the Reactor session and world ready.
disconnect() closes the session; the world remains available for a later attachWorld().
Show the remaining travel time
An Adventure travel runs for up to 2 minutes, and the platform ends the stream when that budget runs out. The hook reports the granted length asmaxExperienceTimeSec. Count down from it, with
ADVENTURE_MAX_EXPERIENCE_SEC covering the render before a travel is open:
maxExperienceTimeSec as null. Count its
clock down from that length and call endTravelSession() when it reaches zero.
Add Adventure controls
Adventure input is held state. Callmove, look, or interact when an input begins, then release
the corresponding axis when it ends:
Add Directing controls
Directing uses text instructions and playback controls:useHappyOysterTravelStatus() to track whether a Directing travel is running, paused, or
completed.
Handle errors
Awaited setup calls reject on failure. Gate and upstream failures useHappyOysterActionError:
Runtime stream errors are available through
useHappyOysterTravelError().
Next steps
- Read the schema reference for the complete typed surface.
- Use the prompt guide to author more stable worlds.
- Clone the HappyOyster example for a complete Next.js implementation.