Skip to content

Conversation

@yoidea
Copy link
Member

@yoidea yoidea commented Jan 1, 2021

No description provided.

@vercel
Copy link

vercel bot commented Jan 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/yoidea/bragging-detector/nun35qndn
✅ Preview: https://bragging-detector-git-components.yoidea.vercel.app

@yoidea
Copy link
Member Author

yoidea commented Jan 1, 2021

見て貰う人おれへんから自問自答するか

const [userMusicName, setUserMusicName] = useState(""); // ファイル名

useEffect(() => {
const music = new Audio("/static/warning01.mp3"); // デフォルト音
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デプロイ時にAudioインスタンスでエラーが出たから、useEffect内に含めて必ずクライアントのみで実行するようにした。

setDetecting(false);
};
recognizerRef.current.onresult = event => {
[...event.results].slice(event.resultIndex).forEach(result => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.resultsは俗に言う連想配列みたいな形をしてたから配列に変換して反復処理している。

setTranscript("");
} else {
// 音声認識の途中経過
if (tagValues.some(value => transcript.includes(value))) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

認識した文章に検知する単語が含まれていれば

@yoidea yoidea merged commit 951150b into master Jan 1, 2021
@yoidea yoidea deleted the components branch January 3, 2021 15:55
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

Successfully merging this pull request may close these issues.

2 participants