【问题标题】:Check to see if user has their microphone plugged in [duplicate]检查用户是否插入了麦克风[重复]
【发布时间】:2016-03-24 06:00:08
【问题描述】:

我有一个检查浏览器是否支持语音识别的功能,它会提醒它是否支持,并且效果很好,除了当用户使用谷歌浏览器时它不会提醒任何东西,但是没有插入麦克风。

我希望它检查用户是否插入了麦克风。那可能吗?

function recognize() {

window.speechRecognition = window.speechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.webkitSpeechRecognition;

if (window.speechRecognition == undefined) { 
alert("Speech Recognition Only Supported in Google Chrome"); 
} //end of if (window.speechRecognition == undefined)
else {
alert("Speech Recognition is Supported.");
} //end of else if (window.speechRecognition != undefined)

} //end of function recognize()

【问题讨论】:

  • @CharlotteDunois 那里的答案似乎没什么帮助。
  • 因为无法检测是否插入了硬件麦克风。
  • @CharlotteDunois awww man.

标签: javascript speech-recognition microphone


【解决方案1】:
if(confirm('Is your microphone plugged in?')) {
    //they said yes :-)
} else {
    //they said no :-(
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-24
    相关资源
    最近更新 更多