李勇

第三方消息通道控制加入到课堂管理模块

此 diff 太大无法显示。
@@ -17,7 +17,7 @@ import VideoApe from 'apes/VideoApe'; @@ -17,7 +17,7 @@ import VideoApe from 'apes/VideoApe';
17 import AudioApe from 'apes/AudioApe'; 17 import AudioApe from 'apes/AudioApe';
18 import DocApe from 'apes/DocApe'; 18 import DocApe from 'apes/DocApe';
19 import WhiteBoardApe from 'apes/WhiteBoardApe'; 19 import WhiteBoardApe from 'apes/WhiteBoardApe';
20 -import ThirdMessage from 'apes/ThirdMessage'; 20 +
21 import EngineUtils from "EngineUtils"; 21 import EngineUtils from "EngineUtils";
22 import GlobalConfig from 'GlobalConfig'; 22 import GlobalConfig from 'GlobalConfig';
23 import ApeConsts from 'apes/ApeConsts'; 23 import ApeConsts from 'apes/ApeConsts';
@@ -29,7 +29,7 @@ import MediaModule from 'apes/MediaModule'; @@ -29,7 +29,7 @@ import MediaModule from 'apes/MediaModule';
29 import UTF8 from 'utf-8'; 29 import UTF8 from 'utf-8';
30 30
31 let loger = Loger.getLoger('McuClient'); 31 let loger = Loger.getLoger('McuClient');
32 -let _sdkInfo = {"version": "v1.29.1.20170601", "author": "www.3mang.com"}; 32 +let _sdkInfo = {"version": "v1.29.2.20170601", "author": "www.3mang.com"};
33 33
34 //APE 34 //APE
35 let _sass; 35 let _sass;
@@ -42,7 +42,6 @@ let _audio_ape; @@ -42,7 +42,6 @@ let _audio_ape;
42 let _doc_ape; 42 let _doc_ape;
43 let _whiteboard_ape; 43 let _whiteboard_ape;
44 let _recordPlayback; 44 let _recordPlayback;
45 -let _thirdMessage;  
46 45
47 //MCUClient 外部实例化主类 46 //MCUClient 外部实例化主类
48 export default class MessageEntrance extends Emiter { 47 export default class MessageEntrance extends Emiter {
@@ -62,9 +61,6 @@ export default class MessageEntrance extends Emiter { @@ -62,9 +61,6 @@ export default class MessageEntrance extends Emiter {
62 //全局的Error处理 61 //全局的Error处理
63 this.on(MessageTypes.MCU_ERROR, this._mcuErrorHandler.bind(this)); 62 this.on(MessageTypes.MCU_ERROR, this._mcuErrorHandler.bind(this));
64 63
65 - //  
66 - _thirdMessage=new ThirdMessage();  
67 -  
68 // Sass平台层 64 // Sass平台层
69 _sass = Sass; 65 _sass = Sass;
70 _sass.on('*', (type, data) => this._emit(type, data)); 66 _sass.on('*', (type, data) => this._emit(type, data));
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 import Ape from './Ape'; 5 import Ape from './Ape';
6 import ApeConsts from './ApeConsts'; 6 import ApeConsts from './ApeConsts';
  7 +import ThirdMessage from './ThirdMessage';
7 import MessageTypes from 'MessageTypes'; 8 import MessageTypes from 'MessageTypes';
8 import pdu from 'pdus'; 9 import pdu from 'pdus';
9 import { Zlib } from 'zlibjs/bin/zlib.min'; 10 import { Zlib } from 'zlibjs/bin/zlib.min';
@@ -26,6 +27,10 @@ class ConferApe extends Ape { @@ -26,6 +27,10 @@ class ConferApe extends Ape {
26 this.rosters = {};//用户列表 27 this.rosters = {};//用户列表
27 this.timerCounter = new TimerCounter();//计时器 28 this.timerCounter = new TimerCounter();//计时器
28 29
  30 + //第三方消息控制 parent和Iframe直接的通讯
  31 + this.thirdMessage=new ThirdMessage();
  32 + this.thirdMessage.on(ThirdMessage.RECIVE_MESSAGE,this.onThirdReciveParentMessage.bind(this));
  33 +
29 // Ape Models 34 // Ape Models
30 this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); 35 this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer);
31 36
@@ -635,6 +640,10 @@ class ConferApe extends Ape { @@ -635,6 +640,10 @@ class ConferApe extends Ape {
635 } 640 }
636 641
637 //-------------第三方消息------------------------------ 642 //-------------第三方消息------------------------------
  643 + //收到父级页面的消息,需要广播发送出去
  644 + onThirdReciveParentMessage(_msg){
  645 + loger.log('收到页面的消息->广播给其他模块->',_msg);
  646 + }
638 //发送第三方广播消息 647 //发送第三方广播消息
639 sendThirdBroadcastData(_param){ 648 sendThirdBroadcastData(_param){
640 loger.log("发送第三方广播消息->",_param); 649 loger.log("发送第三方广播消息->",_param);
@@ -7,26 +7,33 @@ class ThirdMessage extends Emiter{ @@ -7,26 +7,33 @@ class ThirdMessage extends Emiter{
7 constructor(){ 7 constructor(){
8 super(); 8 super();
9 // 初始化消息通道 9 // 初始化消息通道
10 - this.messenger = new Messenger('xuedianyunIframe', 'ParentMessengerChannel');  
11 - this.messenger.addTarget(window.parent, 'parent');  
12 - this.messenger.listen(this.reciveThirdMessage.bind(this))  
13 - loger.log('ThirdMessage->'); 10 + this.messenger = new Messenger(ThirdMessage.IFRAME_MESSAGE_ID, ThirdMessage.PARENT_MESAGE_ID);
  11 + this.messenger.addTarget(window.parent, ThirdMessage.PARENT);
  12 + this.messenger.listen(this._reciveParentMessage.bind(this))
  13 + loger.log('ThirdMessage');
14 } 14 }
15 15
16 - //发送消息  
17 - sendMessage(){  
18 - // 根据自己的业务组装对象  
19 - let jsonObj = { 16 + //发送消息给父级页面
  17 + sendMessageToParent(_msg){
  18 + //// 根据自己的业务组装对象
  19 + /* let jsonObj = {
20 username: 'sdk', 20 username: 'sdk',
21 message: 'sdk->hello world', 21 message: 'sdk->hello world',
22 } 22 }
23 - this.messenger.send(JSON.stringify(jsonObj)); 23 + this.messenger.send(JSON.stringify(jsonObj));*/
  24 + if(this.messenger){
  25 + this.messenger.send(_msg);
  26 + }
24 } 27 }
25 - reciveThirdMessage(_data){  
26 - loger.log('来自父级页面的的消息:', _data);  
27 - // **发送前必须转JSON格式**  
28 - this.sendMessage(); 28 + //收到父级页面的消息
  29 + _reciveParentMessage(_msg){
  30 + loger.log('收到父级页面的的消息->', _msg);
  31 + this._emit(ThirdMessage.RECIVE_MESSAGE,_msg);
29 } 32 }
30 33
31 } 34 }
  35 +ThirdMessage.prototype.RECIVE_MESSAGE=ThirdMessage.RECIVE_MESSAGE='recive_message';
  36 +ThirdMessage.prototype.IFRAME_MESSAGE_ID=ThirdMessage.IFRAME_MESSAGE_ID='xuedianyunIframe';
  37 +ThirdMessage.prototype.PARENT_MESAGE_ID=ThirdMessage.PARENT_MESAGE_ID='ParentMessengerChannel';
  38 +ThirdMessage.prototype.PARENT=ThirdMessage.PARENT='parent';
32 export default ThirdMessage; 39 export default ThirdMessage;