1.屏幕共享的本地地址修改为localhost.xuedianyun.com 端口605;2.修复测试模块返回值调用函数不存在的问题,MCU测速端口修改为5556
正在显示
7 个修改的文件
包含
29 行增加
和
16 行删除
| 1 | -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.iphunter=t():e.iphunter=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;if(!(e&&e.length&&t))throw new Error("ips and callback are required.");new o(e,t,n)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();t.default=i;var o=function(){function e(t,i,r){n(this,e),this.ip="",this.ipcallback=i,this.timeoutId=null,this.reqsCache=[];for(var o=0;o<t.length;o++)this.reqsCache.push(this.send(t[o],r-10));this.timeoutId=setTimeout(this.notify.bind(this),r)}return r(e,[{key:"clearAll",value:function(){this.reqsCache&&this.reqsCache.length&&this.reqsCache.forEach(function(e){e.abort()}),clearTimeout(this.timeoutId),this.ip="",this.ipcallback=null,this.timeoutId=null,this.reqsCache=[]}},{key:"clearReq",value:function(e){this.reqsCache.splice(this.reqsCache.indexOf(e),1)}},{key:"notify",value:function(){this.ipcallback(this.ip),this.clearAll()}},{key:"send",value:function(e,t){var n=this,i=new XMLHttpRequest;return i.open("HEAD","//"+e+"/?_="+Date.now()),i.timeout=t,i.onload=function(){n.ip=e,n.clearReq(i),i.onload=null,n.notify()},i.ontimeout=function(){n.clearReq(i),i.ontimeout=null},i.onerror=function(){n.clearReq(i),i.onerror=null},i.onabort=function(){n.clearReq(i),i.onabort=null},i.send(),i}}]),e}();(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(o,"IpHunter","/Users/AlexWang/ws/iphunter/src/main.js"),__REACT_HOT_LOADER__.register(i,"check","/Users/AlexWang/ws/iphunter/src/main.js"))})()}])}); | ||
| 1 | +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.iphunter=t():e.iphunter=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;if(!(e&&e.length&&t))throw new Error("ips and callback are required.");new r(e,t,n)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();t.default=i;var r=function(){function e(t,i,o){n(this,e),this.version="v2.0.1.20170819",this.ip="",this.ipcallback=i,this.timeoutId=null,this.reqsCache=[];for(var r=0;r<t.length;r++)this.reqsCache.push(this.send(t[r],o-10));this.timeoutId=setTimeout(this.notify.bind(this),o)}return o(e,[{key:"clearAll",value:function(){this.reqsCache&&this.reqsCache.length&&this.reqsCache.forEach(function(e){e.abort()}),clearTimeout(this.timeoutId),this.ip="",this.ipcallback=null,this.timeoutId=null,this.reqsCache=[]}},{key:"clearReq",value:function(e){this.reqsCache.splice(this.reqsCache.indexOf(e),1)}},{key:"notify",value:function(){this.ipcallback&&this.ipcallback(this.ip),this.clearAll()}},{key:"send",value:function(e,t){var n=this,i=new XMLHttpRequest;return i.open("HEAD","//"+e+"/?_="+Date.now()),i.timeout=t,i.onload=function(){n.ip=e,n.clearReq(i),i.onload=null,n.notify()},i.ontimeout=function(){n.clearReq(i),i.ontimeout=null},i.onerror=function(){n.clearReq(i),i.onerror=null},i.onabort=function(){n.clearReq(i),i.onabort=null},i.send(),i}}]),e}();(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(r,"IpHunter","D:/work/McuClient/node_modules/iphunter/src/main.js"),__REACT_HOT_LOADER__.register(i,"check","D:/work/McuClient/node_modules/iphunter/src/main.js"))})()}])}); |
| 1 | -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.iphunter=t():e.iphunter=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(2)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;if(!(e&&e.length&&t))throw new Error("ips and callback are required.");new r(e,t,n)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();t.default=o;var r=function(){function e(t,o,i){n(this,e),this.ip="",this.ipcallback=o,this.timeoutId=null,this.reqsCache=[];for(var r=0;r<t.length;r++)this.reqsCache.push(this.send(t[r],i-10));this.timeoutId=setTimeout(this.notify.bind(this),i)}return i(e,[{key:"clearAll",value:function(){this.reqsCache&&this.reqsCache.length&&this.reqsCache.forEach(function(e){e.abort()}),clearTimeout(this.timeoutId),this.ip="",this.ipcallback=null,this.timeoutId=null,this.reqsCache=[]}},{key:"clearReq",value:function(e){this.reqsCache.splice(this.reqsCache.indexOf(e),1)}},{key:"notify",value:function(){this.ipcallback(this.ip),this.clearAll()}},{key:"send",value:function(e,t){var n=this,o=new XMLHttpRequest;return o.open("HEAD","//"+e+"/?_="+Date.now()),o.timeout=t,o.onload=function(){n.ip=e,n.clearReq(o),o.onload=null,n.notify()},o.ontimeout=function(){n.clearReq(o),o.ontimeout=null},o.onerror=function(){n.clearReq(o),o.onerror=null},o.onabort=function(){n.clearReq(o),o.onabort=null},o.send(),o}}]),e}();(function(){"undefined"!=typeof __REACT_HOT_LOADER__&&(__REACT_HOT_LOADER__.register(r,"IpHunter","/Users/AlexWang/ws/iphunter/src/main.js"),__REACT_HOT_LOADER__.register(o,"check","/Users/AlexWang/ws/iphunter/src/main.js"))})()},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=n(1),r=o(i);(0,r.default)(["192.168.99.199","baidu.com","aliyun.com","qq.com","192.168.99.100","127.0.0.0:8080","192.168.1.48:8080","localhost:8080"],function(e){console.log("done -> ",e)});(function(){"undefined"==typeof __REACT_HOT_LOADER__})()}])}); | ||
| 1 | +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.iphunter=t():e.iphunter=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){!function(){throw new Error('Cannot find module "./test.js"')}()}])}); |
| @@ -73,8 +73,8 @@ | @@ -73,8 +73,8 @@ | ||
| 73 | "wbp": { | 73 | "wbp": { |
| 74 | "build": "dist/", | 74 | "build": "dist/", |
| 75 | "entries": { | 75 | "entries": { |
| 76 | - "main": "./src/main.js", | ||
| 77 | - "test": "./test/test.js" | 76 | + "main": "./main.js", |
| 77 | + "test": "./test.js" | ||
| 78 | }, | 78 | }, |
| 79 | "project": "umd", | 79 | "project": "umd", |
| 80 | "source": "src/" | 80 | "source": "src/" |
| 1 | class IpHunter { | 1 | class IpHunter { |
| 2 | constructor(ips, callback, timeout) { | 2 | constructor(ips, callback, timeout) { |
| 3 | + this.version="v2.0.1.20170819" | ||
| 3 | this.ip = ''; | 4 | this.ip = ''; |
| 4 | this.ipcallback = callback; | 5 | this.ipcallback = callback; |
| 5 | this.timeoutId = null; | 6 | this.timeoutId = null; |
| @@ -29,7 +30,9 @@ class IpHunter { | @@ -29,7 +30,9 @@ class IpHunter { | ||
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | notify() { | 32 | notify() { |
| 32 | - this.ipcallback(this.ip); | 33 | + if(this.ipcallback){ |
| 34 | + this.ipcallback(this.ip); | ||
| 35 | + } | ||
| 33 | this.clearAll(); | 36 | this.clearAll(); |
| 34 | } | 37 | } |
| 35 | 38 |
| @@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter { | @@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter { | ||
| 58 | constructor() { | 58 | constructor() { |
| 59 | super(); | 59 | super(); |
| 60 | //sdk 信息 | 60 | //sdk 信息 |
| 61 | - GlobalConfig.sdkVersion = "v1.76.2.20170818"; | 61 | + GlobalConfig.sdkVersion = "v1.77.4.20170819"; |
| 62 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 62 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 63 | 63 | ||
| 64 | //设置 | 64 | //设置 |
| @@ -16,8 +16,8 @@ const loger = Loger.getLoger('IpManager'); | @@ -16,8 +16,8 @@ const loger = Loger.getLoger('IpManager'); | ||
| 16 | const TIME_OUT = 2000;//选点超时 | 16 | const TIME_OUT = 2000;//选点超时 |
| 17 | const MS_DEFAULT_PORT = "1935";//默认流媒体端口 | 17 | const MS_DEFAULT_PORT = "1935";//默认流媒体端口 |
| 18 | const MCU_DEFAULT_PORT = "";//默认的mcu端口 //7777 | 18 | const MCU_DEFAULT_PORT = "";//默认的mcu端口 //7777 |
| 19 | -const SPEED_TEST_PORT = '5555';//测速端口(MCU/MS) | ||
| 20 | - | 19 | +const SPEED_TEST_PORT = '5555';//测速端口(MS) |
| 20 | +const MCU_SPEED_TEST_PORT = '5556';//测速端口(MCU) | ||
| 21 | class IpManager extends Emiter { | 21 | class IpManager extends Emiter { |
| 22 | constructor() { | 22 | constructor() { |
| 23 | super(); | 23 | super(); |
| @@ -135,7 +135,7 @@ class IpManager extends Emiter { | @@ -135,7 +135,7 @@ class IpManager extends Emiter { | ||
| 135 | if (msItem && msItem.ip) { | 135 | if (msItem && msItem.ip) { |
| 136 | //测速的时候,ip地址要拼接成带端口的完整地址,测速的端口是固定的 | 136 | //测速的时候,ip地址要拼接成带端口的完整地址,测速的端口是固定的 |
| 137 | //newList.add((msItem.ip + ':' + SPEED_TEST_PORT)); | 137 | //newList.add((msItem.ip + ':' + SPEED_TEST_PORT)); |
| 138 | - newList[msItem.ip + ':' + SPEED_TEST_PORT]=msItem.ip + ':' + SPEED_TEST_PORT; | 138 | + newList[msItem.ip + ':' + MCU_SPEED_TEST_PORT]=msItem.ip + ':' + MCU_SPEED_TEST_PORT; |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | //过滤完重复ip | 141 | //过滤完重复ip |
| @@ -161,7 +161,7 @@ class IpManager extends Emiter { | @@ -161,7 +161,7 @@ class IpManager extends Emiter { | ||
| 161 | } | 161 | } |
| 162 | } else { | 162 | } else { |
| 163 | loger.log('MCU选点->done -> ', fatest_ip_response); | 163 | loger.log('MCU选点->done -> ', fatest_ip_response); |
| 164 | - let fastestIp = fatest_ip_response.replace((':' + SPEED_TEST_PORT), '') || "" | 164 | + let fastestIp = fatest_ip_response.replace((':' + MCU_SPEED_TEST_PORT), '') || "" |
| 165 | callbackData.ip = fastestIp; | 165 | callbackData.ip = fastestIp; |
| 166 | callbackData.port = ''; | 166 | callbackData.port = ''; |
| 167 | 167 |
| @@ -5,7 +5,7 @@ import Loger from 'Loger'; | @@ -5,7 +5,7 @@ import Loger from 'Loger'; | ||
| 5 | import MessageTypes from 'MessageTypes'; | 5 | import MessageTypes from 'MessageTypes'; |
| 6 | import GlobalConfig from 'GlobalConfig'; | 6 | import GlobalConfig from 'GlobalConfig'; |
| 7 | import EngineUtils from 'EngineUtils'; | 7 | import EngineUtils from 'EngineUtils'; |
| 8 | -import ShareScreen from 'ss' | 8 | +import ShareScreen from 'screenShare' |
| 9 | import Emiter from 'Emiter'; | 9 | import Emiter from 'Emiter'; |
| 10 | import ApeConsts from './ApeConsts'; | 10 | import ApeConsts from './ApeConsts'; |
| 11 | let loger = Loger.getLoger('ShareApe'); | 11 | let loger = Loger.getLoger('ShareApe'); |
| @@ -21,14 +21,13 @@ class ShareApe extends Emiter { | @@ -21,14 +21,13 @@ class ShareApe extends Emiter { | ||
| 21 | //this.shareScreen=new ShareScreen(); | 21 | //this.shareScreen=new ShareScreen(); |
| 22 | this.shareScreen=ShareScreen; | 22 | this.shareScreen=ShareScreen; |
| 23 | this.defaultPort='605';//以前用的是8089 | 23 | this.defaultPort='605';//以前用的是8089 |
| 24 | - this.defaultIp='127.0.0.1'; | 24 | + this.defaultIp='localhost.xuedianyun.com';//127.0.0.1 |
| 25 | this.ip=this.defaultIp; | 25 | this.ip=this.defaultIp; |
| 26 | this.port=this.defaultPort; | 26 | this.port=this.defaultPort; |
| 27 | - | 27 | + this.fullIpPort=''; |
| 28 | this.init(); | 28 | this.init(); |
| 29 | } | 29 | } |
| 30 | init(){ | 30 | init(){ |
| 31 | - | ||
| 32 | // 版本信息 | 31 | // 版本信息 |
| 33 | this.shareScreen.on(ShareScreen.VERSION_INFO_CHANGE, (d) => { | 32 | this.shareScreen.on(ShareScreen.VERSION_INFO_CHANGE, (d) => { |
| 34 | console.log('VERSION_INFO_CHANGE->', d); | 33 | console.log('VERSION_INFO_CHANGE->', d); |
| @@ -115,8 +114,19 @@ class ShareApe extends Emiter { | @@ -115,8 +114,19 @@ class ShareApe extends Emiter { | ||
| 115 | startConnectSocket(){ | 114 | startConnectSocket(){ |
| 116 | clearTimeout(this.reConnectTimer); | 115 | clearTimeout(this.reConnectTimer); |
| 117 | if(!this.isConnect){ | 116 | if(!this.isConnect){ |
| 118 | - console.log('开始连接本地流媒体服务->'); | ||
| 119 | - this.shareScreen.start(this.ip, this.port); | 117 | + |
| 118 | + //this.shareScreen.start(this.ip, this.port); | ||
| 119 | + if(this.port){ | ||
| 120 | + this.fullIpPort = GlobalConfig.websocketProtocol + this.ip + ':' + this.port; | ||
| 121 | + }else { | ||
| 122 | + this.fullIpPort = GlobalConfig.websocketProtocol + this.ip; | ||
| 123 | + } | ||
| 124 | + if(GlobalConfig.isHttps==true){ | ||
| 125 | + //https的时候替换所有80端口 | ||
| 126 | + this.fullIpPort= GlobalConfig.replacePort(this.fullIpPort,":80",""); | ||
| 127 | + } | ||
| 128 | + loger.log('开始连接本地流媒体服务->',this.fullIpPort); | ||
| 129 | + this.shareScreen.startConnect(this.fullIpPort); | ||
| 120 | } | 130 | } |
| 121 | } | 131 | } |
| 122 | 132 |
-
请 注册 或 登录 后发表评论