Skip to content

useSpeechRecognition ​

类别
导出大小
721 B
最近修改
7 months ago

响应式 语音识别。

🌐 Reactive SpeechRecognition.

我可以使用吗?

示例 ​

Your browser does not support SpeechRecognition API, more details

用法 ​

🌐 Usage

ts
import { 
useSpeechRecognition
} from '@vueuse/core'
const {
isSupported
,
isListening
,
isFinal
,
result
,
confidence
,
start
,
stop
,
} =
useSpeechRecognition
()

confidence 引用跟踪最新结果的 置信值,范围在 0 到 1 之间。

🌐 The confidence ref tracks the confidence value of the latest result, between 0 and 1.

选项 ​

🌐 Options

以下显示了选项的默认值,它们将被直接传递给 SpeechRecognition API。

🌐 The following shows the default values of the options, they will be directly passed to SpeechRecognition API.

ts
useSpeechRecognition
({
lang
: 'en-US',
interimResults
: true,
continuous
: true,
})
js
'use strict'
useSpeechRecognition({
  lang: 'en-US',
  interimResults: true,
  continuous: true,
})