Skip to content

useRecord 🌴

Introduction

This is a hook function that automatically calls the browser's built-in API for speech-to-text conversion, allowing users to quickly use speech-to-text functionality, and returns events like start, end, error, and loading state. It's convenient for developers to integrate and implement custom voice button styles.

Combining the sender input box and useRecord hook function, you can easily implement custom voice button styles.

Code Examples

Calls the browser's native speech recognition API, when used in Google Chrome, it needs to be in a 🪄magic environment to work properly.

config Configuration

ParameterDescriptionType
onEndCallback function when speech ends(res: speech conversion result) => void

Returned Hooks

PropertyDescriptionType
startTrigger start speech(event:MouseEvent) => void
stopTrigger stop speech(event:MouseEvent) => void
loadingWhether currently speakingboolean
valueReal-time text from speech conversionstring