请问如何实现浏览器端麦克风声音指令识别?
网友回复
可以通过 webkitSpeechRecognition,不过这个是chrome的内置服务,需要访问google服务器,请确保你的网络能访问google,示例代码如下:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width"> <title>Speech color changer</title> <style> body, html { margin: 0; } html { height: 100%; } body { height: inherit; overflow: hidden; max-width: 800px; margin: 0 auto; } h1, p { font-family: sans-serif; text-align: center; padding: 20px; } div { height: 100px; overflow: auto; position: absolute; bottom: 0px; right: 0; left: 0; background-color: rgba(255,255,255,0.2); } ul { margin: 0; } .hints span { text-shadow: -1px 1px 0px rgb(254 254 254 / 90%); margin: 10px; display: block; height: 40px; line-height: 40px; cursor: pointer; } </style> </head> <body> <h1>用英文说出以下颜色</h1> <p>需要您的网络能够访问google提供的服务</p> <p class="hints"></p> <div> <p class="output"> <em>指令识别中.....</em> </p> </div> <script> // var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSp...
点击查看剩余70%
如何写一个python代码的coze插件实现图片合成mp4视频?
ai翻唱模仿一首歌生成的歌曲需要交版权费给原歌曲版权方吗?
视频编码 HEVC、AVC 和 AV1有啥不同?
coze的http长连接调用第三方api如何实现耗时异步通知?
openrouter如何免费使用大gemini及deepseek大模型api?
coze的speech_synthesis文字转语音配音插件的所有的voice_id列表怎么获取?
Gemini 2.5 Pro Preview 05-06与claude 3.7谁的ui截图转代码功能更强?
gpt4o免费白嫖的图片编辑网站有哪些?
coze如何实现自动海报设计?
coze如何实现模特换装?