App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-21 32383daed1b498577da8c37145e66e2a93e28b2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!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() {
    var options = {
        engine: 'baidu'
    };
    text.value = '';
    outSet('开始语音识别:');
    plus.speech.startRecognize(options, function(s){
        outLine(s);
        text.value += s;
    }, function(e){
        outSet('语音识别失败:'+JSON.stringify(e));
    } );
}
function startRecognizeEnglish(){
    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('语音识别失败:'+JSON.stringify(e));
    } );
}
        </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');">
        <br/>
        <div class="button" onclick="startRecognize()">开始语音识别</div>
        <div class="button" onclick="startRecognizeEnglish()">开始语音识别(英语)</div>
        <br/>
        <textarea readonly="readonly" id="text" style="margin:2%;padding:2%;height:60px;width:90%;border:1px solid #6C6C6C;-webkit-border-radius: 2px;border-radius: 2px;-webkit-appearance:none;">
语音输入内容
        </textarea>
        <br/>
        <br/>
        <div class="button" onclick="clicked('speech_custom.html')">自定义语音识别</div>
        <br/>
        <div id="outpos"/>
        <div id="output">
Speech提供语音识别功能,可通过麦克风设备进行语音输入操作。
        </div>
    </body>
</html>