正在显示
10 个修改的文件
包含
234 行增加
和
21 行删除
此 diff 太大无法显示。
| @@ -27,7 +27,7 @@ let _confer_ape; | @@ -27,7 +27,7 @@ let _confer_ape; | ||
| 27 | let _chat_ape; | 27 | let _chat_ape; |
| 28 | let _video_ape; | 28 | let _video_ape; |
| 29 | let _doc_ape; | 29 | let _doc_ape; |
| 30 | -let _wb_ape; | 30 | +let _whiteboard_ape; |
| 31 | 31 | ||
| 32 | //初始化成功回调函数 | 32 | //初始化成功回调函数 |
| 33 | let _initSuccessCallBackFun; | 33 | let _initSuccessCallBackFun; |
| @@ -84,18 +84,25 @@ export default class MessageEntrance extends Emiter { | @@ -84,18 +84,25 @@ export default class MessageEntrance extends Emiter { | ||
| 84 | _doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this)); | 84 | _doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this)); |
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | - _wb_ape = new WhiteBoardApe(); | ||
| 88 | - _wb_ape.on('*', (type, data) => this._emit(type, data)); | ||
| 89 | - _wb_ape.on(MessageTypes.ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this)); | 87 | + _whiteboard_ape = new WhiteBoardApe(); |
| 88 | + _whiteboard_ape.on('*', (type, data) => this._emit(type, data)); | ||
| 89 | + _whiteboard_ape.on(MessageTypes.ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this)); | ||
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | //公开外部调用的方法 | 92 | //公开外部调用的方法 |
| 93 | + //class | ||
| 93 | this.init=this._init; | 94 | this.init=this._init; |
| 94 | this.joinClass=this._joinClass; | 95 | this.joinClass=this._joinClass; |
| 95 | this.leaveClass=this._leaveClass; | 96 | this.leaveClass=this._leaveClass; |
| 96 | - this.sendChatMsg=this._sendChatMsg; | ||
| 97 | - this.setDebugData=this._setDebugData; | ||
| 98 | this.mcuClientStatus=this._mcuClientStatus; | 97 | this.mcuClientStatus=this._mcuClientStatus; |
| 98 | + | ||
| 99 | + //ape | ||
| 100 | + this.sendChatMsg=this._sendChatMsg; | ||
| 101 | + this.playVideoPath=this._playVideoPath; | ||
| 102 | + this.publishVideoPath=this._publishVideoPath; | ||
| 103 | + this.sendAnnotaion=this._sendAnnotaion; | ||
| 104 | + //debug | ||
| 105 | + //this.setDebugData=this._setDebugData; | ||
| 99 | } | 106 | } |
| 100 | 107 | ||
| 101 | 108 | ||
| @@ -169,6 +176,9 @@ export default class MessageEntrance extends Emiter { | @@ -169,6 +176,9 @@ export default class MessageEntrance extends Emiter { | ||
| 169 | } | 176 | } |
| 170 | // 离开会议 | 177 | // 离开会议 |
| 171 | _leaveClass() { | 178 | _leaveClass() { |
| 179 | + if(_confer_ape){ | ||
| 180 | + _confer_ape.leaveClass(); | ||
| 181 | + } | ||
| 172 | if(_mcu){ | 182 | if(_mcu){ |
| 173 | _mcu.leaveMCU(); | 183 | _mcu.leaveMCU(); |
| 174 | GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_3); | 184 | GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_3); |
| @@ -229,7 +239,7 @@ export default class MessageEntrance extends Emiter { | @@ -229,7 +239,7 @@ export default class MessageEntrance extends Emiter { | ||
| 229 | _h5SassGetMeetingParaSuccessHandler(_data){ | 239 | _h5SassGetMeetingParaSuccessHandler(_data){ |
| 230 | loger.log('获取getMeetingParam完成.'); | 240 | loger.log('获取getMeetingParam完成.'); |
| 231 | GlobalConfig.meetingParam=_data; | 241 | GlobalConfig.meetingParam=_data; |
| 232 | - loger.log(GlobalConfig.meetingParam); | 242 | + // loger.log(GlobalConfig.meetingParam); |
| 233 | } | 243 | } |
| 234 | 244 | ||
| 235 | // MCU 会议成功 | 245 | // MCU 会议成功 |
| @@ -274,6 +284,38 @@ export default class MessageEntrance extends Emiter { | @@ -274,6 +284,38 @@ export default class MessageEntrance extends Emiter { | ||
| 274 | } | 284 | } |
| 275 | } | 285 | } |
| 276 | 286 | ||
| 287 | + //VidoeApe | ||
| 288 | + _playVideoPath(_param){ | ||
| 289 | + if(_video_ape){ | ||
| 290 | + return _video_ape.playVideoPath(_param); | ||
| 291 | + }else { | ||
| 292 | + return {"code":1,"data":"获取播放地址失败"}; | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + _publishVideoPath(_param){ | ||
| 297 | + if(_video_ape){ | ||
| 298 | + return _video_ape.publishVideoPath(_param); | ||
| 299 | + }else { | ||
| 300 | + return {"code":1,"data":"获取推流地址失败"}; | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + //WhiteBoardApe | ||
| 305 | + // 添加标注,发送信息 | ||
| 306 | + _sendAnnotaion(_param){ | ||
| 307 | + if(_whiteboard_ape){ | ||
| 308 | + _whiteboard_ape.sendAnnotaion(_param); | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + //删除标注,发送信息 | ||
| 312 | + _deleteAnnotaion(_param){ | ||
| 313 | + if(_whiteboard_ape){ | ||
| 314 | + _whiteboard_ape.deleteAnnotaion(_param); | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + | ||
| 277 | // 白板笔记更新(svg) | 319 | // 白板笔记更新(svg) |
| 278 | annoUpdateHandler(annoInfo) { | 320 | annoUpdateHandler(annoInfo) { |
| 279 | const activeDocId = _confer_ape.activeDocId; | 321 | const activeDocId = _confer_ape.activeDocId; |
| @@ -286,7 +328,7 @@ export default class MessageEntrance extends Emiter { | @@ -286,7 +328,7 @@ export default class MessageEntrance extends Emiter { | ||
| 286 | // 文档变更-笔记处理 | 328 | // 文档变更-笔记处理 |
| 287 | docShowHandler(docItem) { | 329 | docShowHandler(docItem) { |
| 288 | loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo); | 330 | loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo); |
| 289 | - const annoInfo = _wb_ape.annoInfos[docItem.wbid]; | 331 | + const annoInfo = _whiteboard_ape.annoInfos[docItem.wbid]; |
| 290 | if (annoInfo) { | 332 | if (annoInfo) { |
| 291 | this._emit(MessageTypes.DOC_ANNOTATION, annoInfo); | 333 | this._emit(MessageTypes.DOC_ANNOTATION, annoInfo); |
| 292 | } else { | 334 | } else { |
| @@ -101,4 +101,22 @@ GlobalConfig.deBugData={}; | @@ -101,4 +101,22 @@ GlobalConfig.deBugData={}; | ||
| 101 | GlobalConfig.meetingParam={}; | 101 | GlobalConfig.meetingParam={}; |
| 102 | GlobalConfig.classDetail={}; | 102 | GlobalConfig.classDetail={}; |
| 103 | 103 | ||
| 104 | + | ||
| 105 | +// client type | ||
| 106 | +//点对点会议版本 | ||
| 107 | + GlobalConfig.CT_P2PMEETING = 0; | ||
| 108 | +/** | ||
| 109 | + * 直播教育版本和大型直播版本 | ||
| 110 | + */ | ||
| 111 | +GlobalConfig.CT_LIVEEDUCATION = 1; | ||
| 112 | +/** | ||
| 113 | + * 录制播放器 | ||
| 114 | + */ | ||
| 115 | +GlobalConfig.CT_RECORDPLAYER = 2; | ||
| 116 | +/** | ||
| 117 | + * 实时流版本 | ||
| 118 | + */ | ||
| 119 | +GlobalConfig. CT_LIVESTREAMING = 3; | ||
| 120 | +GlobalConfig.clientType =0; | ||
| 121 | + | ||
| 104 | export default GlobalConfig; | 122 | export default GlobalConfig; |
| @@ -62,6 +62,7 @@ export default class Ape extends Emiter { | @@ -62,6 +62,7 @@ export default class Ape extends Emiter { | ||
| 62 | 62 | ||
| 63 | // 消息处理 | 63 | // 消息处理 |
| 64 | _pduMessageHandler(regBuffer) { | 64 | _pduMessageHandler(regBuffer) { |
| 65 | + console.log("RCPDU_REG_ADAPTER=========================================="); | ||
| 65 | if (this._apeDelayed) { | 66 | if (this._apeDelayed) { |
| 66 | // this._apeDelayedMsgs.push(regBuffer); | 67 | // this._apeDelayedMsgs.push(regBuffer); |
| 67 | // this._apeDelayedStart(); | 68 | // this._apeDelayedStart(); |
| @@ -105,6 +106,8 @@ export default class Ape extends Emiter { | @@ -105,6 +106,8 @@ export default class Ape extends Emiter { | ||
| 105 | let regItemType = regItem.type; | 106 | let regItemType = regItem.type; |
| 106 | let regItemData = regItem.itemData; | 107 | let regItemData = regItem.itemData; |
| 107 | 108 | ||
| 109 | + //根据数据包中的type处理数据是否同步 | ||
| 110 | + | ||
| 108 | if (pdu.RCPDU_REG_UPDATE_OBJ !== regItemType) { | 111 | if (pdu.RCPDU_REG_UPDATE_OBJ !== regItemType) { |
| 109 | if (pdu.RCPDU_REG_RESPONSE_OBJ == regItemType) { | 112 | if (pdu.RCPDU_REG_RESPONSE_OBJ == regItemType) { |
| 110 | let regResponsePdu = pdu['RCRegistryResponseObjPdu'].decode(regItemData); | 113 | let regResponsePdu = pdu['RCRegistryResponseObjPdu'].decode(regItemData); |
| @@ -114,6 +117,7 @@ export default class Ape extends Emiter { | @@ -114,6 +117,7 @@ export default class Ape extends Emiter { | ||
| 114 | continue; | 117 | continue; |
| 115 | } | 118 | } |
| 116 | 119 | ||
| 120 | + //具体的数据包 | ||
| 117 | let regUpdatedItem = pdu['RCRegistryUpdateObjPdu'].decode(regItemData); | 121 | let regUpdatedItem = pdu['RCRegistryUpdateObjPdu'].decode(regItemData); |
| 118 | let sub_type = regUpdatedItem.subType; | 122 | let sub_type = regUpdatedItem.subType; |
| 119 | let object_id = regUpdatedItem.objId; | 123 | let object_id = regUpdatedItem.objId; |
| @@ -38,14 +38,13 @@ class ChatApe extends Ape { | @@ -38,14 +38,13 @@ class ChatApe extends Ape { | ||
| 38 | this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this)); | 38 | this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this)); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | - //chatMsgIncomingHandler(pdus) { | ||
| 42 | - // | ||
| 43 | - //} | ||
| 44 | - | ||
| 45 | sendChatMsg(_messageInfo) { | 41 | sendChatMsg(_messageInfo) { |
| 46 | if(this._confInfo===null||EngineUtils.isEmptyObject(this._confInfo)){ | 42 | if(this._confInfo===null||EngineUtils.isEmptyObject(this._confInfo)){ |
| 47 | loger.log('不能发送聊天消息.McuClient还未初始化数据!'); | 43 | loger.log('不能发送聊天消息.McuClient还未初始化数据!'); |
| 48 | - this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_SEND_FAILED_NO_JOIN); | 44 | + if(GlobalConfig.getCurrentStatus().code==0||GlobalConfig.getCurrentStatus().code==1){ |
| 45 | + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_SEND_FAILED_NO_JOIN); | ||
| 46 | + return; | ||
| 47 | + } | ||
| 49 | return ; | 48 | return ; |
| 50 | } | 49 | } |
| 51 | 50 |
| @@ -20,6 +20,8 @@ import pdu from 'pdus'; | @@ -20,6 +20,8 @@ import pdu from 'pdus'; | ||
| 20 | import { Zlib } from 'zlibjs/bin/zlib.min'; | 20 | import { Zlib } from 'zlibjs/bin/zlib.min'; |
| 21 | import UTF8 from 'utf-8'; | 21 | import UTF8 from 'utf-8'; |
| 22 | import Loger from 'Loger'; | 22 | import Loger from 'Loger'; |
| 23 | +import GlobalConfig from 'GlobalConfig'; | ||
| 24 | + | ||
| 23 | let loger = Loger.getLoger('ConferApe'); | 25 | let loger = Loger.getLoger('ConferApe'); |
| 24 | 26 | ||
| 25 | class ConferApe extends Ape { | 27 | class ConferApe extends Ape { |
| @@ -38,12 +40,16 @@ class ConferApe extends Ape { | @@ -38,12 +40,16 @@ class ConferApe extends Ape { | ||
| 38 | 40 | ||
| 39 | // Ape Models | 41 | // Ape Models |
| 40 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | 42 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); |
| 43 | + | ||
| 41 | this.registerObj(pdu.RCPDU_REG_REGISTER_ROSTER, ApeConsts.CONFERENCE_OBJ_ROSTER_ID, | 44 | this.registerObj(pdu.RCPDU_REG_REGISTER_ROSTER, ApeConsts.CONFERENCE_OBJ_ROSTER_ID, |
| 42 | ApeConsts.CONFERENCE_OBJ_ROSTER_NAME, ApeConsts.CONFERENCE_OBJ_ROSTER_TAG, 0, new ArrayBuffer); | 45 | ApeConsts.CONFERENCE_OBJ_ROSTER_NAME, ApeConsts.CONFERENCE_OBJ_ROSTER_TAG, 0, new ArrayBuffer); |
| 46 | + | ||
| 43 | this.registerObj(pdu.RCPDU_REG_REGISTER_QUEUE, ApeConsts.CONFERENCE_OBJ_QUEUE_ID, | 47 | this.registerObj(pdu.RCPDU_REG_REGISTER_QUEUE, ApeConsts.CONFERENCE_OBJ_QUEUE_ID, |
| 44 | ApeConsts.CONFERENCE_OBJ_QUEUE_NAME, ApeConsts.CONFERENCE_OBJ_QUEUE_TAG, 0, new ArrayBuffer); | 48 | ApeConsts.CONFERENCE_OBJ_QUEUE_NAME, ApeConsts.CONFERENCE_OBJ_QUEUE_TAG, 0, new ArrayBuffer); |
| 49 | + | ||
| 45 | this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_TABLE_ID, | 50 | this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_TABLE_ID, |
| 46 | ApeConsts.CONFERENCE_OBJ_TABLE_NAME, ApeConsts.CONFERENCE_OBJ_TABLE_TAG, 0, new ArrayBuffer); | 51 | ApeConsts.CONFERENCE_OBJ_TABLE_NAME, ApeConsts.CONFERENCE_OBJ_TABLE_TAG, 0, new ArrayBuffer); |
| 52 | + | ||
| 47 | this.registerObj(pdu.RCPDU_REG_REGISTER_COUNTER, ApeConsts.CONFERENCE_OBJ_COUNTER_ID, | 53 | this.registerObj(pdu.RCPDU_REG_REGISTER_COUNTER, ApeConsts.CONFERENCE_OBJ_COUNTER_ID, |
| 48 | ApeConsts.CONFERENCE_OBJ_COUNTER_NAME, ApeConsts.CONFERENCE_OBJ_COUNTER_TAG, 0, new ArrayBuffer); | 54 | ApeConsts.CONFERENCE_OBJ_COUNTER_NAME, ApeConsts.CONFERENCE_OBJ_COUNTER_TAG, 0, new ArrayBuffer); |
| 49 | 55 | ||
| @@ -52,7 +58,7 @@ class ConferApe extends Ape { | @@ -52,7 +58,7 @@ class ConferApe extends Ape { | ||
| 52 | 58 | ||
| 53 | _joinSessionHandler(confInfo) { | 59 | _joinSessionHandler(confInfo) { |
| 54 | let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self; | 60 | let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self; |
| 55 | - | 61 | + loger.log("_joinSessionHandler nodeInfoRecordPdu=",nodeInfoRecordPdu); |
| 56 | let userDataPdu = new pdu['RCNodeInfoUserDataPdu']; | 62 | let userDataPdu = new pdu['RCNodeInfoUserDataPdu']; |
| 57 | userDataPdu.qq = ''; | 63 | userDataPdu.qq = ''; |
| 58 | userDataPdu.skype = ''; | 64 | userDataPdu.skype = ''; |
| @@ -74,6 +80,7 @@ class ConferApe extends Ape { | @@ -74,6 +80,7 @@ class ConferApe extends Ape { | ||
| 74 | updateObjPdu.subType = rosterUpdateItem.type; | 80 | updateObjPdu.subType = rosterUpdateItem.type; |
| 75 | updateObjPdu.userData = rosterUpdateItem.toArrayBuffer(); | 81 | updateObjPdu.userData = rosterUpdateItem.toArrayBuffer(); |
| 76 | 82 | ||
| 83 | + //同步 | ||
| 77 | let adapterItemPdu = new pdu['RCAdapterItemPdu']; | 84 | let adapterItemPdu = new pdu['RCAdapterItemPdu']; |
| 78 | adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | 85 | adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; |
| 79 | adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | 86 | adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); |
| @@ -84,11 +91,45 @@ class ConferApe extends Ape { | @@ -84,11 +91,45 @@ class ConferApe extends Ape { | ||
| 84 | 91 | ||
| 85 | this.sendUniform(adapterPdu, true); | 92 | this.sendUniform(adapterPdu, true); |
| 86 | 93 | ||
| 87 | - | ||
| 88 | } | 94 | } |
| 89 | 95 | ||
| 96 | + //主动离开会议,发送通知到服务器 | ||
| 97 | + leaveClass(){ | ||
| 98 | + let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self; | ||
| 99 | + let userDataPdu = new pdu['RCNodeInfoUserDataPdu']; | ||
| 100 | + userDataPdu.qq = ''; | ||
| 101 | + userDataPdu.skype = ''; | ||
| 102 | + userDataPdu.mobile = ''; | ||
| 103 | + | ||
| 104 | + nodeInfoRecordPdu.userData = userDataPdu.toArrayBuffer(); | ||
| 105 | + nodeInfoRecordPdu.deviceType = 3; | ||
| 106 | + | ||
| 107 | + let item = new pdu['RCRegistryRosterItemPdu']; | ||
| 108 | + item.nodeId = nodeInfoRecordPdu.nodeId; | ||
| 109 | + item.nodeData = nodeInfoRecordPdu.toArrayBuffer(); | ||
| 110 | + | ||
| 111 | + let rosterUpdateItem = new pdu['RCRegistryRosterDeleteItemPdu']; | ||
| 112 | + rosterUpdateItem.type = pdu.RCPDU_REG_ROSTER_DELETE_PDU; | ||
| 113 | + rosterUpdateItem.nodeId=GlobalConfig.nodeId; | ||
| 114 | + | ||
| 115 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 116 | + updateObjPdu.objId = ApeConsts.CONFERENCE_OBJ_ROSTER_ID; | ||
| 117 | + updateObjPdu.subType = rosterUpdateItem.type; | ||
| 118 | + updateObjPdu.userData = rosterUpdateItem.toArrayBuffer(); | ||
| 119 | + | ||
| 120 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 121 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 122 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 123 | + | ||
| 124 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 125 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 126 | + adapterPdu.item.push(adapterItemPdu); | ||
| 127 | + | ||
| 128 | + this.sendUniform(adapterPdu, true); | ||
| 129 | + } | ||
| 90 | 130 | ||
| 91 | tableUpdateHandler(owner, recordId, recordData) { | 131 | tableUpdateHandler(owner, recordId, recordData) { |
| 132 | + loger.log("更新人员列表数据 tableUpdateHandler"); | ||
| 92 | try { | 133 | try { |
| 93 | let tabUpdatePdu = pdu.RCTabUpdateDataRequestPdu.decode(recordData); | 134 | let tabUpdatePdu = pdu.RCTabUpdateDataRequestPdu.decode(recordData); |
| 94 | const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress(); | 135 | const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress(); |
| @@ -107,13 +148,14 @@ class ConferApe extends Ape { | @@ -107,13 +148,14 @@ class ConferApe extends Ape { | ||
| 107 | 148 | ||
| 108 | 149 | ||
| 109 | rosterInsertHandler(nodeId, nodeData) { | 150 | rosterInsertHandler(nodeId, nodeData) { |
| 151 | + loger.log("更新人员列表数据 rosterInsertHandler"); | ||
| 110 | this.rosterUpdateHandler(nodeId, nodeData); | 152 | this.rosterUpdateHandler(nodeId, nodeData); |
| 111 | } | 153 | } |
| 112 | 154 | ||
| 113 | //更新人员列表数据 | 155 | //更新人员列表数据 |
| 114 | rosterUpdateHandler(nodeId, nodeData) { | 156 | rosterUpdateHandler(nodeId, nodeData) { |
| 115 | 157 | ||
| 116 | - //loger.log("更新人员列表数据",nodeId,userDataObj); | 158 | + loger.log("更新人员列表数据 rosterUpdateHandler"); |
| 117 | if (nodeData.role === ApeConsts.NR_MASTER || | 159 | if (nodeData.role === ApeConsts.NR_MASTER || |
| 118 | nodeData.role === ApeConsts.NR_SLAVE) { | 160 | nodeData.role === ApeConsts.NR_SLAVE) { |
| 119 | this.hostNodeId = nodeData.nodeId; | 161 | this.hostNodeId = nodeData.nodeId; |
| @@ -133,11 +175,14 @@ class ConferApe extends Ape { | @@ -133,11 +175,14 @@ class ConferApe extends Ape { | ||
| 133 | loger.log("更新人员列表数据",{"nodeId":nodeId}); | 175 | loger.log("更新人员列表数据",{"nodeId":nodeId}); |
| 134 | this._emit(MessageTypes.CLASS_INSERT_ROSTER, {"nodeId":nodeId,"nodeData":newNodeData}); | 176 | this._emit(MessageTypes.CLASS_INSERT_ROSTER, {"nodeId":nodeId,"nodeData":newNodeData}); |
| 135 | this.emitRosterChange(); | 177 | this.emitRosterChange(); |
| 178 | + }else { | ||
| 179 | + loger.log("更新人员列表数据,rosterExists已经存在",rosterExists); | ||
| 136 | } | 180 | } |
| 137 | } | 181 | } |
| 138 | 182 | ||
| 139 | //删除用户 | 183 | //删除用户 |
| 140 | rosterDelHandler(nodeId) { | 184 | rosterDelHandler(nodeId) { |
| 185 | + loger.log("更新人员列表数据 rosterDelHandler"); | ||
| 141 | delete this.rosters[nodeId]; | 186 | delete this.rosters[nodeId]; |
| 142 | this._emit(MessageTypes.CLASS_DELETE_ROSTER, {"nodeId":nodeId}); | 187 | this._emit(MessageTypes.CLASS_DELETE_ROSTER, {"nodeId":nodeId}); |
| 143 | this.emitRosterChange(); | 188 | this.emitRosterChange(); |
| @@ -46,6 +46,15 @@ class VideoChat extends Ape { | @@ -46,6 +46,15 @@ class VideoChat extends Ape { | ||
| 46 | this.on(pdu.RCPDU_VIDEO_SEND_DATA_REQUEST, this.videoIncomingHandler.bind(this)); | 46 | this.on(pdu.RCPDU_VIDEO_SEND_DATA_REQUEST, this.videoIncomingHandler.bind(this)); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | + //获取播流地址 | ||
| 50 | + playVideoPath(_param){ | ||
| 51 | + return {"code":0,"data":"播放流地址XXXXXXXXXXXXXXXXXXXXX"}; | ||
| 52 | + } | ||
| 53 | + //获取推流地址 | ||
| 54 | + publishVideoPath(_param){ | ||
| 55 | + return {"code":0,"data":"推流地址XXXXXXXXXXXXXXXXXXXXXXX"}; | ||
| 56 | + } | ||
| 57 | + | ||
| 49 | // 视频消息处理 | 58 | // 视频消息处理 |
| 50 | videoIncomingHandler(videoBuffer) { | 59 | videoIncomingHandler(videoBuffer) { |
| 51 | let videoReceivePdu = pdu['VideoSendDataRequestPdu'].decode(videoBuffer); | 60 | let videoReceivePdu = pdu['VideoSendDataRequestPdu'].decode(videoBuffer); |
| @@ -101,7 +110,6 @@ class VideoChat extends Ape { | @@ -101,7 +110,6 @@ class VideoChat extends Ape { | ||
| 101 | } | 110 | } |
| 102 | 111 | ||
| 103 | emitVideoChange() { | 112 | emitVideoChange() { |
| 104 | - | ||
| 105 | this._emit(MessageTypes.VIDEO_RECEIVE, { | 113 | this._emit(MessageTypes.VIDEO_RECEIVE, { |
| 106 | activeChannelId: this.activeChannelId, | 114 | activeChannelId: this.activeChannelId, |
| 107 | HLSURL: this.activeURL, | 115 | HLSURL: this.activeURL, |
| @@ -20,6 +20,7 @@ import Loger from 'Loger'; | @@ -20,6 +20,7 @@ import Loger from 'Loger'; | ||
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | import { Zlib } from 'zlibjs/bin/zlib.min'; | 21 | import { Zlib } from 'zlibjs/bin/zlib.min'; |
| 22 | import UTF8 from 'utf-8'; | 22 | import UTF8 from 'utf-8'; |
| 23 | +import GlobalConfig from 'GlobalConfig'; | ||
| 23 | 24 | ||
| 24 | let loger = Loger.getLoger('WhiteBoardApe'); | 25 | let loger = Loger.getLoger('WhiteBoardApe'); |
| 25 | 26 | ||
| @@ -45,16 +46,111 @@ class WhiteBoardApe extends Ape { | @@ -45,16 +46,111 @@ class WhiteBoardApe extends Ape { | ||
| 45 | this._apeDelayed = true; | 46 | this._apeDelayed = true; |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 49 | + // 添加标注,发送信息 | ||
| 50 | + sendAnnotaion(_param){ | ||
| 51 | + //var objPoint={ | ||
| 52 | + // "type":0, | ||
| 53 | + // "id":111111, | ||
| 54 | + // "color":0, | ||
| 55 | + // "thickness":0, | ||
| 56 | + // "radius":0, | ||
| 57 | + // "text":0, | ||
| 58 | + // "fontS":0, | ||
| 59 | + // "fontN":0, | ||
| 60 | + // "pointD":[] | ||
| 61 | + //}; | ||
| 62 | + | ||
| 63 | + //message RCWhiteboardDataRequest2Pdu { | ||
| 64 | + // required uint32 id = 1; | ||
| 65 | + // required uint32 type = 2; | ||
| 66 | + // required uint32 initiator = 3; | ||
| 67 | + // required bytes drawData = 4; | ||
| 68 | + //} | ||
| 69 | + //message RCWhiteboardCurveLinePdu { | ||
| 70 | + // required uint32 color = 1; | ||
| 71 | + // required uint32 thickness = 2; | ||
| 72 | + // required string pointData = 3; | ||
| 73 | + //} | ||
| 74 | + // | ||
| 75 | + //var coverLine=new pdu['RCWhiteboardCurveLinePdu']; | ||
| 76 | + //coverLine.color=0xff00ff; | ||
| 77 | + //coverLine.thickness=2; | ||
| 78 | + //coverLine.pointData="白板数据测试测试"; | ||
| 79 | + // | ||
| 80 | + //var sendData=new pdu['RCWhiteboardDataRequest2Pdu']; | ||
| 81 | + //sendData.id=parseInt(Date.now() / 1000); | ||
| 82 | + //sendData.type=pdu.RCPDU_AUDIO_SEND_DATA_REQUEST; | ||
| 83 | + //sendData.initiator = this._confInfo.nodeId;//发起人 | ||
| 84 | + //sendData.peer = parseInt(101);//发送给谁,公聊的时候是0,私聊的时候是指定的用户id | ||
| 85 | + //sendData.isPublic = true; | ||
| 86 | + //sendData.drawData=coverLine.toArrayBuffer(); | ||
| 87 | + //console.log("白板发送数据============================="); | ||
| 88 | + //this.sendUniform(sendData); | ||
| 89 | + | ||
| 90 | + let chatSendPdu = new pdu['RCChatSendDataRequestPdu']; | ||
| 91 | + chatSendPdu.type = pdu.RCPDU_CONFERENCE_SEND_DATA_REQUEST; | ||
| 92 | + chatSendPdu.initiator = this._confInfo.nodeId;//发起人 | ||
| 93 | + chatSendPdu.peer = parseInt(0);//发送给谁,公聊的时候是0,私聊的时候是指定的用户id | ||
| 94 | + chatSendPdu.isPublic = true; | ||
| 95 | + chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" +"白板测试"); | ||
| 96 | + chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName); | ||
| 97 | + chatSendPdu.fromRole = this._confInfo.classRole; | ||
| 98 | + | ||
| 99 | + //同步 | ||
| 100 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 101 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 102 | + adapterItemPdu.itemData = chatSendPdu.toArrayBuffer(); | ||
| 103 | + | ||
| 104 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 105 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 106 | + adapterPdu.item.push(adapterItemPdu); | ||
| 107 | + | ||
| 108 | + console.log("白板发送数据=============================QQ"); | ||
| 109 | + this.sendUniform(adapterPdu, true); | ||
| 110 | + | ||
| 111 | + | ||
| 112 | + | ||
| 113 | + // this.sendUniform(chatSendPdu); | ||
| 114 | + //if (!(chatSendPdu.isPublic || 0 === chatSendPdu.peer)) { | ||
| 115 | + // //发送给制定的人 | ||
| 116 | + // this.send(chatSendPdu); | ||
| 117 | + //} else { | ||
| 118 | + // //发送给所有人 | ||
| 119 | + // this.sendUniform(chatSendPdu); | ||
| 120 | + //} | ||
| 121 | + } | ||
| 122 | + //删除标注,发送信息 | ||
| 123 | + deleteAnnotaion(_param){ | ||
| 124 | + } | ||
| 125 | + | ||
| 48 | whiteboardMsgComingHandler(pdu) { | 126 | whiteboardMsgComingHandler(pdu) { |
| 49 | - loger.warn('whiteboardMsgComingHandler needs to be handled.'); | 127 | + //loger.warn('whiteboardMsgComingHandler needs to be handled.'); |
| 128 | + console.log("白板收到数据=============================QQ"); | ||
| 50 | } | 129 | } |
| 51 | 130 | ||
| 131 | + wbReceriveHandler(chatBuffer) { | ||
| 132 | + console.log("白板收到数据=============================QQ"); | ||
| 133 | + //var chatReceivePdu = pdu['RCChatSendDataRequestPdu'].decode(chatBuffer); | ||
| 134 | + // | ||
| 135 | + //var chatMsg = {}; | ||
| 136 | + //chatMsg.fromNodeID = chatReceivePdu.initiator; | ||
| 137 | + //chatMsg.toNodeID = chatReceivePdu.peer; | ||
| 138 | + //chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2); | ||
| 139 | + //chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2); | ||
| 140 | + //chatMsg.fromRole = chatReceivePdu.fromRole; | ||
| 141 | + // | ||
| 142 | + //loger.log('接收聊天消息.', chatMsg); | ||
| 143 | + // | ||
| 144 | + //this._emit(MessageTypes.CHAT_RECEIVE, chatMsg); | ||
| 145 | + } | ||
| 52 | tableInsertHandler(tableId, record) { | 146 | tableInsertHandler(tableId, record) { |
| 53 | this.emitDocChange(ApeConsts.DOCUMENT_DEL); | 147 | this.emitDocChange(ApeConsts.DOCUMENT_DEL); |
| 54 | } | 148 | } |
| 55 | 149 | ||
| 56 | tableUpdateHandler(owner, recordId, recordData) { | 150 | tableUpdateHandler(owner, recordId, recordData) { |
| 57 | const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(recordData); | 151 | const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(recordData); |
| 152 | + console.log("recordInfo"); | ||
| 153 | + console.log(recordInfo); | ||
| 58 | // 目前只处理 文档标注 | 154 | // 目前只处理 文档标注 |
| 59 | if (recordInfo.type == ApeConsts.WBA_DOC_ANNOTATION) { | 155 | if (recordInfo.type == ApeConsts.WBA_DOC_ANNOTATION) { |
| 60 | const uncompressedBytes = new Zlib.Inflate(recordInfo.action.compact().view).decompress(); | 156 | const uncompressedBytes = new Zlib.Inflate(recordInfo.action.compact().view).decompress(); |
| @@ -38,9 +38,6 @@ class MCU extends Emiter { | @@ -38,9 +38,6 @@ class MCU extends Emiter { | ||
| 38 | _sendJoinClassRequest(){ | 38 | _sendJoinClassRequest(){ |
| 39 | const confInfo = this.confInfo; | 39 | const confInfo = this.confInfo; |
| 40 | loger.log('MCU-发送加入会议请求.',confInfo); | 40 | loger.log('MCU-发送加入会议请求.',confInfo); |
| 41 | - // 创建刷新nodeId | ||
| 42 | - confInfo.nodeId = parseInt(Date.now() / 1000); | ||
| 43 | - GlobalConfig.nodeId=confInfo.nodeId;//这是标识自己身份的id | ||
| 44 | 41 | ||
| 45 | var joinRequestPdu = new pdu['RCConferenceJoinRequestPdu']; | 42 | var joinRequestPdu = new pdu['RCConferenceJoinRequestPdu']; |
| 46 | joinRequestPdu.type = 2; | 43 | joinRequestPdu.type = 2; |
| @@ -163,6 +160,9 @@ class MCU extends Emiter { | @@ -163,6 +160,9 @@ class MCU extends Emiter { | ||
| 163 | loger.log('开始建立EverSocket通道.', _confInfo); | 160 | loger.log('开始建立EverSocket通道.', _confInfo); |
| 164 | _confInfo.confId = parseInt(_confInfo.confId); // confId 必须整形 | 161 | _confInfo.confId = parseInt(_confInfo.confId); // confId 必须整形 |
| 165 | this.confInfo = _confInfo; | 162 | this.confInfo = _confInfo; |
| 163 | + // 创建刷新nodeId | ||
| 164 | + this.confInfo.nodeId = parseInt(Date.now() / 1000); | ||
| 165 | + GlobalConfig.nodeId=this.confInfo.nodeId;//这是标识自己身份的id | ||
| 166 | 166 | ||
| 167 | let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu']; | 167 | let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu']; |
| 168 | nodeInfoRecordPdu.name = this.confInfo.userName; | 168 | nodeInfoRecordPdu.name = this.confInfo.userName; |
| @@ -88,6 +88,7 @@ RCPduPackage.RCPDU_AUDIO_SEND_DATA_REQUEST = 261; | @@ -88,6 +88,7 @@ RCPduPackage.RCPDU_AUDIO_SEND_DATA_REQUEST = 261; | ||
| 88 | RCPduPackage.RCPDU_GIFT_SEND_DATA_REQUEST = 262; | 88 | RCPduPackage.RCPDU_GIFT_SEND_DATA_REQUEST = 262; |
| 89 | RCPduPackage.RCPDU_CHAT_SEND_DATA_REQUEST = 263; | 89 | RCPduPackage.RCPDU_CHAT_SEND_DATA_REQUEST = 263; |
| 90 | RCPduPackage.RCPDU_VOTING_POLL_RECORD = 265; | 90 | RCPduPackage.RCPDU_VOTING_POLL_RECORD = 265; |
| 91 | + | ||
| 91 | RCPduPackage.RCPDU_REG_REQUEST_OBJ = 290; | 92 | RCPduPackage.RCPDU_REG_REQUEST_OBJ = 290; |
| 92 | RCPduPackage.RCPDU_REG_RESPONSE_OBJ = 291; | 93 | RCPduPackage.RCPDU_REG_RESPONSE_OBJ = 291; |
| 93 | RCPduPackage.RCPDU_REG_COUNTER_REQUEST_PDU = 292; | 94 | RCPduPackage.RCPDU_REG_COUNTER_REQUEST_PDU = 292; |
-
请 注册 或 登录 后发表评论