李勇

修改对外接口,修改外部初始化的方法

此 diff 太大无法显示。
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 "wbp": { 31 "wbp": {
32 "project": "umd", 32 "project": "umd",
33 "entries": { 33 "entries": {
34 - "main": "./MessageEngine.js" 34 + "main": "./McuClientEngine.js"
35 }, 35 },
36 "source": "src/", 36 "source": "src/",
37 "build": "dist/" 37 "build": "dist/"
  1 +
1 export default class Emiter { 2 export default class Emiter {
2 constructor() { 3 constructor() {
3 this.MAPS = {}; 4 this.MAPS = {};
@@ -13,7 +14,7 @@ export default class Emiter { @@ -13,7 +14,7 @@ export default class Emiter {
13 } 14 }
14 off(eid, elistener) { 15 off(eid, elistener) {
15 if (eid) { 16 if (eid) {
16 - let stub = this.MAPS[eid]; 17 + let stub =this.MAPS[eid];
17 if (stub) { 18 if (stub) {
18 if (elistener) { 19 if (elistener) {
19 return stub.splice(stub.indexOf(elistener), 1); 20 return stub.splice(stub.indexOf(elistener), 1);
@@ -22,10 +23,11 @@ export default class Emiter { @@ -22,10 +23,11 @@ export default class Emiter {
22 } 23 }
23 } 24 }
24 } 25 }
25 - emit(eid, data) { 26 + _emit(eid, data) {
26 if (eid) { 27 if (eid) {
27 //eid=* broadcast 28 //eid=* broadcast
28 - let asteriskStub = this.MAPS['*']; 29 + let asteriskStub =this.MAPS['*'];
  30 + console.log("asteriskStub");
29 if (asteriskStub && asteriskStub.length) { 31 if (asteriskStub && asteriskStub.length) {
30 asteriskStub.forEach(function (elistener) { 32 asteriskStub.forEach(function (elistener) {
31 elistener(eid, data); 33 elistener(eid, data);
  1 +import Emiter from './Emiter';
  2 +import Sass from 'Sass';
  3 +import Mcu from 'mcu';
  4 +import MessageTypes from 'MessageTypes';
  5 +import Loger from 'Loger';
  6 +import ConferApe from 'apes/ConferApe';
  7 +import ChatApe from 'apes/ChatApe';
  8 +import VideoChat from 'apes/VideoApe';
  9 +import DocApe from 'apes/DocApe';
  10 +import WhiteBoardApe from 'apes/WhiteBoardApe';
  11 +import EngineUtils from "EngineUtils";
  12 +
  13 +let loger = Loger.getLoger('MessageEntrance');
  14 +
  15 +let info={"version":"v1.0.0","author":"3mang"};
  16 +
  17 +let confInfo={};
  18 +let sass;
  19 +let mcu ;
  20 +let confer_ape;
  21 +let chat_ape;
  22 +let video_ape;
  23 +let doc_ape;
  24 +let wb_ape;
  25 +
  26 +export default class MessageEntrance extends Emiter {
  27 + constructor() {
  28 + super();
  29 +
  30 + this.info=info;
  31 +
  32 + // 应用层会议信息
  33 + confInfo = {};
  34 +
  35 + // Sass平台层
  36 + sass = Sass;
  37 + sass.on('*', (type, data) => this._emit(type, data));
  38 + sass.on(sass.SUCCESS, this._h5SassSuccessHandler.bind(this));
  39 +
  40 + // 底层MCU消息层
  41 + mcu = Mcu;
  42 + mcu.on('*', (type, data) => this._emit(type, data));
  43 + mcu.on(MessageTypes.CONFERENCE_JOIN_SUCCESS, this._conferenceJoinSuccessHandler.bind(this));
  44 +
  45 + // 注册所有应用Ape
  46 + confer_ape = new ConferApe();
  47 + confer_ape.on('*', (type, data) => this._emit(type, data));
  48 + confer_ape.on(MessageTypes.DOC_SWITCH, this.docSwitchHandler.bind(this));
  49 +
  50 + chat_ape = new ChatApe();
  51 + chat_ape.on('*', (type, data) => this._emit(type, data));
  52 +
  53 + video_ape = new VideoChat();
  54 + video_ape.on('*', (type, data) => this._emit(type, data));
  55 +
  56 + doc_ape = new DocApe();
  57 + doc_ape.on('*', (type, data) => this._emit(type, data));
  58 + doc_ape.on(MessageTypes.DOC_UPDATE, this.docUpdateHandler.bind(this));
  59 +
  60 + doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this));
  61 +
  62 + wb_ape = new WhiteBoardApe();
  63 + wb_ape.on('*', (type, data) => this._emit(type, data));
  64 + wb_ape.on(MessageTypes.ANNO_UPDATE, this.annoUpdateHandler.bind(this));
  65 + this.on(MessageTypes.DOC_SHOW, this.docShowHandler.bind(this));
  66 +
  67 + this.sendChatMsg=this._sendChatMsg;
  68 + this.joinClass=this._joinClass;
  69 + }
  70 +
  71 + // 进入会议
  72 + _joinClass(_confInfo) {
  73 + confInfo = _confInfo||{};
  74 + if(confInfo===null||EngineUtils.isEmptyObject(confInfo)){
  75 + loger.log('不能进入会议,传递的参数不对.',_confInfo);
  76 + return ;
  77 + }
  78 + if(sass){
  79 + sass.sassChecking(_confInfo);
  80 + }
  81 + }
  82 +
  83 + // 离开会议
  84 + leaveClass() {
  85 + if(mcu){
  86 + mcu.leaveMCU();
  87 + }
  88 + }
  89 + // 通过SASS平台验证
  90 + _h5SassSuccessHandler() {
  91 + loger.log('加入底层MCU会议.'+confInfo.toString());
  92 + if(mcu){
  93 + mcu.joinMCU(confInfo);
  94 + }
  95 + }
  96 +
  97 + // MCU 会议成功
  98 + _conferenceJoinSuccessHandler() {
  99 + if(sass){
  100 + sass.getClassDetail();
  101 + }
  102 + }
  103 + // 参会处理
  104 + conferenceHandler(msg_type) {
  105 + var msg = {
  106 + type: msg_type,
  107 + data: null
  108 + };
  109 + this._emit(msg.type, msg);
  110 + }
  111 + // 发送聊天消息
  112 + _sendChatMsg(to, msg) {
  113 + if (chat_ape) {
  114 + chat_ape.sendChatMsg(to, msg);
  115 + }
  116 + }
  117 + // 白板笔记更新
  118 + annoUpdateHandler(annoInfo) {
  119 + const activeDocId = confer_ape.activeDocId;
  120 + const docItem = doc_ape.docList[activeDocId];
  121 + if (docItem && annoInfo.id == docItem.wbid) {
  122 + this._emit(MessageTypes.DOC_ANNO, annoInfo);
  123 + }
  124 + }
  125 +
  126 + // 文档变更-笔记处理
  127 + docShowHandler(docItem) {
  128 + loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo);
  129 +
  130 + const annoInfo = wb_ape.annoInfos[docItem.wbid];
  131 + if (annoInfo) {
  132 + this._emit(MessageTypes.DOC_ANNO, annoInfo);
  133 + } else {
  134 + this._emit(MessageTypes.DOC_ANNO);
  135 +
  136 + }
  137 +
  138 + }
  139 +
  140 + // 文档切换
  141 + docSwitchHandler() {
  142 + const activeDocId = confer_ape.activeDocId;
  143 + loger.log('Switch Doc Active -> ' + activeDocId);
  144 + const docItem = doc_ape.docList[activeDocId];
  145 + if (docItem) {
  146 + this._emit(MessageTypes.DOC_SHOW, docItem);
  147 + }
  148 + }
  149 +
  150 + // 文档变更
  151 + docUpdateHandler(docItem) {
  152 + loger.log('Doc UpdateId ->' + docItem.id + '| activeDocId ->' + confer_ape.activeDocId);
  153 + if (docItem.id == confer_ape.activeDocId) {
  154 + this._emit(MessageTypes.DOC_SHOW, docItem);
  155 + }
  156 + }
  157 +
  158 + //文档删除
  159 + docDeleteHandler(docItem){
  160 + if (docItem.id == confer_ape.activeDocId) {
  161 + this._emit(MessageTypes.DOC_DEL, docItem);
  162 + }
  163 + }
  164 +}
  165 +//MessageEntrance.MessageTypes = MessageTypes;
  1 +/**
  2 + * Created by hoopoe8 on 2017/1/8.
  3 + */
  4 +
  5 +class EngineUtils{
  6 + static isEmptyObject(O){
  7 + for (var x in O){
  8 + return false;
  9 + }
  10 + return true;
  11 + }
  12 +}
  13 +export default EngineUtils;
@@ -52,9 +52,9 @@ class EverSocket extends Emiter { @@ -52,9 +52,9 @@ class EverSocket extends Emiter {
52 _setConnected(isConn = true) { 52 _setConnected(isConn = true) {
53 this._connected = isConn; 53 this._connected = isConn;
54 if (this._connected) { 54 if (this._connected) {
55 - this.emit(EverSocket.OPEN); 55 + this._emit(EverSocket.OPEN);
56 } else { 56 } else {
57 - this.emit(EverSocket.CLOSED); 57 + this._emit(EverSocket.CLOSED);
58 } 58 }
59 } 59 }
60 60
@@ -117,7 +117,7 @@ class EverSocket extends Emiter { @@ -117,7 +117,7 @@ class EverSocket extends Emiter {
117 this._lastActiveTime = Date.now(); 117 this._lastActiveTime = Date.now();
118 const bufferData = messageEvent.data; 118 const bufferData = messageEvent.data;
119 if (bufferData.byteLength > 0) { 119 if (bufferData.byteLength > 0) {
120 - this.emit(EverSocket.MESSAGE, bufferData); 120 + this._emit(EverSocket.MESSAGE, bufferData);
121 } 121 }
122 } 122 }
123 123
  1 +import EngineEntrance from 'EngineEntrance';
  2 +import MessageTypes from 'MessageTypes';
  3 +
  4 +const MCU_CLIENT=new EngineEntrance();
  5 +export function createMcuClient() {
  6 + return MCU_CLIENT;
  7 +}
  8 +
  9 +export {MessageTypes};
1 -import Emiter from './Emiter';  
2 -import h5Sass from 'Sass';  
3 -import mcu from 'mcu';  
4 -import MessageTypes from 'MessageTypes';  
5 -import Loger from 'Loger';  
6 -import ConferApe from 'apes/ConferApe';  
7 -import ChatApe from 'apes/ChatApe';  
8 -import VideoChat from 'apes/VideoApe';  
9 -import DocApe from 'apes/DocApe';  
10 -import WhiteBoardApe from 'apes/WhiteBoardApe';  
11 -let loger = Loger.getLoger('MessageEngine');  
12 -  
13 -export default class MessageEngine extends Emiter {  
14 - constructor() {  
15 - super();  
16 -  
17 - // 应用层会议信息  
18 - this.confInfo = null;  
19 -  
20 - // Sass平台层  
21 - this.h5Sass = h5Sass;  
22 - this.h5Sass.on('*', (type, data) => this.emit(type, data));  
23 - this.h5Sass.on(h5Sass.SUCCESS, this._h5SassSuccessHandler.bind(this));  
24 -  
25 - // 底层MCU消息层  
26 - this.mcu = mcu;  
27 - this.mcu.on('*', (type, data) => this.emit(type, data));  
28 - this.mcu.on(MessageTypes.CONFERENCE_JOIN_SUCCESS, this._conferenceJoinSuccessHandler.bind(this));  
29 -  
30 - // 注册所有应用Ape  
31 - this.conferApe = new ConferApe();  
32 - this.conferApe.on('*', (type, data) => this.emit(type, data));  
33 - this.conferApe.on(MessageTypes.DOC_SWITCH, this.docSwitchHandler.bind(this));  
34 -  
35 - this.chat_ape = new ChatApe();  
36 - this.chat_ape.on('*', (type, data) => this.emit(type, data));  
37 -  
38 - this.video_ape = new VideoChat();  
39 - this.video_ape.on('*', (type, data) => this.emit(type, data));  
40 -  
41 - this.doc_ape = new DocApe();  
42 - this.doc_ape.on('*', (type, data) => this.emit(type, data));  
43 - this.doc_ape.on(MessageTypes.DOC_UPDATE, this.docUpdateHandler.bind(this));  
44 -  
45 - this.doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this));  
46 -  
47 - this.wb_ape = new WhiteBoardApe();  
48 - this.wb_ape.on('*', (type, data) => this.emit(type, data));  
49 - this.wb_ape.on(MessageTypes.ANNO_UPDATE, this.annoUpdateHandler.bind(this));  
50 -  
51 - this.on(MessageTypes.DOC_SHOW, this.docShowHandler.bind(this));  
52 - //this.say = this.say.bind(this)  
53 - //this.hello = this.hello.bind(this)  
54 - this.init=this._init;  
55 - }  
56 - _init (id) {  
57 - console.log("Engine init "+id);  
58 - }  
59 - // 白板笔记更新  
60 - annoUpdateHandler(annoInfo) {  
61 - const activeDocId = this.conferApe.activeDocId;  
62 - const docItem = this.doc_ape.docList[activeDocId];  
63 - if (docItem && annoInfo.id == docItem.wbid) {  
64 - this.emit(MessageTypes.DOC_ANNO, annoInfo);  
65 - }  
66 - }  
67 -  
68 - // 文档变更-笔记处理  
69 - docShowHandler(docItem) {  
70 - loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo);  
71 -  
72 - const annoInfo = this.wb_ape.annoInfos[docItem.wbid];  
73 - if (annoInfo) {  
74 - this.emit(MessageTypes.DOC_ANNO, annoInfo);  
75 - } else {  
76 - this.emit(MessageTypes.DOC_ANNO);  
77 -  
78 - }  
79 -  
80 - }  
81 -  
82 - // 文档切换  
83 - docSwitchHandler() {  
84 - const activeDocId = this.conferApe.activeDocId;  
85 - loger.log('Switch Doc Active -> ' + activeDocId);  
86 - const docItem = this.doc_ape.docList[activeDocId];  
87 - if (docItem) {  
88 - this.emit(MessageTypes.DOC_SHOW, docItem);  
89 - }  
90 - }  
91 -  
92 - // 文档变更  
93 - docUpdateHandler(docItem) {  
94 - loger.log('Doc UpdateId ->' + docItem.id + '| activeDocId ->' + this.conferApe.activeDocId);  
95 - if (docItem.id == this.conferApe.activeDocId) {  
96 - this.emit(MessageTypes.DOC_SHOW, docItem);  
97 - }  
98 - }  
99 -  
100 - //文档删除  
101 - docDeleteHandler(docItem){  
102 - if (docItem.id == this.conferApe.activeDocId) {  
103 - this.emit(MessageTypes.DOC_DEL, docItem);  
104 - }  
105 - }  
106 -  
107 -  
108 - // MCU 会议成功  
109 - _conferenceJoinSuccessHandler() {  
110 - this.h5Sass.getClassDetail();  
111 - }  
112 -  
113 - // 通过SASS平台验证  
114 - _h5SassSuccessHandler() {  
115 - loger.log('加入底层MCU会议.');  
116 - this.mcu.joinMCU(this.confInfo);  
117 - }  
118 -  
119 - // 进入会议  
120 - joinClass(_confInfo) {  
121 - this.confInfo = _confInfo;  
122 - this.h5Sass.sassChecking(_confInfo);  
123 - }  
124 -  
125 - // 离开会议  
126 - leaveClass() {  
127 - this.mcu.leaveMCU();  
128 - }  
129 -  
130 - // 参会处理  
131 - conferenceHandler(msg_type) {  
132 - var msg = {  
133 - type: msg_type,  
134 - data: null  
135 - };  
136 - this.emit(msg.type, msg);  
137 - }  
138 -  
139 - // 发送聊天消息  
140 - sendChatMsg(to, msg) {  
141 - if (this.chat_ape) {  
142 - this.chat_ape.sendChatMsg(to, msg);  
143 - }  
144 - }  
145 -}  
146 -  
147 -MessageEngine.MessageTypes = MessageTypes;  
148 -MessageEngine.data={  
149 - aa:"aa",  
150 - bb:11,  
151 - cc:"cccc"  
152 -};  
153 -  
@@ -35,16 +35,14 @@ MessageTypes.VIDEO_SHOW = 'video.message'; @@ -35,16 +35,14 @@ MessageTypes.VIDEO_SHOW = 'video.message';
35 MessageTypes.DOC_SHOW = 'document.message'; 35 MessageTypes.DOC_SHOW = 'document.message';
36 MessageTypes.DOC_SWITCH = 'document.switch'; 36 MessageTypes.DOC_SWITCH = 'document.switch';
37 MessageTypes.DOC_UPDATE = 'document.update'; 37 MessageTypes.DOC_UPDATE = 'document.update';
  38 +MessageTypes.DOC_DEL='document.delete';
  39 +MessageTypes.DOC_ANNO = 'document.anno';
38 40
39 MessageTypes.CHAT_RECEIVE = 'chat.message'; 41 MessageTypes.CHAT_RECEIVE = 'chat.message';
40 42
41 -MessageTypes.DOC_ANNO = 'document.anno';  
42 -  
43 MessageTypes.ANNO_UPDATE = 'anno_update'; 43 MessageTypes.ANNO_UPDATE = 'anno_update';
44 44
45 -MessageTypes.DOC_DEL='document.delete';  
46 MessageTypes.AUDIO_SHOW='audio.message'; 45 MessageTypes.AUDIO_SHOW='audio.message';
47 46
48 -  
49 export default MessageTypes; 47 export default MessageTypes;
50 48
@@ -3,10 +3,10 @@ import Loger from 'Loger'; @@ -3,10 +3,10 @@ import Loger from 'Loger';
3 import MessageTypes from 'MessageTypes'; 3 import MessageTypes from 'MessageTypes';
4 4
5 // 日志对象 5 // 日志对象
6 -const loger = Loger.getLoger('H5Sass'); 6 +const loger = Loger.getLoger('Sass');
7 7
8 let confInfo = {}; 8 let confInfo = {};
9 -class H5Sass extends Emiter { 9 +class Sass extends Emiter {
10 constructor() { 10 constructor() {
11 super(); 11 super();
12 } 12 }
@@ -14,10 +14,10 @@ class H5Sass extends Emiter { @@ -14,10 +14,10 @@ class H5Sass extends Emiter {
14 // Sass校验 14 // Sass校验
15 sassChecking(_confInfo) { 15 sassChecking(_confInfo) {
16 loger.log('发起Sass校验', _confInfo); 16 loger.log('发起Sass校验', _confInfo);
17 - this.confInfo = _confInfo; 17 + confInfo = _confInfo;
18 18
19 // 密码校验 19 // 密码校验
20 - if (this.confInfo.nopassword === 'true') { 20 + if (confInfo.nopassword === 'true') {
21 return this.sendPWDChecking(); 21 return this.sendPWDChecking();
22 } 22 }
23 23
@@ -27,7 +27,7 @@ class H5Sass extends Emiter { @@ -27,7 +27,7 @@ class H5Sass extends Emiter {
27 27
28 // 入会校验 28 // 入会校验
29 sendPWDChecking() { 29 sendPWDChecking() {
30 - let url = `http://${this.confInfo.portal}/3m/getCheckMeetinig.do?siteId=${this.confInfo.siteId}&classId=${this.confInfo.confId}&password=${this.confInfo.password}`; 30 + let url = `http://${confInfo.portal}/3m/getCheckMeetinig.do?siteId=${confInfo.siteId}&classId=${confInfo.confId}&password=${confInfo.password}`;
31 loger.log('会议密码校验', url); 31 loger.log('会议密码校验', url);
32 fetch(url, { 32 fetch(url, {
33 timeout: 5000 33 timeout: 5000
@@ -37,14 +37,14 @@ class H5Sass extends Emiter { @@ -37,14 +37,14 @@ class H5Sass extends Emiter {
37 return ret.text(); 37 return ret.text();
38 } else { 38 } else {
39 loger.error(`会议密码校验-网络异常.状态码:${ret.status}`); 39 loger.error(`会议密码校验-网络异常.状态码:${ret.status}`);
40 - this.emit(MessageTypes.NET_ERROR); 40 + this._emit(MessageTypes.NET_ERROR);
41 throw ''; 41 throw '';
42 } 42 }
43 }) 43 })
44 .then(ret => { 44 .then(ret => {
45 if (ret === 'false') { 45 if (ret === 'false') {
46 loger.error(`会议密码校验-失败.`); 46 loger.error(`会议密码校验-失败.`);
47 - return this.emit(MessageTypes.CONFERENCE_SHOW_WRONG_PASSWORD); 47 + return this._emit(MessageTypes.CONFERENCE_SHOW_WRONG_PASSWORD);
48 } 48 }
49 if (ret === 'true') { 49 if (ret === 'true') {
50 loger.log(`会议密码校验-成功.`); 50 loger.log(`会议密码校验-成功.`);
@@ -52,17 +52,17 @@ class H5Sass extends Emiter { @@ -52,17 +52,17 @@ class H5Sass extends Emiter {
52 return 52 return
53 } 53 }
54 loger.error(`会议密码校验-协议异常.`); 54 loger.error(`会议密码校验-协议异常.`);
55 - this.emit(MessageTypes.PRO_ERROR); 55 + this._emit(MessageTypes.PRO_ERROR);
56 }) 56 })
57 .catch(err => { 57 .catch(err => {
58 loger.error(`会议密码校验-异常.状态码:${err}`); 58 loger.error(`会议密码校验-异常.状态码:${err}`);
59 - this.emit(MessageTypes.NET_ERROR); 59 + this._emit(MessageTypes.NET_ERROR);
60 }); 60 });
61 } 61 }
62 62
63 // 发起入会 63 // 发起入会
64 sendMD5Checking() { 64 sendMD5Checking() {
65 - let url = `http://${this.confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${this.confInfo.siteId}&meetingNumber=${this.confInfo.confId}&userId=${this.confInfo.userId}&userName=${this.confInfo.userName}&userType=${this.confInfo.userType}&nopassword=${this.confInfo.nopassword}&md5=${this.confInfo.md5}`; 65 + let url = `http://${confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${confInfo.siteId}&meetingNumber=${confInfo.confId}&userId=${confInfo.userId}&userName=${confInfo.userName}&userType=${confInfo.userType}&nopassword=${confInfo.nopassword}&md5=${confInfo.md5}`;
66 66
67 loger.log('H5SassMD5校验', url); 67 loger.log('H5SassMD5校验', url);
68 68
@@ -74,7 +74,7 @@ class H5Sass extends Emiter { @@ -74,7 +74,7 @@ class H5Sass extends Emiter {
74 return ret.json(); 74 return ret.json();
75 } else { 75 } else {
76 loger.error(`H5SassMD5校验-网络异常.状态码:${ret.status}`); 76 loger.error(`H5SassMD5校验-网络异常.状态码:${ret.status}`);
77 - this.emit(MessageTypes.NET_ERROR); 77 + this._emit(MessageTypes.NET_ERROR);
78 throw ''; 78 throw '';
79 } 79 }
80 }) 80 })
@@ -82,28 +82,31 @@ class H5Sass extends Emiter { @@ -82,28 +82,31 @@ class H5Sass extends Emiter {
82 if (ret.flag == "true") { 82 if (ret.flag == "true") {
83 if (ret.h5_mcu_list) { 83 if (ret.h5_mcu_list) {
84 let server = ret.h5_mcu_list.split(";")[0]; 84 let server = ret.h5_mcu_list.split(";")[0];
85 - this.confInfo.MCUServerIP = server.split(":")[0];  
86 - this.confInfo.MCUServerPort = server.split(":")[1]; 85 + confInfo.MCUServerIP = server.split(":")[0];
  86 + confInfo.MCUServerPort = server.split(":")[1];
87 } 87 }
88 - this.confInfo.maxVideoChannels = ret.maxVideoChannels;  
89 - this.confInfo.maxAudioChannels = ret.maxAudioChannels;  
90 - this.confInfo.maxMediaChannels = this.confInfo.maxVideoChannels + this.confInfo.maxAudioChannels; 88 + console.log(ret);
  89 + confInfo.maxVideoChannels = ret.maxVideoChannels;
  90 + confInfo.maxAudioChannels = ret.maxAudioChannels;
  91 + confInfo.maxMediaChannels = confInfo.maxVideoChannels + confInfo.maxAudioChannels;
91 loger.log('H5Sass校验完成'); 92 loger.log('H5Sass校验完成');
92 - this.emit(H5Sass.SUCCESS); 93 +
  94 + this._emit(Sass.SUCCESS);
93 } else { 95 } else {
94 loger.log('H5SassMD5校验-失败.'); 96 loger.log('H5SassMD5校验-失败.');
95 - this.emit(MessageTypes.CONFERENCE_JOIN_FAILED); 97 + this._emit(MessageTypes.CONFERENCE_JOIN_FAILED);
96 } 98 }
97 }) 99 })
98 .catch(err => { 100 .catch(err => {
99 loger.error(`H5SassMD5校验-异常.状态码:${err}`); 101 loger.error(`H5SassMD5校验-异常.状态码:${err}`);
100 - this.emit(MessageTypes.NET_ERROR); 102 + this._emit(MessageTypes.NET_ERROR);
  103 + console.log("aaaaaaaaaaaaaaaaaaa");
101 }); 104 });
102 } 105 }
103 106
104 // 获取会议详情 107 // 获取会议详情
105 getClassDetail() { 108 getClassDetail() {
106 - let url = `http://${this.confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${this.confInfo.confId}`; 109 + let url = `http://${confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${confInfo.confId}`;
107 110
108 loger.log('H5Sass获取Class详情.', url); 111 loger.log('H5Sass获取Class详情.', url);
109 112
@@ -115,27 +118,27 @@ class H5Sass extends Emiter { @@ -115,27 +118,27 @@ class H5Sass extends Emiter {
115 return ret.json(); 118 return ret.json();
116 } else { 119 } else {
117 loger.error(`H5Sass获取Class详情-网络异常.状态码:${ret.status}`); 120 loger.error(`H5Sass获取Class详情-网络异常.状态码:${ret.status}`);
118 - this.emit(MessageTypes.NET_ERROR); 121 + this._emit(MessageTypes.NET_ERROR);
119 throw ''; 122 throw '';
120 } 123 }
121 }) 124 })
122 .then(ret => { 125 .then(ret => {
123 if (ret.errorCode === 0) { 126 if (ret.errorCode === 0) {
124 loger.log('H5Sass获取Class详情完成'); 127 loger.log('H5Sass获取Class详情完成');
125 - this.emit(MessageTypes.CONFERENCE_SHOW_DETAIL, ret); 128 + this._emit(MessageTypes.CONFERENCE_SHOW_DETAIL, ret);
126 } else { 129 } else {
127 loger.warn('H5Sass获取Class详情失败.'); 130 loger.warn('H5Sass获取Class详情失败.');
128 - this.emit(MessageTypes.NET_ERROR); 131 + this._emit(MessageTypes.NET_ERROR);
129 } 132 }
130 }) 133 })
131 .catch(err => { 134 .catch(err => {
132 loger.error(`H5Sass获取Class详情异常.状态码:${err}`); 135 loger.error(`H5Sass获取Class详情异常.状态码:${err}`);
133 - this.emit(MessageTypes.NET_ERROR); 136 + this._emit(MessageTypes.NET_ERROR);
134 }); 137 });
135 } 138 }
136 } 139 }
137 140
138 -H5Sass.prototype.SUCCESS = H5Sass.SUCCESS = 'h5sass.success'; 141 +Sass.prototype.SUCCESS = Sass.SUCCESS = 'h5sass.success';
139 142
140 -export default new H5Sass; 143 +export default new Sass;
141 144
@@ -18,7 +18,7 @@ import ApeConsts from './ApeConsts'; @@ -18,7 +18,7 @@ import ApeConsts from './ApeConsts';
18 import pdu from 'pdu'; 18 import pdu from 'pdu';
19 import Loger from 'Loger'; 19 import Loger from 'Loger';
20 import MessageTypes from 'MessageTypes'; 20 import MessageTypes from 'MessageTypes';
21 - 21 +import EngineUtils from "EngineUtils";
22 let loger = Loger.getLoger('ChatApe'); 22 let loger = Loger.getLoger('ChatApe');
23 23
24 class ChatApe extends Ape { 24 class ChatApe extends Ape {
@@ -43,11 +43,16 @@ class ChatApe extends Ape { @@ -43,11 +43,16 @@ class ChatApe extends Ape {
43 } 43 }
44 44
45 sendChatMsg(to, message) { 45 sendChatMsg(to, message) {
  46 + if(this._confInfo===null||EngineUtils.isEmptyObject(this._confInfo)){
  47 + loger.log('发送聊天消息.', to, message,"Engine 还未初始化数据!");
  48 + return ;
  49 + }
  50 +
46 loger.log('发送聊天消息.', to, message); 51 loger.log('发送聊天消息.', to, message);
47 let chatSendPdu = new pdu['RCChatSendDataRequestPdu']; 52 let chatSendPdu = new pdu['RCChatSendDataRequestPdu'];
48 chatSendPdu.type = pdu.RCPDU_CHAT_SEND_DATA_REQUEST; 53 chatSendPdu.type = pdu.RCPDU_CHAT_SEND_DATA_REQUEST;
49 - chatSendPdu.initiator = this._confInfo.nodeId;  
50 - chatSendPdu.peer = to; 54 + chatSendPdu.initiator = this._confInfo.nodeId;//发起人
  55 + chatSendPdu.peer = to;//发送给谁
51 chatSendPdu.isPublic = true; 56 chatSendPdu.isPublic = true;
52 chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" + message); 57 chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" + message);
53 chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName); 58 chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName);
@@ -71,7 +76,7 @@ class ChatApe extends Ape { @@ -71,7 +76,7 @@ class ChatApe extends Ape {
71 76
72 loger.log('接受聊天消息.', chatMsg); 77 loger.log('接受聊天消息.', chatMsg);
73 78
74 - this.emit(MessageTypes.CHAT_RECEIVE, chatMsg); 79 + this._emit(MessageTypes.CHAT_RECEIVE, chatMsg);
75 } 80 }
76 } 81 }
77 82
@@ -97,7 +97,7 @@ class ConferApe extends Ape { @@ -97,7 +97,7 @@ class ConferApe extends Ape {
97 if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') { 97 if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') {
98 if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') { 98 if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') {
99 this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1]; 99 this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1];
100 - this.emit(MessageTypes.DOC_SWITCH, this.activeDocId); 100 + this._emit(MessageTypes.DOC_SWITCH, this.activeDocId);
101 } 101 }
102 } 102 }
103 } catch (e) { 103 } catch (e) {
@@ -135,12 +135,12 @@ class ConferApe extends Ape { @@ -135,12 +135,12 @@ class ConferApe extends Ape {
135 this.emitRosterChange(); 135 this.emitRosterChange();
136 // 自己退出 136 // 自己退出
137 if (nodeId == this._confInfo.nodeId) { 137 if (nodeId == this._confInfo.nodeId) {
138 - this.emit(MessageTypes.CONFERENCE_EXIT); 138 + this._emit(MessageTypes.CONFERENCE_EXIT);
139 } 139 }
140 } 140 }
141 141
142 emitRosterChange() { 142 emitRosterChange() {
143 - this.emit(MessageTypes.CONFERENCE_SHOW_ROSTER_NUM, Object.keys(this.rosters).length); 143 + this._emit(MessageTypes.CONFERENCE_SHOW_ROSTER_NUM, Object.keys(this.rosters).length);
144 } 144 }
145 } 145 }
146 146
@@ -46,7 +46,7 @@ class DocApe extends Ape { @@ -46,7 +46,7 @@ class DocApe extends Ape {
46 tableDeleteHandler(tableId, record){ 46 tableDeleteHandler(tableId, record){
47 const re={}; 47 const re={};
48 re.type=ApeConsts.DOCUMENT_DEL; 48 re.type=ApeConsts.DOCUMENT_DEL;
49 - this.emit(MessageTypes.DOC_DEL, re); 49 + this._emit(MessageTypes.DOC_DEL, re);
50 } 50 }
51 tableUpdateHandler(owner, recordId, recordData) { 51 tableUpdateHandler(owner, recordId, recordData) {
52 try { 52 try {
@@ -65,7 +65,7 @@ class DocApe extends Ape { @@ -65,7 +65,7 @@ class DocApe extends Ape {
65 recordInfo.loadURL = `${recordInfo.namePath}/${recordInfo.curPageNo}.jpg`; 65 recordInfo.loadURL = `${recordInfo.namePath}/${recordInfo.curPageNo}.jpg`;
66 } 66 }
67 this.docList[recordId] = recordInfo; 67 this.docList[recordId] = recordInfo;
68 - this.emit(MessageTypes.DOC_UPDATE, recordInfo); 68 + this._emit(MessageTypes.DOC_UPDATE, recordInfo);
69 loger.log('Doc update ->' + recordId); 69 loger.log('Doc update ->' + recordId);
70 } catch (e) { 70 } catch (e) {
71 loger.warn('Doc Table Update Decode包异常'); 71 loger.warn('Doc Table Update Decode包异常');
@@ -60,7 +60,7 @@ class VideoChat extends Ape { @@ -60,7 +60,7 @@ class VideoChat extends Ape {
60 60
61 // this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data); 61 // this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data);
62 loger.log('接受视频消息.', video_data); 62 loger.log('接受视频消息.', video_data);
63 - this.emit(MessageTypes.VIDEO_SHOW, video_data); 63 + this._emit(MessageTypes.VIDEO_SHOW, video_data);
64 64
65 } 65 }
66 66
@@ -101,7 +101,7 @@ class VideoChat extends Ape { @@ -101,7 +101,7 @@ class VideoChat extends Ape {
101 } 101 }
102 102
103 emitVideoChange() { 103 emitVideoChange() {
104 - this.emit(MessageTypes.VIDEO_SHOW, { 104 + this._emit(MessageTypes.VIDEO_SHOW, {
105 activeChannelId: this.activeChannelId, 105 activeChannelId: this.activeChannelId,
106 HLSURL: this.activeURL, 106 HLSURL: this.activeURL,
107 }); 107 });
@@ -63,7 +63,7 @@ class WhiteBoardApe extends Ape { @@ -63,7 +63,7 @@ class WhiteBoardApe extends Ape {
63 svg: UTF8.getStringFromBytes(uncompressedBytes) 63 svg: UTF8.getStringFromBytes(uncompressedBytes)
64 }; 64 };
65 this.annoInfos[recordId] = annoInfo; 65 this.annoInfos[recordId] = annoInfo;
66 - this.emit(MessageTypes.ANNO_UPDATE, annoInfo); 66 + this._emit(MessageTypes.ANNO_UPDATE, annoInfo);
67 } else { 67 } else {
68 loger.log('白板动作忽略,类型:', ApeConsts(recordInfo.type)); 68 loger.log('白板动作忽略,类型:', ApeConsts(recordInfo.type));
69 } 69 }
@@ -22,5 +22,5 @@ import dfjsd from 'Loger'; @@ -22,5 +22,5 @@ import dfjsd from 'Loger';
22 22
23 import fdsfds from 'mcu'; 23 import fdsfds from 'mcu';
24 24
25 -import alexwang from 'MessageEngine.js'; 25 +import alexwang from 'EngineEntrance.js';
26 26
@@ -83,10 +83,10 @@ class MCU extends Emiter { @@ -83,10 +83,10 @@ class MCU extends Emiter {
83 switch (pduResultCode) { 83 switch (pduResultCode) {
84 case PduConsts.RET_SUCCESS: 84 case PduConsts.RET_SUCCESS:
85 this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc")); 85 this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc"));
86 - this.emit(MessageTypes.CONFERENCE_JOIN_SUCCESS, this.confInfo); 86 + this._emit(MessageTypes.CONFERENCE_JOIN_SUCCESS, this.confInfo);
87 break; 87 break;
88 case PduConsts.RET_FULL_CAPACITY: 88 case PduConsts.RET_FULL_CAPACITY:
89 - this.emit(MessageTypes.CONFERENCE_JOIN_FULL); 89 + this._emit(MessageTypes.CONFERENCE_JOIN_FULL);
90 break; 90 break;
91 default: 91 default:
92 loger.warn('JoinConfPdu-未知类型-等待处理.', pduResultCode); 92 loger.warn('JoinConfPdu-未知类型-等待处理.', pduResultCode);
@@ -98,7 +98,7 @@ class MCU extends Emiter { @@ -98,7 +98,7 @@ class MCU extends Emiter {
98 if (ape) { 98 if (ape) {
99 let subTypeLabel = pdu.id2type(pduMsg.subType); 99 let subTypeLabel = pdu.id2type(pduMsg.subType);
100 loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType); 100 loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType);
101 - ape.emit(pduMsg.subType, pduMsg.data); 101 + ape._emit(pduMsg.subType, pduMsg.data);
102 } else { 102 } else {
103 loger.warn(sessionLabel + '尚未注册'); 103 loger.warn(sessionLabel + '尚未注册');
104 } 104 }
@@ -2,7 +2,7 @@ module.exports = function (umdConf) { @@ -2,7 +2,7 @@ module.exports = function (umdConf) {
2 umdConf.devServer.host = '0.0.0.0'; 2 umdConf.devServer.host = '0.0.0.0';
3 //umdConf.webpackFeatures.enableEntryHTML();//生成 3 //umdConf.webpackFeatures.enableEntryHTML();//生成
4 umdConf.output.publicPath = ''; 4 umdConf.output.publicPath = '';
5 - umdConf.output.library = 'MessageEngine'; 5 + umdConf.output.library = 'MCUClientEngine';
6 6
7 //console.dir(umdConf); 7 //console.dir(umdConf);
8 8