@mascotbot/react; Rive hooks from
@mascotbot/react/rive.
Audio pipeline — @mascotbot/react
useMascot()
<MascotProvider>.
| Field | Type | Notes |
|---|---|---|
client | LipsyncClient | null | null until init resolves |
status | LipsyncStatus | idle | initializing | ready | running | degraded | refused | error |
error | Error | null | A typed error on refused / error |
reload | () => void | Re-runs init (e.g. after the user fixes a key) |
status === "ready".
useProcessAudio(audioUrl)
null to skip. result is a ProcessAudioResult:
result.timeline to useMascotPlayback().setTimeline(), or
JSON.stringify it to persist and replay later with zero reprocessing —
Offline lip sync.
Rive layer — @mascotbot/react/rive
useMascotRive()
<Mascot>. rive is the
raw, unmodified @rive-app/* instance — yours for data binding, custom
inputs, events, and ViewModels. The SDK never wraps it. setImageAsset swaps
a runtime image asset (e.g. a custom face texture).
useMascotInputs<T>()
| Field | Notes |
|---|---|
riveInputs | SDK-driven input handles (mouth / is_speaking / stress) |
custom | Your declared inputs, typed by T. Never undefined |
has(name) | Authoritative presence check — use this, never raw rive.stateMachineInputs() |
useMascotPlayback(options?)
MascotPlayback. stress([{ offset, stress }])
schedules emphasis cues — the SDK animates the Rive stress input from them
on the playback clock (see Stress emphasis).
Options:
| Option | Type | Purpose |
|---|---|---|
stream | boolean | Streaming mode (mic / realtime); pair with useLipsyncStream |
enableNaturalLipSync | boolean | Smoother, less robotic merging |
naturalLipSyncConfig | Partial<NaturalLipSyncConfig> | Tune merging — Natural lip sync |
desktopTransitionSpeed / mobileTransitionSpeed | number | Mouth blend rate |
setSpeakingState | boolean | Auto-drive is_speaking (default on) |
manualSpeakingStateControl | boolean | Take manual control of is_speaking |
useLipsyncStream(args)
MediaStream (realtime providers, played audio), or manual chunk pushing.
Full guide: Streaming & microphone.
Low-level Rive loaders
| Hook | Returns | Use when |
|---|---|---|
useLoadRive(options?) | { rive, isRiveLoaded, RiveComponent, setImageAsset } | You need to load Rive yourself; pass an options object ({ stateMachineName, ... }). <Mascot> uses this internally. |
useRiveAsset(riveParams?, opts?) | RiveState & { setImageAsset } | Lowest-level escape hatch: useRive + a runtime image-asset swapper. |
useSafeStateMachineInput(rive, _, name, init?) | input or DEFAULT_SM_INPUT | Single-input lookup with the mascotStateMachine / InLesson fallback shim. |
useIsMobileDevice() | boolean | Touch + UA + screen-size heuristic (e.g. to pick a transition speed). |
Next
Streaming & mic
useLipsyncStream in depth.Offline lip sync
useProcessAudio → persist → replay.Rive co-existence
Driving non-mouth inputs.