zoukankan      html  css  js  c++  java
  • Web也来玩语音


    还在羡慕移动设备上的语音输入吗?ok让我们在Web上也来试一下吧。

    HTML5标签Input新提供了x-webkit-speech语法。能让我们将语音输入的功能很简单的带到我们的网站中,虽然它还不完美。(一目了然目前只有webkit核心的可以使用。例:Chrome只能在11以后的版本)

    第一个例子:

    <inputx-webkit-speech/>

    第二个例子:

    <inputtype="text"x-webkit-speechlang="zh-CN"/>

    通过lang指定语音输入的语系,例如像lang= "zh-CN"的话,语音输入所识别出来的文字就是简体字。

    第三个例子:

    <inputtype="text"x-webkit-speechx-webkit-grammar="builtin:translate">

    以下JS用来检测是否启用语音输入:

    if(document.createElement("input").webkitSpeech ===undefined){

    alert("Speech input is not supported in your browser.");

    }

    看看实例:

    enter image description here

    enter image description here

    相关资料:

    http://www.sitepoint.com/html5-speech-input-fields/#fbid=AFbsl161lkU

    http://webdesign.about.com/od/html5tutorials/qt/Collect-Speech-Input-With-Html5-On-Google-Chrome.htm

    http://www.w3.org/TR/capture-api/

    http://www.w3.org/TR/xhtml+voice/

    http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html

  • 相关阅读:
    快速幂
    hdu 1595 find the longest of the shortest(迪杰斯特拉,减去一条边,求最大最短路)
    hdu 4121 Xiangqi
    hdu 2224 The shortest path
    hdu4923
    矩阵模板
    hdu4570(区间dp)
    hdu1978(记忆化搜索)
    hdu4283(区间dp)
    hdu1160最长递减子序列及其路径
  • 原文地址:https://www.cnblogs.com/papajia/p/4498183.html
Copyright © 2011-2022 走看看