Now all major websites have added the voice input function to the search box, but currently only Chrome 11 and later versions are supported.
You can use the chrome browser to try the effect here and click the microphone:
The implementation is also very simple. Just add the attribute named x-webkit-speech to the input.
<Input type = "text" x-webkit-speech/>
Related Property settings:
Lang
Set language types:
<Input type = "text" x-webkit-speech lang = "zh-CN"/>
Onwebkitspeechchange
Voice Input events triggered when voice changes:
<Input type = "text" x-webkit-speech onwebkitspeechchange = "foo ()"/>
X-webkit-grammar
Language Input syntax. The "builtin: search" value makes the content of the language input as close as possible to the search content, removing unnecessary characters, such as "」
<Input type = "text" x-webkit-speech x-webkit-grammar = "builtin: search"/>
There is another value: "builtin: translate". We can see that taobao is in use, but we still don't know what it means. We have time to take a closer look at W3C documents.
The test results show that the speech recognition rate is good, but it is very tragic when both Chinese and English are mixed, and the service needs to go through the google server, so sometimes the response speed is very slow, in addition, when the message "microphone is unavailable" is displayed on the mac, it is suggested that there may be some hardware compatibility problems. In general, it is more interesting than practical. We hope to implement this function on the mobile browser and make some interesting applications.