HTML5 x-webkit-speech Voice Input Function

Source: Internet
Author: User
Tags builtin

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.