正在显示
10 个修改的文件
包含
224 行增加
和
223 行删除
| @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | ||
| 63 | super(); | 63 | super(); |
| 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 | 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 |
| 65 | //sdk 信息 | 65 | //sdk 信息 |
| 66 | - GlobalConfig.sdkVersion = "v2.26.4.20171102"; | 66 | + GlobalConfig.sdkVersion = "v2.26.6.20171103"; |
| 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); | 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); |
| 69 | //设置 | 69 | //设置 |
| @@ -2527,11 +2527,12 @@ export default class MessageEntrance extends Emiter { | @@ -2527,11 +2527,12 @@ export default class MessageEntrance extends Emiter { | ||
| 2527 | //文档加入频道成功,同步到MCU服务器上的数据 | 2527 | //文档加入频道成功,同步到MCU服务器上的数据 |
| 2528 | docJoinChannelSuccess() { | 2528 | docJoinChannelSuccess() { |
| 2529 | let interval=new Date().getTime()-parseInt(this.lastClassActiveTime); | 2529 | let interval=new Date().getTime()-parseInt(this.lastClassActiveTime); |
| 2530 | - loger.log("最后一次记录的时间->"+this.lastClassActiveTime,"当前时间:"+new Date().getTime(),"间隔:"+interval/1000); | 2530 | + interval=interval/1000; |
| 2531 | + loger.log("最后一次记录的时间->"+this.lastClassActiveTime,"当前时间:"+new Date().getTime(),"间隔:"+interval+"秒"); | ||
| 2531 | loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); | 2532 | loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); |
| 2532 | 2533 | ||
| 2533 | - //如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制 | ||
| 2534 | - if(GlobalConfig.rosterNumber<=1&&interval>=(8*60)){ | 2534 | + //如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制,设备不是H5 |
| 2535 | + if(GlobalConfig.rosterNumber<=1&&interval>=(8*60)&&GlobalConfig.deviceType!=3){ | ||
| 2535 | loger.log("调用服务端音视频停止录制->interval:"+interval); | 2536 | loger.log("调用服务端音视频停止录制->interval:"+interval); |
| 2536 | this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2}); | 2537 | this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2}); |
| 2537 | } | 2538 | } |
| @@ -3270,7 +3271,7 @@ export default class MessageEntrance extends Emiter { | @@ -3270,7 +3271,7 @@ export default class MessageEntrance extends Emiter { | ||
| 3270 | if (!_params) { | 3271 | if (!_params) { |
| 3271 | return; | 3272 | return; |
| 3272 | } | 3273 | } |
| 3273 | - loger.log("设置appConfig", _params); | 3274 | + loger.log("设置appConfig"); |
| 3274 | if (GlobalConfig.appId) { | 3275 | if (GlobalConfig.appId) { |
| 3275 | loger.log("本地已经设置appConfig,不需要再设置"); | 3276 | loger.log("本地已经设置appConfig,不需要再设置"); |
| 3276 | return; | 3277 | return; |
| @@ -19,199 +19,210 @@ import GlobalConfig from 'GlobalConfig'; | @@ -19,199 +19,210 @@ import GlobalConfig from 'GlobalConfig'; | ||
| 19 | let loger = Loger.getLoger('EverSocket'); | 19 | let loger = Loger.getLoger('EverSocket'); |
| 20 | const MCU_MAX_RECONNECTION = 4;//最多重连次数 | 20 | const MCU_MAX_RECONNECTION = 4;//最多重连次数 |
| 21 | class EverSocket extends Emiter { | 21 | class EverSocket extends Emiter { |
| 22 | - constructor() { | ||
| 23 | - super(); | ||
| 24 | - this._connected = false; | ||
| 25 | - this._lastActiveTime = 0;//最后一次收到消息的时间 | ||
| 26 | - this._enableEverSocket = false; | ||
| 27 | - this.reConnectionCounter = 0;//重连次数 | ||
| 28 | - | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - begin(ip, port) { | ||
| 32 | - this._clearHistory(); | ||
| 33 | - loger.log('开始WebSocket应用.'); | ||
| 34 | - if(!ip){ | ||
| 35 | - loger.error('开始MCU连接->MCU连接地址无效'); | ||
| 36 | - } | ||
| 37 | - this._enableEverSocket = true; | ||
| 38 | - //this.wsURL = 'ws://' + ip + ':' + port; | ||
| 39 | - if(port){ | ||
| 40 | - this.wsURL = GlobalConfig.websocketProtocol + ip + ':' + port; | ||
| 41 | - }else { | ||
| 42 | - this.wsURL = GlobalConfig.websocketProtocol + ip; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - this._newConnection(); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - end() { | ||
| 49 | - loger.log('停止WebSocket应用.'); | ||
| 50 | - this._clear(); | ||
| 51 | - } | ||
| 52 | - switchSocketIp(ip,port) { | ||
| 53 | - /* if(port){ | ||
| 54 | - this.wsURL = 'ws://' + ip + ':' + port; | ||
| 55 | - }else { | ||
| 56 | - this.wsURL = 'ws://' + ip; | ||
| 57 | - }*/ | ||
| 58 | - if(port){ | ||
| 59 | - this.wsURL = GlobalConfig.websocketProtocol + ip + ':' + port; | ||
| 60 | - }else { | ||
| 61 | - this.wsURL = GlobalConfig.websocketProtocol + ip; | ||
| 62 | - } | ||
| 63 | - } | ||
| 64 | - get connected() { | ||
| 65 | - return this._connected; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - send(data) { | ||
| 69 | - if (this._connected) { | ||
| 70 | - if (data&& data.byteLength>1024) { | ||
| 71 | - loger.warn('发送到MCU的数据文件超过1k-->byteLength->', data.byteLength); | ||
| 72 | - } | ||
| 73 | - this.websocket.send(data); | ||
| 74 | - } else { | ||
| 75 | - loger.warn('WebSocket未建立连接.消息忽略'); | 22 | + constructor() { |
| 23 | + super(); | ||
| 24 | + this._connected = false; | ||
| 25 | + this._lastActiveTime = 0;//最后一次收到消息的时间 | ||
| 26 | + this._enableEverSocket = false; | ||
| 27 | + this.reConnectionCounter = 0;//重连次数 | ||
| 28 | + | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + begin(ip, port) { | ||
| 32 | + this._clearHistory(); | ||
| 33 | + loger.log('开始WebSocket应用.'); | ||
| 34 | + if (!ip) { | ||
| 35 | + loger.error('开始MCU连接->MCU连接地址无效'); | ||
| 36 | + } | ||
| 37 | + this._enableEverSocket = true; | ||
| 38 | + //this.wsURL = 'ws://' + ip + ':' + port; | ||
| 39 | + if (port) { | ||
| 40 | + this.wsURL = GlobalConfig.websocketProtocol + ip + ':' + port; | ||
| 41 | + } else { | ||
| 42 | + this.wsURL = GlobalConfig.websocketProtocol + ip; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + this._newConnection(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + end() { | ||
| 49 | + loger.log('停止WebSocket应用.'); | ||
| 50 | + this._clear(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + switchSocketIp(ip, port) { | ||
| 54 | + /* if(port){ | ||
| 55 | + this.wsURL = 'ws://' + ip + ':' + port; | ||
| 56 | + }else { | ||
| 57 | + this.wsURL = 'ws://' + ip; | ||
| 58 | + }*/ | ||
| 59 | + if (port) { | ||
| 60 | + this.wsURL = GlobalConfig.websocketProtocol + ip + ':' + port; | ||
| 61 | + } else { | ||
| 62 | + this.wsURL = GlobalConfig.websocketProtocol + ip; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + get connected() { | ||
| 67 | + return this._connected; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + send(data) { | ||
| 71 | + if (this._connected) { | ||
| 72 | + if (data) { | ||
| 73 | + let len=data.byteLength; | ||
| 74 | + if (len> 1024) { | ||
| 75 | + loger.warn('发送到MCU的数据文件超过1k-->byteLength->', len); | ||
| 76 | } | 76 | } |
| 77 | - } | ||
| 78 | - | ||
| 79 | - _setConnected(isConn = true) { | ||
| 80 | - this._connected = isConn; | ||
| 81 | - if (this._connected) { | ||
| 82 | - this._emit(EverSocket.OPEN); | ||
| 83 | - } else { | ||
| 84 | - this._emit(EverSocket.CLOSED); | 77 | + if (len>=1024*10) { |
| 78 | + loger.warn('发送到MCU的数据文件超过10k-->byteLength->', len); | ||
| 79 | + return; | ||
| 85 | } | 80 | } |
| 86 | - } | ||
| 87 | - | ||
| 88 | - _newConnection() { | ||
| 89 | - if(GlobalConfig.isHttps==true){ | ||
| 90 | - //https的时候替换所有80端口 | ||
| 91 | - this.wsURL= GlobalConfig.replacePort(this.wsURL,":80",""); | ||
| 92 | } | 81 | } |
| 93 | - this.websocket = new WebSocket(this.wsURL); | ||
| 94 | - this.websocket.binaryType = 'arraybuffer'; | ||
| 95 | - this.websocket.onopen = this._onOpen.bind(this); | ||
| 96 | - this.websocket.onclose = this._onClose.bind(this); | ||
| 97 | - this.websocket.onerror = this._onError.bind(this); | ||
| 98 | - this.websocket.onmessage = this._onMessage.bind(this); | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - _reConnection() { | ||
| 102 | - this._clear(); | ||
| 103 | - window.clearTimeout(this.reConnectionTimeout); | ||
| 104 | - this.reConnectionCounter++; | ||
| 105 | - if (this.reConnectionCounter > MCU_MAX_RECONNECTION) { | ||
| 106 | - loger.warn('MCU断线重连->已经达到最大重连次数!'); | ||
| 107 | - this._emit(EverSocket.ERROR, EverSocket.ERR_SOCKET_RECONNECT_FAILED); | ||
| 108 | - this.reConnectionCounter=0; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - this.reConnectionTimeout = window.setTimeout(() => { | ||
| 112 | - loger.log('MCU断线重连->', this.reConnectionCounter); | ||
| 113 | - window.clearTimeout(this.reConnectionTimeout); | ||
| 114 | - this._newConnection(); | ||
| 115 | - }, EverSocket.RECONN_INTERVAL); | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - _clear() { | ||
| 119 | - loger.log('WebSocket,Timers销毁'); | ||
| 120 | - window.clearInterval(this.pingTimer); | ||
| 121 | - window.clearInterval(this.pongTimer); | ||
| 122 | - window.clearInterval(this.reConnectionTimeout); | ||
| 123 | - this._setConnected(false);//先设置状态 | ||
| 124 | - this._enableEverSocket = false; | ||
| 125 | - if (this.websocket == null) { | ||
| 126 | - loger.log('WebSocket,Timers已经销毁'); | ||
| 127 | - return; | ||
| 128 | - } | ||
| 129 | - this.websocket.onopen = undefined; | ||
| 130 | - this.websocket.onclose = undefined; | ||
| 131 | - this.websocket.onerror = undefined; | ||
| 132 | - this.websocket.onmessage = undefined; | ||
| 133 | - try { | ||
| 134 | - this.websocket.close(); | ||
| 135 | - } catch (e) { | ||
| 136 | - loger.log('ignore errors'); | ||
| 137 | - } | ||
| 138 | - this.websocket = undefined; | ||
| 139 | - | ||
| 140 | - } | ||
| 141 | - _clearHistory(){ | ||
| 142 | - loger.log('WebSocket->清除记录'); | ||
| 143 | - window.clearInterval(this.pingTimer); | ||
| 144 | - window.clearInterval(this.pongTimer); | ||
| 145 | - window.clearInterval(this.reConnectionTimeout); | ||
| 146 | - //this._setConnected(false);//先设置状态 | ||
| 147 | - this._connected = false; | ||
| 148 | - this._enableEverSocket = false; | ||
| 149 | - if (this.websocket == null) { | ||
| 150 | - loger.log('WebSocket->已经销毁'); | ||
| 151 | - return; | ||
| 152 | - } | ||
| 153 | - this.websocket.onopen = undefined; | ||
| 154 | - this.websocket.onclose = undefined; | ||
| 155 | - this.websocket.onerror = undefined; | ||
| 156 | - this.websocket.onmessage = undefined; | ||
| 157 | - try { | ||
| 158 | - this.websocket.close(); | ||
| 159 | - } catch (e) { | ||
| 160 | - loger.log('ignore errors'); | ||
| 161 | - } | ||
| 162 | - this.websocket = undefined; | ||
| 163 | - } | ||
| 164 | - _onOpen() { | ||
| 165 | - loger.log('WebSocket建立成功', this.wsURL); | ||
| 166 | - this.reConnectionCounter = 0; | ||
| 167 | - | ||
| 168 | - //启动心跳,检查socket链接状态 | ||
| 169 | - this.pingTimer = window.setInterval(this._sendPingHandler.bind(this), EverSocket.PING_INTERVAL); | ||
| 170 | - this.pongTimer = window.setInterval(this._checkPongHandler.bind(this), EverSocket.PONG_INTERVAL); | ||
| 171 | - | ||
| 172 | - this._setConnected(); | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - _onClose(closeEvent) { | ||
| 176 | - loger.log(`WebSocket连接断开 CODE:${closeEvent.code} REASON:${closeEvent.reason} CLEAN: ${closeEvent.wasClean}`, this.wsURL); | ||
| 177 | - this._reConnection(); | ||
| 178 | - } | ||
| 179 | - | ||
| 180 | - _onError() { | ||
| 181 | - loger.log('WebSocket错误出现'); | ||
| 182 | - this._connected = false; | ||
| 183 | - this._reConnection(); | ||
| 184 | - } | ||
| 185 | - | ||
| 186 | - _onMessage(messageEvent) { | ||
| 187 | - this._lastActiveTime = Date.now(); | ||
| 188 | - const bufferData = messageEvent.data; | ||
| 189 | - //loger.log('RECEIVE MESSAGE-->byteLength->',bufferData.byteLength); | ||
| 190 | - if (bufferData.byteLength > 0) { | ||
| 191 | - this._emit(EverSocket.MESSAGE, bufferData); | ||
| 192 | - } | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - _sendPingHandler() { | ||
| 196 | - if (this._connected) { | ||
| 197 | - this.websocket.send(new ArrayBuffer); | ||
| 198 | - } else { | ||
| 199 | - this._reConnection(); | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - _checkPongHandler() { | ||
| 204 | - let pongTime = Date.now(); | ||
| 205 | - if (this._lastActiveTime && | ||
| 206 | - this._lastActiveTime >= pongTime - EverSocket.PONG_INTERVAL && | ||
| 207 | - this._lastActiveTime <= pongTime | ||
| 208 | - ) { | ||
| 209 | - | ||
| 210 | - } else { | ||
| 211 | - loger.warn('---服务器PINGPONG超时-----'); | ||
| 212 | - this._reConnection(); | ||
| 213 | - } | ||
| 214 | - } | 82 | + this.websocket.send(data); |
| 83 | + } else { | ||
| 84 | + loger.warn('WebSocket未建立连接.消息忽略'); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + _setConnected(isConn = true) { | ||
| 89 | + this._connected = isConn; | ||
| 90 | + if (this._connected) { | ||
| 91 | + this._emit(EverSocket.OPEN); | ||
| 92 | + } else { | ||
| 93 | + this._emit(EverSocket.CLOSED); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + _newConnection() { | ||
| 98 | + if (GlobalConfig.isHttps == true) { | ||
| 99 | + //https的时候替换所有80端口 | ||
| 100 | + this.wsURL = GlobalConfig.replacePort(this.wsURL, ":80", ""); | ||
| 101 | + } | ||
| 102 | + this.websocket = new WebSocket(this.wsURL); | ||
| 103 | + this.websocket.binaryType = 'arraybuffer'; | ||
| 104 | + this.websocket.onopen = this._onOpen.bind(this); | ||
| 105 | + this.websocket.onclose = this._onClose.bind(this); | ||
| 106 | + this.websocket.onerror = this._onError.bind(this); | ||
| 107 | + this.websocket.onmessage = this._onMessage.bind(this); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + _reConnection() { | ||
| 111 | + this._clear(); | ||
| 112 | + window.clearTimeout(this.reConnectionTimeout); | ||
| 113 | + this.reConnectionCounter++; | ||
| 114 | + if (this.reConnectionCounter > MCU_MAX_RECONNECTION) { | ||
| 115 | + loger.warn('MCU断线重连->已经达到最大重连次数!'); | ||
| 116 | + this._emit(EverSocket.ERROR, EverSocket.ERR_SOCKET_RECONNECT_FAILED); | ||
| 117 | + this.reConnectionCounter = 0; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + this.reConnectionTimeout = window.setTimeout(() => { | ||
| 121 | + loger.log('MCU断线重连->', this.reConnectionCounter); | ||
| 122 | + window.clearTimeout(this.reConnectionTimeout); | ||
| 123 | + this._newConnection(); | ||
| 124 | + }, EverSocket.RECONN_INTERVAL); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + _clear() { | ||
| 128 | + loger.log('WebSocket,Timers销毁'); | ||
| 129 | + window.clearInterval(this.pingTimer); | ||
| 130 | + window.clearInterval(this.pongTimer); | ||
| 131 | + window.clearInterval(this.reConnectionTimeout); | ||
| 132 | + this._setConnected(false);//先设置状态 | ||
| 133 | + this._enableEverSocket = false; | ||
| 134 | + if (this.websocket == null) { | ||
| 135 | + loger.log('WebSocket,Timers已经销毁'); | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + this.websocket.onopen = undefined; | ||
| 139 | + this.websocket.onclose = undefined; | ||
| 140 | + this.websocket.onerror = undefined; | ||
| 141 | + this.websocket.onmessage = undefined; | ||
| 142 | + try { | ||
| 143 | + this.websocket.close(); | ||
| 144 | + } catch (e) { | ||
| 145 | + loger.log('ignore errors'); | ||
| 146 | + } | ||
| 147 | + this.websocket = undefined; | ||
| 148 | + | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + _clearHistory() { | ||
| 152 | + loger.log('WebSocket->清除记录'); | ||
| 153 | + window.clearInterval(this.pingTimer); | ||
| 154 | + window.clearInterval(this.pongTimer); | ||
| 155 | + window.clearInterval(this.reConnectionTimeout); | ||
| 156 | + //this._setConnected(false);//先设置状态 | ||
| 157 | + this._connected = false; | ||
| 158 | + this._enableEverSocket = false; | ||
| 159 | + if (this.websocket == null) { | ||
| 160 | + loger.log('WebSocket->已经销毁'); | ||
| 161 | + return; | ||
| 162 | + } | ||
| 163 | + this.websocket.onopen = undefined; | ||
| 164 | + this.websocket.onclose = undefined; | ||
| 165 | + this.websocket.onerror = undefined; | ||
| 166 | + this.websocket.onmessage = undefined; | ||
| 167 | + try { | ||
| 168 | + this.websocket.close(); | ||
| 169 | + } catch (e) { | ||
| 170 | + loger.log('ignore errors'); | ||
| 171 | + } | ||
| 172 | + this.websocket = undefined; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + _onOpen() { | ||
| 176 | + loger.log('WebSocket建立成功', this.wsURL); | ||
| 177 | + this.reConnectionCounter = 0; | ||
| 178 | + | ||
| 179 | + //启动心跳,检查socket链接状态 | ||
| 180 | + this.pingTimer = window.setInterval(this._sendPingHandler.bind(this), EverSocket.PING_INTERVAL); | ||
| 181 | + this.pongTimer = window.setInterval(this._checkPongHandler.bind(this), EverSocket.PONG_INTERVAL); | ||
| 182 | + | ||
| 183 | + this._setConnected(); | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + _onClose(closeEvent) { | ||
| 187 | + loger.log(`WebSocket连接断开 CODE:${closeEvent.code} REASON:${closeEvent.reason} CLEAN: ${closeEvent.wasClean}`, this.wsURL); | ||
| 188 | + this._reConnection(); | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + _onError() { | ||
| 192 | + loger.log('WebSocket错误出现'); | ||
| 193 | + this._connected = false; | ||
| 194 | + this._reConnection(); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + _onMessage(messageEvent) { | ||
| 198 | + this._lastActiveTime = Date.now(); | ||
| 199 | + const bufferData = messageEvent.data; | ||
| 200 | + //loger.log('RECEIVE MESSAGE-->byteLength->',bufferData.byteLength); | ||
| 201 | + if (bufferData.byteLength > 0) { | ||
| 202 | + this._emit(EverSocket.MESSAGE, bufferData); | ||
| 203 | + } | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + _sendPingHandler() { | ||
| 207 | + if (this._connected) { | ||
| 208 | + this.websocket.send(new ArrayBuffer); | ||
| 209 | + } else { | ||
| 210 | + this._reConnection(); | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + _checkPongHandler() { | ||
| 215 | + let pongTime = Date.now(); | ||
| 216 | + if (this._lastActiveTime && | ||
| 217 | + this._lastActiveTime >= pongTime - EverSocket.PONG_INTERVAL && | ||
| 218 | + this._lastActiveTime <= pongTime | ||
| 219 | + ) { | ||
| 220 | + | ||
| 221 | + } else { | ||
| 222 | + loger.warn('---服务器PINGPONG超时-----'); | ||
| 223 | + this._reConnection(); | ||
| 224 | + } | ||
| 225 | + } | ||
| 215 | } | 226 | } |
| 216 | 227 | ||
| 217 | 228 | ||
| @@ -228,7 +239,7 @@ EverSocket.prototype.PING_INTERVAL = EverSocket.PING_INTERVAL = 10000;//心跳 | @@ -228,7 +239,7 @@ EverSocket.prototype.PING_INTERVAL = EverSocket.PING_INTERVAL = 10000;//心跳 | ||
| 228 | EverSocket.prototype.RECONN_INTERVAL = EverSocket.RECONN_INTERVAL = 5000;//重连的间隔 | 239 | EverSocket.prototype.RECONN_INTERVAL = EverSocket.RECONN_INTERVAL = 5000;//重连的间隔 |
| 229 | 240 | ||
| 230 | 241 | ||
| 231 | -EverSocket.prototype.ERR_SOCKET_RECONNECT_FAILED =EverSocket.ERR_SOCKET_RECONNECT_FAILED=20001;//MCU自动重连失败,已经达到最大重连次数 | 242 | +EverSocket.prototype.ERR_SOCKET_RECONNECT_FAILED = EverSocket.ERR_SOCKET_RECONNECT_FAILED = 20001;//MCU自动重连失败,已经达到最大重连次数 |
| 232 | 243 | ||
| 233 | EverSocket.prototype.CONNECTING = EverSocket.CONNECTING = 0; | 244 | EverSocket.prototype.CONNECTING = EverSocket.CONNECTING = 0; |
| 234 | EverSocket.prototype.OPEN = EverSocket.OPEN = 1; | 245 | EverSocket.prototype.OPEN = EverSocket.OPEN = 1; |
| @@ -62,7 +62,7 @@ class LogManager { | @@ -62,7 +62,7 @@ class LogManager { | ||
| 62 | //发送log到服务器 | 62 | //发送log到服务器 |
| 63 | static sendLogToServer(_msgType) { | 63 | static sendLogToServer(_msgType) { |
| 64 | if (!this.logUrl) { | 64 | if (!this.logUrl) { |
| 65 | - console.warn("日志服务器地址无效->无法上传日志"); | 65 | + console.warn("日志服务器地址->"+this.logUrl); |
| 66 | return; | 66 | return; |
| 67 | } | 67 | } |
| 68 | const msgType = _msgType; | 68 | const msgType = _msgType; |
| 1 | -// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | -// | ||
| 3 | -// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | -// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | -// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | -// | ||
| 7 | -// Github Home: https://github.com/AlexWang1987 | ||
| 8 | -// Author: AlexWang | ||
| 9 | -// Date: 2016-08-26 17:36:20 | ||
| 10 | -// QQ Email: 1669499355@qq.com | ||
| 11 | -// Last Modified time: 2017-06-29 14:09:25 | ||
| 12 | -// Description: LiveClass-CursorApe | ||
| 13 | -// | ||
| 14 | -// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | - | ||
| 16 | import Ape from './Ape'; | 1 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 2 | import ApeConsts from './ApeConsts'; |
| 18 | import pdu from 'pdus'; | 3 | import pdu from 'pdus'; |
| @@ -87,8 +72,6 @@ class CursorApe extends Ape { | @@ -87,8 +72,6 @@ class CursorApe extends Ape { | ||
| 87 | let adapterPdu = new pdu['RCAdapterPdu']; | 72 | let adapterPdu = new pdu['RCAdapterPdu']; |
| 88 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 73 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 89 | adapterPdu.item.push(adapterItemPdu); | 74 | adapterPdu.item.push(adapterItemPdu); |
| 90 | - | ||
| 91 | - loger.log("发送更新.itemIdx=" + tableItemPdu.itemIdx); | ||
| 92 | this.sendUniform(adapterPdu, true); | 75 | this.sendUniform(adapterPdu, true); |
| 93 | } | 76 | } |
| 94 | 77 | ||
| @@ -96,7 +79,7 @@ class CursorApe extends Ape { | @@ -96,7 +79,7 @@ class CursorApe extends Ape { | ||
| 96 | tableUpdateHandler(owner, itemIdx, itemData) { | 79 | tableUpdateHandler(owner, itemIdx, itemData) { |
| 97 | let cursorModel = this.unPackPdu(owner, itemIdx, itemData); | 80 | let cursorModel = this.unPackPdu(owner, itemIdx, itemData); |
| 98 | // loger.log('鼠标数据->tableUpdateHandler'); | 81 | // loger.log('鼠标数据->tableUpdateHandler'); |
| 99 | - loger.log(cursorModel); | 82 | + //loger.log(cursorModel); |
| 100 | if (cursorModel) { | 83 | if (cursorModel) { |
| 101 | this._emit(MessageTypes.CURSOR_UPDATE, cursorModel); | 84 | this._emit(MessageTypes.CURSOR_UPDATE, cursorModel); |
| 102 | } | 85 | } |
| @@ -587,8 +587,15 @@ class DocApe extends Ape { | @@ -587,8 +587,15 @@ class DocApe extends Ape { | ||
| 587 | //loger.log('添加文档->设置当前激活的文档id'); | 587 | //loger.log('添加文档->设置当前激活的文档id'); |
| 588 | } | 588 | } |
| 589 | let getdocPackFullInfo = this._docPackFullInfo(itemDataInfo); | 589 | let getdocPackFullInfo = this._docPackFullInfo(itemDataInfo); |
| 590 | - loger.log('添加文档->', getdocPackFullInfo); | ||
| 591 | this._emit(MessageTypes.DOC_UPDATE, getdocPackFullInfo);//用添加和更新都统一DOC_UPDATE | 590 | this._emit(MessageTypes.DOC_UPDATE, getdocPackFullInfo);//用添加和更新都统一DOC_UPDATE |
| 591 | + | ||
| 592 | + //日志输出 | ||
| 593 | + let docInfo = this._docPackFullInfo(itemDataInfo); | ||
| 594 | + if(docInfo){ | ||
| 595 | + delete docInfo.images; | ||
| 596 | + loger.log('添加文档->', docInfo); | ||
| 597 | + } | ||
| 598 | + | ||
| 592 | } else { | 599 | } else { |
| 593 | loger.warn('文档数据解析失败->删除->itemIdx:' + insertItem.itemIdx); | 600 | loger.warn('文档数据解析失败->删除->itemIdx:' + insertItem.itemIdx); |
| 594 | this.documentDelete({"itemIdx": insertItem.itemIdx}); | 601 | this.documentDelete({"itemIdx": insertItem.itemIdx}); |
| @@ -23,7 +23,7 @@ class MediaModule { | @@ -23,7 +23,7 @@ class MediaModule { | ||
| 23 | 23 | ||
| 24 | //获取播流地址 | 24 | //获取播流地址 |
| 25 | getMediaPlayPath(_param) { | 25 | getMediaPlayPath(_param) { |
| 26 | - loger.log('获取播放地址->'); | 26 | + //loger.log('获取播放地址->'); |
| 27 | if (_param == null || _param.streamId == null) { | 27 | if (_param == null || _param.streamId == null) { |
| 28 | loger.warn('获取播放地址->参数错误', _param); | 28 | loger.warn('获取播放地址->参数错误', _param); |
| 29 | //this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 29 | //this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| @@ -96,7 +96,7 @@ class MediaModule { | @@ -96,7 +96,7 @@ class MediaModule { | ||
| 96 | 96 | ||
| 97 | //获取录制回放时点播的地址,只有m3u8 | 97 | //获取录制回放时点播的地址,只有m3u8 |
| 98 | getMediaRecordPlaybackPath(_param) { | 98 | getMediaRecordPlaybackPath(_param) { |
| 99 | - loger.log('获取录制回放时点播的地址->m3u8'); | 99 | + //loger.log('获取录制回放时点播的地址->m3u8'); |
| 100 | if (_param == null || _param.streamId == null) { | 100 | if (_param == null || _param.streamId == null) { |
| 101 | loger.warn('获取录制回放时点播的地址->参数错误', _param); | 101 | loger.warn('获取录制回放时点播的地址->参数错误', _param); |
| 102 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | 102 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| @@ -119,8 +119,7 @@ class MediaSharedApe extends Ape { | @@ -119,8 +119,7 @@ class MediaSharedApe extends Ape { | ||
| 119 | //把总时间取出来,外部更新的时候不传这个值 | 119 | //把总时间取出来,外部更新的时候不传这个值 |
| 120 | _pduDataModel.duration=localDataItem.duration||0; | 120 | _pduDataModel.duration=localDataItem.duration||0; |
| 121 | } | 121 | } |
| 122 | - | ||
| 123 | - loger.log("发送媒体文件->更新 ", _pduDataModel); | 122 | + //loger.log("发送媒体文件->更新 ", _pduDataModel); |
| 124 | 123 | ||
| 125 | let pduDataModel = this.packPdu(_pduDataModel, _itemIdx); | 124 | let pduDataModel = this.packPdu(_pduDataModel, _itemIdx); |
| 126 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | 125 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; |
| @@ -119,7 +119,7 @@ class MusicSharedApe extends Ape { | @@ -119,7 +119,7 @@ class MusicSharedApe extends Ape { | ||
| 119 | //把总时间取出来,外部更新的时候不传这个值 | 119 | //把总时间取出来,外部更新的时候不传这个值 |
| 120 | _pduDataModel.duration=localDataItem.duration||0; | 120 | _pduDataModel.duration=localDataItem.duration||0; |
| 121 | } | 121 | } |
| 122 | - loger.log("发送伴音文件->更新 ", _pduDataModel); | 122 | + // loger.log("发送伴音文件->更新 ", _pduDataModel); |
| 123 | 123 | ||
| 124 | let pduDataModel = this.packPdu(_pduDataModel, _itemIdx); | 124 | let pduDataModel = this.packPdu(_pduDataModel, _itemIdx); |
| 125 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | 125 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; |
| @@ -228,7 +228,7 @@ class VideoApe extends Ape { | @@ -228,7 +228,7 @@ class VideoApe extends Ape { | ||
| 228 | } | 228 | } |
| 229 | //推流状态发生改变 | 229 | //推流状态发生改变 |
| 230 | mediaPublishStatusChange(_data){ | 230 | mediaPublishStatusChange(_data){ |
| 231 | - loger.log("推流状态发生改变->",_data); | 231 | + //loger.log("推流状态发生改变->",_data); |
| 232 | this.sendVideoBroadcastMsg({ | 232 | this.sendVideoBroadcastMsg({ |
| 233 | "actionType": ApeConsts.MEDIA_ACTION_PUBLISH_STATUS, | 233 | "actionType": ApeConsts.MEDIA_ACTION_PUBLISH_STATUS, |
| 234 | "toNodeId": 0, | 234 | "toNodeId": 0, |
| @@ -458,7 +458,7 @@ class WebRtcApe extends Emiter { | @@ -458,7 +458,7 @@ class WebRtcApe extends Emiter { | ||
| 458 | } | 458 | } |
| 459 | //根据nodeId查找视频 | 459 | //根据nodeId查找视频 |
| 460 | try { | 460 | try { |
| 461 | - loger.log("立即删除停止推流人员的视图"); | 461 | + //loger.log("立即删除停止推流人员的视图"); |
| 462 | $('#' + this.xdyRemote + _data.nodeId).remove(); | 462 | $('#' + this.xdyRemote + _data.nodeId).remove(); |
| 463 | } catch (err) { | 463 | } catch (err) { |
| 464 | 464 |
-
请 注册 或 登录 后发表评论