huangxiaojing 3 gadi atpakaļ
vecāks
revīzija
d03c2230ff

+ 15 - 13
screenAndroid/WXdraw.js

@@ -33,7 +33,9 @@ form.domainName = parameters["domainName"];
 var isWSS = true;
 var cUrl = isWSS ? "wss://" + form.domainName + "?cardIp=" + form.ip : "ws://" + form.domainName + "?cardIp=" + form.ip;
 // var cUrl = "ws://192.168.199.46:9101?token=test0123456789";
-
+var deviceBoard = parameters['deviceBoard'];
+var videoWidth = deviceBoard.substring(0, 2) === 'MTK' ? 1080 : 720
+var videoHeight = deviceBoard.substring(0, 2) === 'MTK' ? 1920 : 1280
 var wsss,errorTime = 0;
 doConnect();
 function throttle(fn, delay) {
@@ -148,8 +150,8 @@ var draw_graph = function (graphType, obj) {
 		if (resolving == 0) {
 			var ping;
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight)
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight)
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth)
 				ping = {
 					"data": {
 						"action": 0,
@@ -165,8 +167,8 @@ var draw_graph = function (graphType, obj) {
 		} else {
 			var ping;
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth)
-				var caheightYs = touchfor[i].pageY * (1280 / voheight)
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth)
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight)
 				ping = {
 					"data": {
 						"action": 0,
@@ -191,8 +193,8 @@ var draw_graph = function (graphType, obj) {
 		if (resolving == 0) {
 			var ping;
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight);
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth);
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight);
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth);
 				ping = {
 					"data": {
 						"action": 1,
@@ -208,8 +210,8 @@ var draw_graph = function (graphType, obj) {
 		} else {
 			var ping;
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth);
-				var caheightYs = touchfor[i].pageY * (1280 / voheight);
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth);
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight);
 				ping = {
 					"data": {
 						"action": 1,
@@ -239,8 +241,8 @@ var draw_graph = function (graphType, obj) {
 		//是否横屏  morePortionMove
 		if (resolving == 0) {
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight)
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight)
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth)
 				ping = {
 					"data": {
 						"action": 2,
@@ -257,8 +259,8 @@ var draw_graph = function (graphType, obj) {
 		} else {
 			var ping;
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth);
-				var caheightYs = touchfor[i].pageY * (1280 / voheight);
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth);
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight);
 				ping = {
 					"data": {
 						"action": 2,

+ 0 - 1
screenAndroid/WXtrialInterface.html

@@ -395,7 +395,6 @@
 		})
 
 		form.clientType = parameters['clientType'];
-		form.diskName = parameters['diskName'];
 		form.id = parameters['id'];
 		form.userCardId = parameters['userCardId'];
 

+ 15 - 13
screenIos/WXdraw.js

@@ -30,7 +30,9 @@ form.ip = parameters['ip'];
 form.domainName = parameters["domainName"];
 var isWSS = true;
 var cUrl = isWSS ? "wss://" + form.domainName + "?cardIp=" + form.ip : "ws://" + form.domainName + "?cardIp=" + form.ip;
-
+var deviceBoard = parameters['deviceBoard'];
+var videoWidth = deviceBoard.substring(0, 2) === 'MTK' ? 1080 : 720
+var videoHeight = deviceBoard.substring(0, 2) === 'MTK' ? 1920 : 1280
 var wsss;
 var errorTime = 0;
 doConnect();
@@ -143,8 +145,8 @@ var draw_graph = function (graphType) {
 		if (resolving == 0) {
 			var ping
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight)
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight)
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth)
 				ping = {
 					"data": {
 						"action": 0,
@@ -160,8 +162,8 @@ var draw_graph = function (graphType) {
 		} else {
 			var ping
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth)
-				var caheightYs = touchfor[i].pageY * (1280 / voheight)
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth)
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight)
 				ping = {
 					"data": {
 						"action": 0,
@@ -188,8 +190,8 @@ var draw_graph = function (graphType) {
 		if (resolving == 0) {
 			var ping
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight)
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight)
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth)
 				ping = {
 					"data": {
 						"action": 1,
@@ -205,8 +207,8 @@ var draw_graph = function (graphType) {
 		} else {
 			var ping
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth)
-				var caheightYs = touchfor[i].pageY * (1280 / voheight)
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth)
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight)
 				ping = {
 					"data": {
 						"action": 1,
@@ -236,8 +238,8 @@ var draw_graph = function (graphType) {
 		//是否横屏  morePortionMove
 		if (resolving == 0) {
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageY * (1280 / voheight)
-				var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
+				var cawidthXs = touchfor[i].pageY * (videoHeight / voheight)
+				var caheightYs = videoWidth - touchfor[i].pageX * (videoWidth / vowidth)
 				ping = {
 					"data": {
 						"action": 2,
@@ -253,8 +255,8 @@ var draw_graph = function (graphType) {
 		} else {
 			var ping
 			for (var i = 0; i < touchfor.length; i++) {
-				var cawidthXs = touchfor[i].pageX * (720 / vowidth)
-				var caheightYs = touchfor[i].pageY * (1280 / voheight)
+				var cawidthXs = touchfor[i].pageX * (videoWidth / vowidth)
+				var caheightYs = touchfor[i].pageY * (videoHeight / voheight)
 				ping = {
 					"data": {
 						"action": 2,

+ 5 - 2
screenIos/WXtrialInterface.html

@@ -647,7 +647,10 @@
 		Module.onRuntimeInitialized = function () {
 			isFinish = true;
 		}
-
+		
+		var deviceBoard = parameters['deviceBoard'];
+		var videoWidth = deviceBoard.substring(0, 2) === 'MTK' ? 1080 : 720
+		var videoHeight = deviceBoard.substring(0, 2) === 'MTK' ? 1920 : 1280
 		function decodeAAC(data) {
 			var retPtr = Module._malloc(4 * 5 * 1024); //接收的数据
 			var inputPtr = Module._malloc(4 * data.length); //输入数据
@@ -682,7 +685,7 @@
 					if (renderCount++ < 4 || !isAudioPlay) {
 						return
 					}
-					webglPlayer.renderFrame(objData.data, 720, 1280, 720 * 1280, (720 / 2) * (1280 / 2));
+					webglPlayer.renderFrame(objData.data, videoWidth, videoHeight, videoWidth * videoHeight, (videoWidth / 2) * (videoHeight / 2));
 					$('.weui-mask_transparent').hide()
 					$('.weui-toast').hide()
 					$('.loading').hide()

+ 23 - 3
screenIos/decoder.js

@@ -2,10 +2,15 @@ var isFinish = false;
 var decodeCount = 0;
 var h264Queue = [];
 var isFirst = true;
+var parameters = GetRequest();
+var deviceBoard = parameters['deviceBoard'];
+var videoWidth = deviceBoard.substring(0, 2) === 'MTK' ? 1080 : 720
+var videoHeight = deviceBoard.substring(0, 2) === 'MTK' ? 1920 : 1280
+
 var ret = ''
 self.Module = {
 	onRuntimeInitialized: function () {
-		ret = Module._openDecoder(720, 1280);
+		ret = Module._openDecoder(videoWidth, videoHeight);
 		if (!ret) {
 			isFinish = true;
 		}
@@ -47,7 +52,8 @@ setInterval(
 
 
 function decodeH264(data) {
-	var retPtr = Module._malloc(2457600); //接收的数据
+	var size = videoWidth * videoHeight *3;
+	var retPtr = Module._malloc(size); //接收的数据
 	var inputPtr = Module._malloc(data.length); //输入数据
 
 	for (var i = 0; i < data.length; i++) {
@@ -66,7 +72,7 @@ function decodeH264(data) {
 		decodeCount++;
 	}
 
-	var yuvData = new Uint8Array(2457600);
+	var yuvData = new Uint8Array(size);
 	for (var i = 0; i < yuvData.length; i++) {
 		yuvData[i] = Module.HEAPU8[(retPtr) + i];
 	}
@@ -86,3 +92,17 @@ function decodeH264(data) {
 function closeDecoder() {
 	Module._destroyDecoder();
 }
+
+// 获取url中"?"符后的字串
+function GetRequest() {
+	var url = location.search;
+	var obj = new Object();
+	if (url.indexOf("?") != -1) {
+		var str = url.substr(1);
+		strs = str.split("&");
+		for (var i = 0; i < strs.length; i++) {
+			obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
+		}
+	}
+	return obj;
+}