A. 求教:javaWeb,添加語音輸入的功能實現方法
[javascript]view plainprint?
<buttonng-click="startRecognize()">
<iclass="iconion-mic-a"></i>
</button>
//語音識別
$rootScope.startRecognize=function(){
varspeech;
varoptions={};//語音識別參數,用於控制語音引擎的各種技術參數
options.engine='iFly';
options.userInterface='false';
text="";
plus.speech.startRecognize(options,function(s){
text+=s;
console.log(text);
text=text.replace(',','').replace('。','').replace('?','');
$scope.$apply(function(){
$rootScope.medname=text;
$scope.searchMed(2,$rootScope.medname)
});
},function(e){
$ionicLoading.show({
template:"語音輸入失敗,請重新嘗試"
});
setTimeout(function(){
$ionicLoading.hide();
},2000);
});
setTimeout(function(){
plus.speech.stopRecognize();
},10000);//超時語音結束
}
其中涉及到使用ionic框架中的按鈕組件。
其雲端打包授權功能需要到第三方開發平台申請應用後獲取相關配置參數。集成過程與微信授權認證差不多。
添加第三方登錄模塊
可視化界面配置
首先是需要添加第三方登錄模塊,雙擊應用的manifest.json文件:
第二個問題,解決起來似乎有一定的難度。自己只能夠慢慢摸索。
第三個問題暫時得不到解決。
附:button設置圖片
[html]view plainprint?
<buttonstyle="width:40px;height:38px;white-space:normal;padding:12px;padding-left:20px;background:none;background:url(img/btnbg.png)no-repeat-2px-2px;"ng-click="startRecognize()">
<!--<iclass="iconion-mic-a"></i>-->
</button>