正在显示
7 个修改的文件
包含
55 行增加
和
8 行删除
| @@ -35,7 +35,7 @@ import QuestionApe from 'apes/QuestionApe'; | @@ -35,7 +35,7 @@ import QuestionApe from 'apes/QuestionApe'; | ||
| 35 | import UTF8 from 'utf-8'; | 35 | import UTF8 from 'utf-8'; |
| 36 | 36 | ||
| 37 | let loger = Loger.getLoger('McuClient'); | 37 | let loger = Loger.getLoger('McuClient'); |
| 38 | -let _sdkInfo = { "version": "v1.49.1.20170724", "author": "www.3mang.com" }; | 38 | +let _sdkInfo = { "version": "v1.50.7.20170724", "author": "www.3mang.com" }; |
| 39 | 39 | ||
| 40 | //APE | 40 | //APE |
| 41 | let _sass; | 41 | let _sass; |
| @@ -168,6 +168,8 @@ export default class MessageEntrance extends Emiter { | @@ -168,6 +168,8 @@ export default class MessageEntrance extends Emiter { | ||
| 168 | 168 | ||
| 169 | this.kickOutRosterFormNodeId= this._kickOutRosterFormNodeId.bind(this); //把指定nodeId的人踢出课堂 | 169 | this.kickOutRosterFormNodeId= this._kickOutRosterFormNodeId.bind(this); //把指定nodeId的人踢出课堂 |
| 170 | 170 | ||
| 171 | + this.sendThridChannelMessage=this._sendThridChannelMessage.bind(this);//通道第三方消息通道发送消息 | ||
| 172 | + | ||
| 171 | //录制回放 | 173 | //录制回放 |
| 172 | this.initRecordPlayback = this._initRecordPlayback.bind(this); | 174 | this.initRecordPlayback = this._initRecordPlayback.bind(this); |
| 173 | this.startRecordPlayback = this._startRecordPlayback.bind(this); | 175 | this.startRecordPlayback = this._startRecordPlayback.bind(this); |
| @@ -433,13 +435,21 @@ export default class MessageEntrance extends Emiter { | @@ -433,13 +435,21 @@ export default class MessageEntrance extends Emiter { | ||
| 433 | GlobalConfig.isRecordPlayBack = false; //设置为非录制回放状态 | 435 | GlobalConfig.isRecordPlayBack = false; //设置为非录制回放状态 |
| 434 | GlobalConfig.classId = parseInt(_param.classId); | 436 | GlobalConfig.classId = parseInt(_param.classId); |
| 435 | GlobalConfig.portal = _param.portal; | 437 | GlobalConfig.portal = _param.portal; |
| 438 | + | ||
| 439 | + //H5处理 | ||
| 436 | GlobalConfig.isH5=_param.isH5||false;//外部传入的参数,是否是H5 | 440 | GlobalConfig.isH5=_param.isH5||false;//外部传入的参数,是否是H5 |
| 437 | if(GlobalConfig.isH5==true){ | 441 | if(GlobalConfig.isH5==true){ |
| 438 | GlobalConfig.platform = "H5"; | 442 | GlobalConfig.platform = "H5"; |
| 439 | GlobalConfig.deviceType=3//3是H5 | 443 | GlobalConfig.deviceType=3//3是H5 |
| 440 | loger.warn("设备类型是H5"); | 444 | loger.warn("设备类型是H5"); |
| 441 | } | 445 | } |
| 442 | - //GlobalConfig.userId = _param.userId || "0"; | 446 | + |
| 447 | + //IOS 安卓处理,需要外部传入摄像头和麦克风信息 | ||
| 448 | + if(GlobalConfig.isMobile){ | ||
| 449 | + GlobalConfig.cameras=_param.cameras||[]; | ||
| 450 | + GlobalConfig.cameras=_param.microphones||[]; | ||
| 451 | + } | ||
| 452 | + | ||
| 443 | //如果没有名字,随机起一个名字 | 453 | //如果没有名字,随机起一个名字 |
| 444 | GlobalConfig.userName = _param.userName || "user_" + (new Date().getTime() % 1000000); | 454 | GlobalConfig.userName = _param.userName || "user_" + (new Date().getTime() % 1000000); |
| 445 | 455 | ||
| @@ -1057,6 +1067,17 @@ export default class MessageEntrance extends Emiter { | @@ -1057,6 +1067,17 @@ export default class MessageEntrance extends Emiter { | ||
| 1057 | } | 1067 | } |
| 1058 | } | 1068 | } |
| 1059 | 1069 | ||
| 1070 | + //通过第三方消息通道发送消息 | ||
| 1071 | + _sendThridChannelMessage(_param){ | ||
| 1072 | + if (!_mcu.connected) { | ||
| 1073 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1074 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1075 | + } | ||
| 1076 | + if (_confer_ape) { | ||
| 1077 | + _confer_ape.onThirdReciveParentMessage(_param); | ||
| 1078 | + } | ||
| 1079 | + } | ||
| 1080 | + | ||
| 1060 | //将指定nodeId的人踢出课堂 | 1081 | //将指定nodeId的人踢出课堂 |
| 1061 | _kickOutRosterFormNodeId(_param){ | 1082 | _kickOutRosterFormNodeId(_param){ |
| 1062 | if (!_mcu.connected) { | 1083 | if (!_mcu.connected) { |
| @@ -39,7 +39,8 @@ MessageTypes.CLASS_UPDATE_TIMER = "class_update_timer"; //'class.update.timer';/ | @@ -39,7 +39,8 @@ MessageTypes.CLASS_UPDATE_TIMER = "class_update_timer"; //'class.update.timer';/ | ||
| 39 | MessageTypes.CLASS_RECORD_STOP = "class_record_stop"; //;//停止录制 | 39 | MessageTypes.CLASS_RECORD_STOP = "class_record_stop"; //;//停止录制 |
| 40 | MessageTypes.CLASS_RECORD_START = "class_record_start"; //;//开始录制 | 40 | MessageTypes.CLASS_RECORD_START = "class_record_start"; //;//开始录制 |
| 41 | MessageTypes.CLASS_RECORD_SUCCESS = "class_record_success"; ////操作录制状态成功 | 41 | MessageTypes.CLASS_RECORD_SUCCESS = "class_record_success"; ////操作录制状态成功 |
| 42 | - | 42 | +//第三方消息通道 |
| 43 | +MessageTypes.RECEIVE_THIRD_MESSGAE="receive_third_message";//接收到第三方消息 | ||
| 43 | //聊天模块事件定义 | 44 | //聊天模块事件定义 |
| 44 | MessageTypes.CHAT_RECEIVE = "chat_receive_message"; // 'chat.receive'; | 45 | MessageTypes.CHAT_RECEIVE = "chat_receive_message"; // 'chat.receive'; |
| 45 | 46 |
| @@ -85,7 +85,7 @@ class ChatApe extends Ape { | @@ -85,7 +85,7 @@ class ChatApe extends Ape { | ||
| 85 | chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2); | 85 | chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2); |
| 86 | chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2); | 86 | chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2); |
| 87 | chatMsg.fromRole = chatReceivePdu.fromRole; | 87 | chatMsg.fromRole = chatReceivePdu.fromRole; |
| 88 | - | 88 | + chatMsg.msgType=chatReceivePdu.msgType||0; |
| 89 | loger.log('接收聊天消息.', chatMsg); | 89 | loger.log('接收聊天消息.', chatMsg); |
| 90 | 90 | ||
| 91 | this._emit(MessageTypes.CHAT_RECEIVE, chatMsg); | 91 | this._emit(MessageTypes.CHAT_RECEIVE, chatMsg); |
| @@ -739,7 +739,14 @@ class ConferApe extends Ape { | @@ -739,7 +739,14 @@ class ConferApe extends Ape { | ||
| 739 | //收到父级页面的消息,需要广播发送出去 | 739 | //收到父级页面的消息,需要广播发送出去 |
| 740 | onThirdReciveParentMessage(_msg) { | 740 | onThirdReciveParentMessage(_msg) { |
| 741 | loger.log('收到页面的消息->广播给其他模块->', _msg); | 741 | loger.log('收到页面的消息->广播给其他模块->', _msg); |
| 742 | - this.sendThirdBroadcastData({to: 0, message: _msg}); | 742 | + //尝试将外部传入的数据转换为JSON 字符串 |
| 743 | + let _message=_msg; | ||
| 744 | + try{ | ||
| 745 | + _message=JSON.parse(_msg); | ||
| 746 | + }catch(err){ | ||
| 747 | + | ||
| 748 | + } | ||
| 749 | + this.sendThirdBroadcastData({to: 0, message: _message}); | ||
| 743 | } | 750 | } |
| 744 | 751 | ||
| 745 | //发送第三方广播消息 | 752 | //发送第三方广播消息 |
| @@ -759,7 +766,15 @@ class ConferApe extends Ape { | @@ -759,7 +766,15 @@ class ConferApe extends Ape { | ||
| 759 | thirdBroadcastSendPdu.initiator = this._classInfo.nodeId; //发起人 | 766 | thirdBroadcastSendPdu.initiator = this._classInfo.nodeId; //发起人 |
| 760 | thirdBroadcastSendPdu.peer = parseInt(_param.to) || 0; //发送给谁,公聊的时候是0,私聊的时候是指定的用户id | 767 | thirdBroadcastSendPdu.peer = parseInt(_param.to) || 0; //发送给谁,公聊的时候是0,私聊的时候是指定的用户id |
| 761 | thirdBroadcastSendPdu.isPublic = true; | 768 | thirdBroadcastSendPdu.isPublic = true; |
| 762 | - thirdBroadcastSendPdu.message = this._rCArrayBufferUtil.strToUint8Array("h5" + _param.message); | 769 | + let messageStr=_param.message||""; |
| 770 | + | ||
| 771 | + //尝试把信息转换为JSON 字符串,如果是字符串就不需要转 | ||
| 772 | + try{ | ||
| 773 | + messageStr=JSON.stringify(messageStr); | ||
| 774 | + }catch (err){ | ||
| 775 | + | ||
| 776 | + } | ||
| 777 | + thirdBroadcastSendPdu.message = this._rCArrayBufferUtil.strToUint8Array("h5" + messageStr); | ||
| 763 | 778 | ||
| 764 | if (!thirdBroadcastSendPdu.isPublic && 0 != thirdBroadcastSendPdu.peer) { | 779 | if (!thirdBroadcastSendPdu.isPublic && 0 != thirdBroadcastSendPdu.peer) { |
| 765 | //发送给制定的人 | 780 | //发送给制定的人 |
| @@ -780,6 +795,7 @@ class ConferApe extends Ape { | @@ -780,6 +795,7 @@ class ConferApe extends Ape { | ||
| 780 | //loger.log("监听第三方消息通道消息->1", thirdMessage); | 795 | //loger.log("监听第三方消息通道消息->1", thirdMessage); |
| 781 | thirdMessage.message = this._rCArrayBufferUtil.uint8ArrayToStr(thirdBroadcastReceivePdu.message, 2); | 796 | thirdMessage.message = this._rCArrayBufferUtil.uint8ArrayToStr(thirdBroadcastReceivePdu.message, 2); |
| 782 | loger.log("监听第三方消息通道消息->", thirdMessage); | 797 | loger.log("监听第三方消息通道消息->", thirdMessage); |
| 798 | + this._emit(MessageTypes.RECEIVE_THIRD_MESSGAE,thirdMessage); | ||
| 783 | if (this.thirdMessage) { | 799 | if (this.thirdMessage) { |
| 784 | this.thirdMessage.sendMessageToParent(thirdMessage.message); | 800 | this.thirdMessage.sendMessageToParent(thirdMessage.message); |
| 785 | } | 801 | } |
| @@ -405,6 +405,7 @@ class MediaSharedApe extends Ape { | @@ -405,6 +405,7 @@ class MediaSharedApe extends Ape { | ||
| 405 | getMediaPackFullInfo.mediaVolume==this.lastActiveData.mediaVolume){ | 405 | getMediaPackFullInfo.mediaVolume==this.lastActiveData.mediaVolume){ |
| 406 | let timeDistance=Math.abs(new Date().getTime()-parseInt(this.lastActiveData.time))/1000; | 406 | let timeDistance=Math.abs(new Date().getTime()-parseInt(this.lastActiveData.time))/1000; |
| 407 | let seekDistance=Math.abs(getMediaPackFullInfo.seek-this.lastActiveData.seek)-timeDistance; | 407 | let seekDistance=Math.abs(getMediaPackFullInfo.seek-this.lastActiveData.seek)-timeDistance; |
| 408 | + seekDistance=Math.abs(seekDistance); | ||
| 408 | if(seekDistance<=5){ | 409 | if(seekDistance<=5){ |
| 409 | //记录最后一次的数据 | 410 | //记录最后一次的数据 |
| 410 | loger.warn("媒体共享更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"+timeDistance+"->seekDistance"+seekDistance); | 411 | loger.warn("媒体共享更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"+timeDistance+"->seekDistance"+seekDistance); |
| @@ -399,10 +399,11 @@ class MusicSharedApe extends Ape { | @@ -399,10 +399,11 @@ class MusicSharedApe extends Ape { | ||
| 399 | if(this.lastActiveData&&this.lastActiveData.status==1){ | 399 | if(this.lastActiveData&&this.lastActiveData.status==1){ |
| 400 | if(getMusicPackFullInfo&& | 400 | if(getMusicPackFullInfo&& |
| 401 | getMusicPackFullInfo.status==1&& | 401 | getMusicPackFullInfo.status==1&& |
| 402 | - getMusicPackFullInfo.mediaVolume==this.lastActiveData.mediaVolume){ | 402 | + getMusicPackFullInfo.musicVolume==this.lastActiveData.musicVolume){ |
| 403 | 403 | ||
| 404 | let timeDistance=Math.abs(new Date().getTime()-parseInt(this.lastActiveData.time))/1000; | 404 | let timeDistance=Math.abs(new Date().getTime()-parseInt(this.lastActiveData.time))/1000; |
| 405 | let seekDistance=Math.abs(getMusicPackFullInfo.seek-this.lastActiveData.seek)-timeDistance; | 405 | let seekDistance=Math.abs(getMusicPackFullInfo.seek-this.lastActiveData.seek)-timeDistance; |
| 406 | + seekDistance=Math.abs(seekDistance); | ||
| 406 | if(seekDistance<5){ | 407 | if(seekDistance<5){ |
| 407 | //记录最后一次的数据 | 408 | //记录最后一次的数据 |
| 408 | loger.warn("伴音更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"+timeDistance+"->seekDistance"+seekDistance); | 409 | loger.warn("伴音更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"+timeDistance+"->seekDistance"+seekDistance); |
| @@ -26,8 +26,15 @@ class ThirdMessage extends Emiter{ | @@ -26,8 +26,15 @@ class ThirdMessage extends Emiter{ | ||
| 26 | return; | 26 | return; |
| 27 | } | 27 | } |
| 28 | if(this.messenger){ | 28 | if(this.messenger){ |
| 29 | + let sendMsg=""; | ||
| 30 | + //尝试转换为JSON 字符串 | ||
| 31 | + try{ | ||
| 32 | + sendMsg=JSON.stringify(_msg); | ||
| 33 | + }catch (err){ | ||
| 34 | + sendMsg=_msg; | ||
| 35 | + } | ||
| 29 | loger.log('发送消息给父级页面->',_msg); | 36 | loger.log('发送消息给父级页面->',_msg); |
| 30 | - this.messenger.send(_msg); | 37 | + this.messenger.send(sendMsg); |
| 31 | } | 38 | } |
| 32 | } | 39 | } |
| 33 | //收到父级页面的消息 | 40 | //收到父级页面的消息 |
-
请 注册 或 登录 后发表评论