未验证 提交 a0d1888c 编写于 作者: Y YangZhou 提交者: GitHub

Merge pull request #2091 from zh794390558/demo

[demo] fix demo
......@@ -66,7 +66,7 @@
</div>
</div>
<script>
var wenetWs = null
var ws = null
var timeLoop = null
var result = ""
$(document).ready(function () {
......@@ -76,18 +76,18 @@
function openWebSocket(url) {
if ("WebSocket" in window) {
wenetWs = new WebSocket(url)
wenetWs.onopen = function () {
ws = new WebSocket(url)
ws.onopen = function () {
console.log("Websocket 连接成功,开始识别")
wenetWs.send(JSON.stringify({
ws.send(JSON.stringify({
"signal": "start"
}))
}
wenetWs.onmessage = function (_msg) { parseResult(_msg.data) }
wenetWs.onclose = function () {
ws.onmessage = function (_msg) { parseResult(_msg.data) }
ws.onclose = function () {
console.log("WebSocket 连接断开")
}
wenetWs.onerror = function () { console.log("WebSocket 连接失败") }
ws.onerror = function () { console.log("WebSocket 连接失败") }
}
}
......@@ -104,7 +104,7 @@
var blob = blobOrNull
var encTime = blob.encTime
var reader = new FileReader()
reader.onloadend = function () { wenetWs.send(reader.result) }
reader.onloadend = function () { ws.send(reader.result) }
reader.readAsArrayBuffer(blob)
}
}
......@@ -142,7 +142,7 @@
}
function stopRecording() {
wenetWs.send(JSON.stringify({ "signal": "end" }))
ws.send(JSON.stringify({ "signal": "end" }))
SoundRecognizer.recordClose()
$('#endBtn').add($('#timeBox')).removeClass('show')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册