Learn how to install and use the Mascotbot SDK with React Native.
MascotProvider
MascotProvider
component.
useMascot
useMascot
hook provides access to the Rive instance and Rive component.
useMascotPlayback
useMascotPlayback
hook allows you to control the playback of animations and manage visemes.
playback.add
method to add visemes. This can be done in various ways, such as fetching from a server, generating in real-time, or any other method suitable for your application.
is_speaking
state is automatically set to true
while it’s speaking and set to false
when it stops. You can control this behavior by passing options to the useMascotPlayback
hook:
setSpeakingState
option allows you to disable the automatic management of the is_speaking
state, giving you manual control over when and how the speaking state is set.
<MascotProvider>
<MascotClient>
RiveComponent
: Required. The Rive component implementation to usechildren
: React nodes<MascotRive>
onPress
: Function called when the mascot is clickeduseMascot()
useMascotSpeech(options)
apiKey
: Required. Your API key for the Mascot servicebufferSize
: Optional. Buffer size for speech (default: 2)enableTimingEvents
: Optional. Enable timing logs (default: true)apiEndpoint
: Optional. Custom API endpointspeak(text, voice?)
: Function to make the mascot speakstopSpeaking()
: Function to stop speechseekToPosition(position)
: Function to seek to a position in millisecondsisSpeaking
: Boolean indicating if the mascot is currently speakingisLoading
: Boolean indicating if speech is loadingerror
: Error message or nullprogress
: Current playback position in millisecondsuseMascotPlayback(options)
setSpeakingState
: Optional. Whether to update the speaking state (default: true)add(chunks)
: Function to add viseme chunksstress(stresses)
: Function to add stress chunksplay()
: Function to start playbackseek(time)
: Function to seek to a positionpause()
: Function to pause playbackreset()
: Function to reset playbackMascotVoices