MUI 語音搜索框
阿新 • • 發佈:2017-07-06
+= ssa function 失敗 需要 settime () idt put
<div id="search-area">
<div class="mui-input-row mui-search mui-active" style="width: 85vw; display: inline-block;margin-left: 5px;">
<input id="search" type="search" class="mui-input-speech mui-input-clear" placeholder="" data-input-clear="2" data-input-speech="2" data-input-search="2">
<span class="mui-icon mui-icon-clear mui-hidden"></span>
<span class="mui-icon mui-icon-speech"></span>
<span class="mui-placeholder">
<span class="mui-icon mui-icon-search" id="search-btn"></span>
<span>帶語音輸入的搜索框</span>
</span>
</div>
<div id="search-text">搜索</div>
</div>
// 語音輸入 var text = null; function startRecognize() { var options = {}; options.engine = ‘iFly‘; options.punctuation = false; // 是否需要標點符號 text = ""; console.log("開始語音識別:"); plus.speech.startRecognize(options, function(s) { console.log(s); text += s; document.getElementById(‘search‘).value = text; }, function(e) { console.log("語音識別失敗:" + e.message); alert("語音識別失敗:" + e.message); }); setTimeout(stopRecognize, 10000); } // 停止語音輸入 function stopRecognize() { plus.speech.stopRecognize(); }
MUI 語音搜索框