add code
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="MobileOptimized" content="320"/>
|
||||
<title>Hello H5+</title>
|
||||
<script type="text/javascript" src="../js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
var text=null;
|
||||
function startRecognize() {
|
||||
if(plus.os.name=='Android'&&navigator.userAgent.indexOf('StreamApp')>0){
|
||||
plus.nativeUI.toast('当前环境暂不支持语音识别插件');
|
||||
return;
|
||||
}
|
||||
var options = {};
|
||||
options.engine = 'iFly';
|
||||
//options.punctuation = false; // 是否需要标点符号
|
||||
text.value = "";
|
||||
outSet( "开始语音识别:" );
|
||||
plus.speech.startRecognize( options, function ( s ) {
|
||||
outLine( s );
|
||||
text.value += s;
|
||||
}, function ( e ) {
|
||||
outSet( "语音识别失败:"+e.message );
|
||||
} );
|
||||
}
|
||||
function startRecognizeEnglish(){
|
||||
if(plus.os.name=='Android'&&navigator.userAgent.indexOf('StreamApp')>0){
|
||||
plus.nativeUI.toast('当前环境暂不支持语音识别插件');
|
||||
return;
|
||||
}
|
||||
var options = {};
|
||||
options.engine = 'iFly';
|
||||
options.lang = 'en-us';
|
||||
text.value = "";
|
||||
outSet( "开始语音识别:" );
|
||||
plus.speech.startRecognize( options, function ( s ) {
|
||||
outLine( s );
|
||||
text.value += s;
|
||||
}, function ( e ) {
|
||||
outSet( "语音识别失败:"+e.message );
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>
|
||||
<style type="text/css">
|
||||
.out {
|
||||
margin: 9px;
|
||||
height: 30%;
|
||||
width: 90%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="text=document.getElementById('text');">
|
||||
<header id="header">
|
||||
<div class="nvbt iback" onclick="back()"></div>
|
||||
<div class="nvtt">Speech</div>
|
||||
<div class="nvbt idoc" onclick="openDoc('Speech Document','/doc/speech.html')"></div>
|
||||
</header>
|
||||
<div id="dcontent" class="dcontent">
|
||||
<br/>
|
||||
<div class="button" onclick="startRecognize()">开始语音识别</div>
|
||||
<br/>
|
||||
<div class="button" onclick="startRecognizeEnglish()">开始语音识别(英语)</div>
|
||||
<br/>
|
||||
<textarea readonly="readonly" id="text" style="margin:2%;padding:2%;height:50%;width:90%;border:1px solid #6C6C6C;-webkit-border-radius: 2px;border-radius: 2px;-webkit-appearance:none;">
|
||||
语音输入内容
|
||||
</textarea>
|
||||
</div>
|
||||
<div id="output">
|
||||
Speech提供语音识别功能,可通过麦克风设备进行语音输入操作。
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="../js/immersed.js" ></script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user