livetalking/html/static/echo.html

132 lines
4.5 KiB
HTML
Raw Normal View History

2024-04-13 17:12:23 +08:00
<!-- index.html -->
<html>
<head>
<script type="text/javascript" src="mpegts-1.7.3.min.js"></script>
<script type="text/javascript" src="http://cdn.sockjs.org/sockjs-0.3.4.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="recorder-core.js" charset="UTF-8"></script>
<script src="wav.js" charset="UTF-8"></script>
<script src="pcm.js" charset="UTF-8"></script>
</head>
<body>
<div class="container">
<h1>metahuman voice test</h1>
2024-04-14 19:15:50 +08:00
<form class="form-inline" id="echo-form" name="ssbtn">
2024-04-13 17:12:23 +08:00
<div class="form-group">
<p>input text</p>
2024-04-13 19:11:50 +08:00
<textarea cols="2" rows="3" style="width:600px;height:50px;" class="form-control" id="message"></textarea>
2024-04-13 17:12:23 +08:00
</div>
<button type="submit" class="btn btn-default">Send</button>
</form>
<div id="log">
</div>
<video id="video_player" width="40%" controls autoplay muted></video>
</div>
<div>------------------------------------------------------------------------------------------------------------------------------</div>
<div class="div_class_topArea">
<div class="div_class_recordControl">
asr服务器地址(必填):
<br>
2024-04-13 19:11:50 +08:00
<input id="wssip" type="text" onchange="addresschange()" style="width: 500px;" value="wss://127.0.0.1:10095/"/>
2024-04-13 17:12:23 +08:00
<br>
2024-04-13 19:11:50 +08:00
<a id="wsslink" style="display: none;" href="#" onclick="window.open('https://127.0.0.1:10095/', '_blank')"><div id="info_wslink">点此处手工授权wss://127.0.0.1:10095/</div></a>
2024-04-13 17:12:23 +08:00
<br>
<br>
<div style="border:2px solid #ccc;display: none;">
选择录音模式:<br/>
<label ><input name="recoder_mode" onclick="on_recoder_mode_change()" type="radio" value="mic" checked="true"/>麦克风 </label>&nbsp;&nbsp;
<label><input name="recoder_mode" onclick="on_recoder_mode_change()" type="radio" value="file" />文件 </label>
</div>
2024-04-13 19:11:50 +08:00
2024-04-13 17:12:23 +08:00
<div id="mic_mode_div" style="border:2px solid #ccc;display:none;">
选择asr模型模式:<br/>
<label><input name="asr_mode" type="radio" value="2pass" />2pass </label>&nbsp;&nbsp;
2024-04-14 17:37:04 +08:00
<label><input name="asr_mode" type="radio" value="online" checked="true"/>online </label>&nbsp;&nbsp;
<label><input name="asr_mode" type="radio" value="2pass-offline" />2pass-offline </label>&nbsp;&nbsp;
2024-04-13 17:12:23 +08:00
<label><input name="asr_mode" type="radio" value="offline" />offline </label>
</div>
<div id="rec_mode_div" style="border:2px solid #ccc;display:none;">
<input type="file" id="upfile">
</div>
2024-04-13 19:11:50 +08:00
2024-04-13 17:12:23 +08:00
<div style="border:2px solid #ccc;display: none;">
热词设置(一行一个关键字,空格隔开权重,如"阿里巴巴 20")
2024-04-13 19:11:50 +08:00
<textarea rows="1" id="varHot" style=" width: 100%;height:auto" >阿里巴巴 20&#13;hello world 40</textarea>
2024-04-13 17:12:23 +08:00
</div>
2024-04-13 19:11:50 +08:00
<div style="display: none;">语音识别结果显示:</div>
2024-04-13 17:12:23 +08:00
<br>
2024-04-13 19:11:50 +08:00
<textarea rows="10" id="varArea" readonly="true" style=" width: 100%;height:auto;display: none;" ></textarea>
2024-04-13 17:12:23 +08:00
<br>
<div id="info_div">请点击开始</div>
<div class="div_class_buttons">
<button id="btnConnect">连接</button>
<button id="btnStart">开始</button>
<button id="btnStop">停止</button>
</div>
2024-04-13 19:11:50 +08:00
<audio id="audio_record" type="audio/wav" controls style="margin-top: 2px; width: 100%;display: none;"></audio>
2024-04-13 17:12:23 +08:00
</div>
</div>
<script src="wsconnecter.js" charset="utf-8"></script>
<script src="main.js" charset="utf-8"></script>
</body>
<script type="text/javascript" charset="utf-8">
2024-04-14 17:37:04 +08:00
// $(document).ready(function() {
// var host = window.location.hostname
// var ws = new WebSocket("ws://"+host+":8000/humanecho");
// //document.getElementsByTagName("video")[0].setAttribute("src", aa["video"]);
// ws.onopen = function() {
// console.log('Connected');
// };
// ws.onmessage = function(e) {
// console.log('Received: ' + e.data);
// data = e
// var vid = JSON.parse(data.data);
// console.log(typeof(vid),vid)
// //document.getElementsByTagName("video")[0].setAttribute("src", vid["video"]);
2024-04-13 17:12:23 +08:00
2024-04-14 17:37:04 +08:00
// };
// ws.onclose = function(e) {
// console.log('Closed');
// };
// flvPlayer = mpegts.createPlayer({type: 'flv', url: "http://"+host+":8080/live/livestream.flv", isLive: true, enableStashBuffer: false});
// flvPlayer.attachMediaElement(document.getElementById('video_player'));
// flvPlayer.load();
// flvPlayer.play();
// $('#echo-form').on('submit', function(e) {
// e.preventDefault();
// var message = $('#message').val();
// console.log('Sending: ' + message);
// ws.send(message);
// $('#message').val('');
// });
// });
2024-04-14 19:15:50 +08:00
2024-04-13 17:12:23 +08:00
</script>
</html>