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>