李勇

1.修改加入会议和离开会议人员列表数据更新的问题

此 diff 太大无法显示。
... ... @@ -27,7 +27,7 @@ let _confer_ape;
let _chat_ape;
let _video_ape;
let _doc_ape;
let _wb_ape;
let _whiteboard_ape;
//初始化成功回调函数
let _initSuccessCallBackFun;
... ... @@ -84,18 +84,25 @@ export default class MessageEntrance extends Emiter {
_doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this));
_wb_ape = new WhiteBoardApe();
_wb_ape.on('*', (type, data) => this._emit(type, data));
_wb_ape.on(MessageTypes.ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this));
_whiteboard_ape = new WhiteBoardApe();
_whiteboard_ape.on('*', (type, data) => this._emit(type, data));
_whiteboard_ape.on(MessageTypes.ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this));
//公开外部调用的方法
//class
this.init=this._init;
this.joinClass=this._joinClass;
this.leaveClass=this._leaveClass;
this.sendChatMsg=this._sendChatMsg;
this.setDebugData=this._setDebugData;
this.mcuClientStatus=this._mcuClientStatus;
//ape
this.sendChatMsg=this._sendChatMsg;
this.playVideoPath=this._playVideoPath;
this.publishVideoPath=this._publishVideoPath;
this.sendAnnotaion=this._sendAnnotaion;
//debug
//this.setDebugData=this._setDebugData;
}
... ... @@ -169,6 +176,9 @@ export default class MessageEntrance extends Emiter {
}
// 离开会议
_leaveClass() {
if(_confer_ape){
_confer_ape.leaveClass();
}
if(_mcu){
_mcu.leaveMCU();
GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_3);
... ... @@ -229,7 +239,7 @@ export default class MessageEntrance extends Emiter {
_h5SassGetMeetingParaSuccessHandler(_data){
loger.log('获取getMeetingParam完成.');
GlobalConfig.meetingParam=_data;
loger.log(GlobalConfig.meetingParam);
// loger.log(GlobalConfig.meetingParam);
}
// MCU 会议成功
... ... @@ -274,6 +284,38 @@ export default class MessageEntrance extends Emiter {
}
}
//VidoeApe
_playVideoPath(_param){
if(_video_ape){
return _video_ape.playVideoPath(_param);
}else {
return {"code":1,"data":"获取播放地址失败"};
}
}
_publishVideoPath(_param){
if(_video_ape){
return _video_ape.publishVideoPath(_param);
}else {
return {"code":1,"data":"获取推流地址失败"};
}
}
//WhiteBoardApe
// 添加标注,发送信息
_sendAnnotaion(_param){
if(_whiteboard_ape){
_whiteboard_ape.sendAnnotaion(_param);
}
}
//删除标注,发送信息
_deleteAnnotaion(_param){
if(_whiteboard_ape){
_whiteboard_ape.deleteAnnotaion(_param);
}
}
// 白板笔记更新(svg)
annoUpdateHandler(annoInfo) {
const activeDocId = _confer_ape.activeDocId;
... ... @@ -286,7 +328,7 @@ export default class MessageEntrance extends Emiter {
// 文档变更-笔记处理
docShowHandler(docItem) {
loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo);
const annoInfo = _wb_ape.annoInfos[docItem.wbid];
const annoInfo = _whiteboard_ape.annoInfos[docItem.wbid];
if (annoInfo) {
this._emit(MessageTypes.DOC_ANNOTATION, annoInfo);
} else {
... ...
... ... @@ -101,4 +101,22 @@ GlobalConfig.deBugData={};
GlobalConfig.meetingParam={};
GlobalConfig.classDetail={};
// client type
//点对点会议版本
GlobalConfig.CT_P2PMEETING = 0;
/**
* 直播教育版本和大型直播版本
*/
GlobalConfig.CT_LIVEEDUCATION = 1;
/**
* 录制播放器
*/
GlobalConfig.CT_RECORDPLAYER = 2;
/**
* 实时流版本
*/
GlobalConfig. CT_LIVESTREAMING = 3;
GlobalConfig.clientType =0;
export default GlobalConfig;
... ...
... ... @@ -62,6 +62,7 @@ export default class Ape extends Emiter {
// 消息处理
_pduMessageHandler(regBuffer) {
console.log("RCPDU_REG_ADAPTER==========================================");
if (this._apeDelayed) {
// this._apeDelayedMsgs.push(regBuffer);
// this._apeDelayedStart();
... ... @@ -105,6 +106,8 @@ export default class Ape extends Emiter {
let regItemType = regItem.type;
let regItemData = regItem.itemData;
//根据数据包中的type处理数据是否同步
if (pdu.RCPDU_REG_UPDATE_OBJ !== regItemType) {
if (pdu.RCPDU_REG_RESPONSE_OBJ == regItemType) {
let regResponsePdu = pdu['RCRegistryResponseObjPdu'].decode(regItemData);
... ... @@ -114,6 +117,7 @@ export default class Ape extends Emiter {
continue;
}
//具体的数据包
let regUpdatedItem = pdu['RCRegistryUpdateObjPdu'].decode(regItemData);
let sub_type = regUpdatedItem.subType;
let object_id = regUpdatedItem.objId;
... ...
... ... @@ -38,14 +38,13 @@ class ChatApe extends Ape {
this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this));
}
//chatMsgIncomingHandler(pdus) {
//
//}
sendChatMsg(_messageInfo) {
if(this._confInfo===null||EngineUtils.isEmptyObject(this._confInfo)){
loger.log('不能发送聊天消息.McuClient还未初始化数据!');
this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_SEND_FAILED_NO_JOIN);
if(GlobalConfig.getCurrentStatus().code==0||GlobalConfig.getCurrentStatus().code==1){
this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_SEND_FAILED_NO_JOIN);
return;
}
return ;
}
... ...
... ... @@ -20,6 +20,8 @@ import pdu from 'pdus';
import { Zlib } from 'zlibjs/bin/zlib.min';
import UTF8 from 'utf-8';
import Loger from 'Loger';
import GlobalConfig from 'GlobalConfig';
let loger = Loger.getLoger('ConferApe');
class ConferApe extends Ape {
... ... @@ -38,12 +40,16 @@ class ConferApe extends Ape {
// Ape Models
this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer);
this.registerObj(pdu.RCPDU_REG_REGISTER_ROSTER, ApeConsts.CONFERENCE_OBJ_ROSTER_ID,
ApeConsts.CONFERENCE_OBJ_ROSTER_NAME, ApeConsts.CONFERENCE_OBJ_ROSTER_TAG, 0, new ArrayBuffer);
this.registerObj(pdu.RCPDU_REG_REGISTER_QUEUE, ApeConsts.CONFERENCE_OBJ_QUEUE_ID,
ApeConsts.CONFERENCE_OBJ_QUEUE_NAME, ApeConsts.CONFERENCE_OBJ_QUEUE_TAG, 0, new ArrayBuffer);
this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_TABLE_ID,
ApeConsts.CONFERENCE_OBJ_TABLE_NAME, ApeConsts.CONFERENCE_OBJ_TABLE_TAG, 0, new ArrayBuffer);
this.registerObj(pdu.RCPDU_REG_REGISTER_COUNTER, ApeConsts.CONFERENCE_OBJ_COUNTER_ID,
ApeConsts.CONFERENCE_OBJ_COUNTER_NAME, ApeConsts.CONFERENCE_OBJ_COUNTER_TAG, 0, new ArrayBuffer);
... ... @@ -52,7 +58,7 @@ class ConferApe extends Ape {
_joinSessionHandler(confInfo) {
let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self;
loger.log("_joinSessionHandler nodeInfoRecordPdu=",nodeInfoRecordPdu);
let userDataPdu = new pdu['RCNodeInfoUserDataPdu'];
userDataPdu.qq = '';
userDataPdu.skype = '';
... ... @@ -74,6 +80,7 @@ class ConferApe extends Ape {
updateObjPdu.subType = rosterUpdateItem.type;
updateObjPdu.userData = rosterUpdateItem.toArrayBuffer();
//同步
let adapterItemPdu = new pdu['RCAdapterItemPdu'];
adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ;
adapterItemPdu.itemData = updateObjPdu.toArrayBuffer();
... ... @@ -84,11 +91,45 @@ class ConferApe extends Ape {
this.sendUniform(adapterPdu, true);
}
//主动离开会议,发送通知到服务器
leaveClass(){
let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self;
let userDataPdu = new pdu['RCNodeInfoUserDataPdu'];
userDataPdu.qq = '';
userDataPdu.skype = '';
userDataPdu.mobile = '';
nodeInfoRecordPdu.userData = userDataPdu.toArrayBuffer();
nodeInfoRecordPdu.deviceType = 3;
let item = new pdu['RCRegistryRosterItemPdu'];
item.nodeId = nodeInfoRecordPdu.nodeId;
item.nodeData = nodeInfoRecordPdu.toArrayBuffer();
let rosterUpdateItem = new pdu['RCRegistryRosterDeleteItemPdu'];
rosterUpdateItem.type = pdu.RCPDU_REG_ROSTER_DELETE_PDU;
rosterUpdateItem.nodeId=GlobalConfig.nodeId;
let updateObjPdu = new pdu['RCRegistryUpdateObjPdu'];
updateObjPdu.objId = ApeConsts.CONFERENCE_OBJ_ROSTER_ID;
updateObjPdu.subType = rosterUpdateItem.type;
updateObjPdu.userData = rosterUpdateItem.toArrayBuffer();
let adapterItemPdu = new pdu['RCAdapterItemPdu'];
adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ;
adapterItemPdu.itemData = updateObjPdu.toArrayBuffer();
let adapterPdu = new pdu['RCAdapterPdu'];
adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
adapterPdu.item.push(adapterItemPdu);
this.sendUniform(adapterPdu, true);
}
tableUpdateHandler(owner, recordId, recordData) {
loger.log("更新人员列表数据 tableUpdateHandler");
try {
let tabUpdatePdu = pdu.RCTabUpdateDataRequestPdu.decode(recordData);
const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress();
... ... @@ -107,13 +148,14 @@ class ConferApe extends Ape {
rosterInsertHandler(nodeId, nodeData) {
loger.log("更新人员列表数据 rosterInsertHandler");
this.rosterUpdateHandler(nodeId, nodeData);
}
//更新人员列表数据
rosterUpdateHandler(nodeId, nodeData) {
//loger.log("更新人员列表数据",nodeId,userDataObj);
loger.log("更新人员列表数据 rosterUpdateHandler");
if (nodeData.role === ApeConsts.NR_MASTER ||
nodeData.role === ApeConsts.NR_SLAVE) {
this.hostNodeId = nodeData.nodeId;
... ... @@ -133,11 +175,14 @@ class ConferApe extends Ape {
loger.log("更新人员列表数据",{"nodeId":nodeId});
this._emit(MessageTypes.CLASS_INSERT_ROSTER, {"nodeId":nodeId,"nodeData":newNodeData});
this.emitRosterChange();
}else {
loger.log("更新人员列表数据,rosterExists已经存在",rosterExists);
}
}
//删除用户
rosterDelHandler(nodeId) {
loger.log("更新人员列表数据 rosterDelHandler");
delete this.rosters[nodeId];
this._emit(MessageTypes.CLASS_DELETE_ROSTER, {"nodeId":nodeId});
this.emitRosterChange();
... ...
... ... @@ -46,6 +46,15 @@ class VideoChat extends Ape {
this.on(pdu.RCPDU_VIDEO_SEND_DATA_REQUEST, this.videoIncomingHandler.bind(this));
}
//获取播流地址
playVideoPath(_param){
return {"code":0,"data":"播放流地址XXXXXXXXXXXXXXXXXXXXX"};
}
//获取推流地址
publishVideoPath(_param){
return {"code":0,"data":"推流地址XXXXXXXXXXXXXXXXXXXXXXX"};
}
// 视频消息处理
videoIncomingHandler(videoBuffer) {
let videoReceivePdu = pdu['VideoSendDataRequestPdu'].decode(videoBuffer);
... ... @@ -101,7 +110,6 @@ class VideoChat extends Ape {
}
emitVideoChange() {
this._emit(MessageTypes.VIDEO_RECEIVE, {
activeChannelId: this.activeChannelId,
HLSURL: this.activeURL,
... ...
... ... @@ -20,6 +20,7 @@ import Loger from 'Loger';
import MessageTypes from 'MessageTypes';
import { Zlib } from 'zlibjs/bin/zlib.min';
import UTF8 from 'utf-8';
import GlobalConfig from 'GlobalConfig';
let loger = Loger.getLoger('WhiteBoardApe');
... ... @@ -45,16 +46,111 @@ class WhiteBoardApe extends Ape {
this._apeDelayed = true;
}
// 添加标注,发送信息
sendAnnotaion(_param){
//var objPoint={
// "type":0,
// "id":111111,
// "color":0,
// "thickness":0,
// "radius":0,
// "text":0,
// "fontS":0,
// "fontN":0,
// "pointD":[]
//};
//message RCWhiteboardDataRequest2Pdu {
// required uint32 id = 1;
// required uint32 type = 2;
// required uint32 initiator = 3;
// required bytes drawData = 4;
//}
//message RCWhiteboardCurveLinePdu {
// required uint32 color = 1;
// required uint32 thickness = 2;
// required string pointData = 3;
//}
//
//var coverLine=new pdu['RCWhiteboardCurveLinePdu'];
//coverLine.color=0xff00ff;
//coverLine.thickness=2;
//coverLine.pointData="白板数据测试测试";
//
//var sendData=new pdu['RCWhiteboardDataRequest2Pdu'];
//sendData.id=parseInt(Date.now() / 1000);
//sendData.type=pdu.RCPDU_AUDIO_SEND_DATA_REQUEST;
//sendData.initiator = this._confInfo.nodeId;//发起人
//sendData.peer = parseInt(101);//发送给谁,公聊的时候是0,私聊的时候是指定的用户id
//sendData.isPublic = true;
//sendData.drawData=coverLine.toArrayBuffer();
//console.log("白板发送数据=============================");
//this.sendUniform(sendData);
let chatSendPdu = new pdu['RCChatSendDataRequestPdu'];
chatSendPdu.type = pdu.RCPDU_CONFERENCE_SEND_DATA_REQUEST;
chatSendPdu.initiator = this._confInfo.nodeId;//发起人
chatSendPdu.peer = parseInt(0);//发送给谁,公聊的时候是0,私聊的时候是指定的用户id
chatSendPdu.isPublic = true;
chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" +"白板测试");
chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName);
chatSendPdu.fromRole = this._confInfo.classRole;
//同步
let adapterItemPdu = new pdu['RCAdapterItemPdu'];
adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ;
adapterItemPdu.itemData = chatSendPdu.toArrayBuffer();
let adapterPdu = new pdu['RCAdapterPdu'];
adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
adapterPdu.item.push(adapterItemPdu);
console.log("白板发送数据=============================QQ");
this.sendUniform(adapterPdu, true);
// this.sendUniform(chatSendPdu);
//if (!(chatSendPdu.isPublic || 0 === chatSendPdu.peer)) {
// //发送给制定的人
// this.send(chatSendPdu);
//} else {
// //发送给所有人
// this.sendUniform(chatSendPdu);
//}
}
//删除标注,发送信息
deleteAnnotaion(_param){
}
whiteboardMsgComingHandler(pdu) {
loger.warn('whiteboardMsgComingHandler needs to be handled.');
//loger.warn('whiteboardMsgComingHandler needs to be handled.');
console.log("白板收到数据=============================QQ");
}
wbReceriveHandler(chatBuffer) {
console.log("白板收到数据=============================QQ");
//var chatReceivePdu = pdu['RCChatSendDataRequestPdu'].decode(chatBuffer);
//
//var chatMsg = {};
//chatMsg.fromNodeID = chatReceivePdu.initiator;
//chatMsg.toNodeID = chatReceivePdu.peer;
//chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2);
//chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2);
//chatMsg.fromRole = chatReceivePdu.fromRole;
//
//loger.log('接收聊天消息.', chatMsg);
//
//this._emit(MessageTypes.CHAT_RECEIVE, chatMsg);
}
tableInsertHandler(tableId, record) {
this.emitDocChange(ApeConsts.DOCUMENT_DEL);
}
tableUpdateHandler(owner, recordId, recordData) {
const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(recordData);
console.log("recordInfo");
console.log(recordInfo);
// 目前只处理 文档标注
if (recordInfo.type == ApeConsts.WBA_DOC_ANNOTATION) {
const uncompressedBytes = new Zlib.Inflate(recordInfo.action.compact().view).decompress();
... ...
... ... @@ -38,9 +38,6 @@ class MCU extends Emiter {
_sendJoinClassRequest(){
const confInfo = this.confInfo;
loger.log('MCU-发送加入会议请求.',confInfo);
// 创建刷新nodeId
confInfo.nodeId = parseInt(Date.now() / 1000);
GlobalConfig.nodeId=confInfo.nodeId;//这是标识自己身份的id
var joinRequestPdu = new pdu['RCConferenceJoinRequestPdu'];
joinRequestPdu.type = 2;
... ... @@ -163,6 +160,9 @@ class MCU extends Emiter {
loger.log('开始建立EverSocket通道.', _confInfo);
_confInfo.confId = parseInt(_confInfo.confId); // confId 必须整形
this.confInfo = _confInfo;
// 创建刷新nodeId
this.confInfo.nodeId = parseInt(Date.now() / 1000);
GlobalConfig.nodeId=this.confInfo.nodeId;//这是标识自己身份的id
let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu'];
nodeInfoRecordPdu.name = this.confInfo.userName;
... ...
... ... @@ -88,6 +88,7 @@ RCPduPackage.RCPDU_AUDIO_SEND_DATA_REQUEST = 261;
RCPduPackage.RCPDU_GIFT_SEND_DATA_REQUEST = 262;
RCPduPackage.RCPDU_CHAT_SEND_DATA_REQUEST = 263;
RCPduPackage.RCPDU_VOTING_POLL_RECORD = 265;
RCPduPackage.RCPDU_REG_REQUEST_OBJ = 290;
RCPduPackage.RCPDU_REG_RESPONSE_OBJ = 291;
RCPduPackage.RCPDU_REG_COUNTER_REQUEST_PDU = 292;
... ...