检查用户是否插入了麦克风
Check to see if user has their microphone plugged in
我有一个功能可以检查浏览器是否支持语音识别,它会提醒它是否支持,而且效果很好,除了当用户使用时它不会提醒任何东西 Google Chrome,但没有插入麦克风。
我想让它检查用户是否插入了麦克风。那可能吗?
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()
if(confirm('Is your microphone plugged in?')) {
//they said yes :-)
} else {
//they said no :-(
}
我有一个功能可以检查浏览器是否支持语音识别,它会提醒它是否支持,而且效果很好,除了当用户使用时它不会提醒任何东西 Google Chrome,但没有插入麦克风。
我想让它检查用户是否插入了麦克风。那可能吗?
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()
if(confirm('Is your microphone plugged in?')) {
//they said yes :-)
} else {
//they said no :-(
}