From 369f2ff8838569351c26d909407b497ab16d3bcf Mon Sep 17 00:00:00 2001
From: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com>
Date: 星期二, 20 六月 2023 11:08:50 +0800
Subject: [PATCH] add html5 local access asr service directly (#654)
---
funasr/runtime/html5/static/wsconnecter.js | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/funasr/runtime/html5/static/wsconnecter.js b/funasr/runtime/html5/static/wsconnecter.js
index 676a94a..b9098bb 100644
--- a/funasr/runtime/html5/static/wsconnecter.js
+++ b/funasr/runtime/html5/static/wsconnecter.js
@@ -15,8 +15,7 @@
this.wsStart = function () {
var Uri = document.getElementById('wssip').value; //"wss://111.205.137.58:5821/wss/" //璁剧疆wss asr online鎺ュ彛鍦板潃 濡� wss://X.X.X.X:port/wss/
-
- if(Uri.match(/wss:\S*/))
+ if(Uri.match(/wss:\S*|ws:\S*/))
{
console.log("Uri"+Uri);
}
@@ -25,6 +24,7 @@
alert("璇锋鏌ss鍦板潃姝g‘鎬�");
return 0;
}
+
if ( 'WebSocket' in window ) {
speechSokt = new WebSocket( Uri ); // 瀹氫箟socket杩炴帴瀵硅薄
speechSokt.onopen = function(e){onOpen(e);}; // 瀹氫箟鍝嶅簲鍑芥暟
@@ -80,6 +80,7 @@
speechSokt.send( JSON.stringify(request) );
console.log("杩炴帴鎴愬姛");
stateHandle(0);
+ isconnected=1;
}
function onClose( e ) {
@@ -92,9 +93,11 @@
}
function onError( e ) {
+ isconnected=-1;
info_div.innerHTML="杩炴帴"+e;
console.log(e);
stateHandle(2);
+
}
--
Gitblit v1.9.1