浏览代码

推流不稳定

heyang 4 年之前
父节点
当前提交
c9c9d799a9
共有 1 个文件被更改,包括 16 次插入26 次删除
  1. 16 26
      screenAndroid/WXtrialInterface.html

+ 16 - 26
screenAndroid/WXtrialInterface.html

@@ -145,7 +145,7 @@
 		// 	video.play();
 		// 	video.play();
 		// 	audio.play();
 		// 	audio.play();
 		// }, false);
 		// }, false);
-		var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部 是否准备重连
+		var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
 		$('#wine').css({
 		$('#wine').css({
 			"width": window.screen.width,
 			"width": window.screen.width,
 			"height": window.screen.height - topwinHeight - 20,
 			"height": window.screen.height - topwinHeight - 20,
@@ -224,23 +224,12 @@
 		}
 		}
 		var ws;
 		var ws;
 		doConnect();
 		doConnect();
-		function throttle(fn, delay) {
-		    let flag = true;
-			return () => {
-				if (!flag) return;
-				flag = false;
-				timer = setTimeout(() => {
-					fn();
-					flag = true;
-				}, delay);
-			};
-		}
 		function doConnect() {
 		function doConnect() {
 			ws = new WebSocket(socketURL);
 			ws = new WebSocket(socketURL);
 			ws.binaryType = 'arraybuffer';
 			ws.binaryType = 'arraybuffer';
 
 
 			ws.onclose = function (e) {
 			ws.onclose = function (e) {
-				throttle(doConnect,500);
+				doConnect();
 				// console.log(e);
 				// console.log(e);
 				// $.confirm({
 				// $.confirm({
 				// 	title: '提示',
 				// 	title: '提示',
@@ -263,19 +252,20 @@
 
 
 			ws.addEventListener('error', function (event) {
 			ws.addEventListener('error', function (event) {
 				console.log(event);
 				console.log(event);
-				$.confirm({
-					title: '提示',
-					text: '连接失败,是否准备重连?',
-					onOK: function () {
-						throttle(doConnect,500);
-						// doConnect();
-					},
-					onCancel: function () {
-						wx.miniProgram.switchTab({
-							url: '/pages/home/home'
-						})
-					}
-				});
+				doConnect();
+				// $.confirm({
+				// 	title: '提示',
+				// 	text: '连接失败,是否准备重连?',
+				// 	onOK: function () {
+				// 		throttle(doConnect,500);
+				// 		// doConnect();
+				// 	},
+				// 	onCancel: function () {
+				// 		wx.miniProgram.switchTab({
+				// 			url: '/pages/home/home'
+				// 		})
+				// 	}
+				// });
 			});
 			});
 
 
 			ws.addEventListener('message', function (event) {
 			ws.addEventListener('message', function (event) {