useVoiceActivityDetector(
config,options?):object
Defined in: hooks/useVoiceActivityDetector.ts:24
React hook to load and run a Voice Activity Detection (VAD) model.
This hook manages downloading (if remote URLs are provided) and loading the model assets, compiling them, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.
For imperative usage, see createFsmnVoiceActivityDetector.
The VAD model configuration. See FsmnVadModel.
Load and caching options. See ResourceOptions.
object
The same object as FsmnVoiceActivityDetector (without dispose),
combined with loading state and download progress.
detectVoice: (
waveform,options?) =>Promise<VadSegment[]> |undefined=model.detectVoice
detectVoiceOnStream: (
chunk,options?) =>VadEvent|undefined|undefined=model.detectVoiceOnStream
detectVoiceWorklet: (
waveform,options?) =>VadSegment[] |undefined=model.detectVoiceWorklet
downloadProgress:
number
error:
Error|undefined
isReady:
boolean=!!model
resetStream: () =>
void|undefined=model.resetStream
resource:
FsmnVadModel|undefined