Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I face a problem to run this in my project. #132

Open
piyuxx opened this issue Aug 10, 2024 · 2 comments
Open

I face a problem to run this in my project. #132

piyuxx opened this issue Aug 10, 2024 · 2 comments

Comments

@piyuxx
Copy link

piyuxx commented Aug 10, 2024

I used react, gatsby, typescript and
this is the way i implemented
import { useMicVAD } from "@ricky0123/vad-react";
const a= useMicVAD({
startOnLoad: true,
stream,
onSpeechStart,
onSpeechEnd,
positiveSpeechThreshold: 0.6,
negativeSpeechThreshold: 0.6 - 0.15,
});
and when i log a.userSpeaking it's always false .and here's log
{
"listening": false,
"errored": {
"message": "The user aborted a request."
},
"loading": false,
"userSpeaking": false
}

@JunJD
Copy link

JunJD commented Aug 12, 2024

我也遇到了同样的问题

@joooonis
Copy link

joooonis commented Sep 2, 2024

use useState instead

const [isSpeaking, setIsSpeaking] = useState(false);
const { loading } = useMicVAD({
  onSpeechStart: () => {
    // do something when speech start
    setIsSpeaking(true);
  },
  onSpeechEnd: audio => {
    // do something when speech start
    setIsSpeaking(false);
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants