1.在课堂状态发生改变的时候,需要判断是否需要停止推流,这个会影响到课堂录制的消息2.在课堂状态信息更新的数据中增加是否需要停止当前音视频推流的字段;3.增加是否需要停止当前推流的事件监听消息;
正在显示
5 个修改的文件
包含
44 行增加
和
21 行删除
此 diff 太大无法显示。
| @@ -23,11 +23,12 @@ import ApeConsts from 'apes/ApeConsts'; | @@ -23,11 +23,12 @@ import ApeConsts from 'apes/ApeConsts'; | ||
| 23 | import Base64 from 'base64-js'; | 23 | import Base64 from 'base64-js'; |
| 24 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | 24 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; |
| 25 | import Server from "config/Server"; | 25 | import Server from "config/Server"; |
| 26 | +import MediaModule from 'apes/MediaModule'; | ||
| 26 | 27 | ||
| 27 | import UTF8 from 'utf-8'; | 28 | import UTF8 from 'utf-8'; |
| 28 | 29 | ||
| 29 | let loger = Loger.getLoger('McuClient'); | 30 | let loger = Loger.getLoger('McuClient'); |
| 30 | -let _sdkInfo = {"version": "v1.18.0.201705010", "author": "www.3mang.com"}; | 31 | +let _sdkInfo = {"version": "v1.19.0.201705011", "author": "www.3mang.com"}; |
| 31 | 32 | ||
| 32 | //APE | 33 | //APE |
| 33 | let _sass; | 34 | let _sass; |
| @@ -97,7 +98,7 @@ export default class MessageEntrance extends Emiter { | @@ -97,7 +98,7 @@ export default class MessageEntrance extends Emiter { | ||
| 97 | _confer_ape.on(MessageTypes.CLASS_RECORD_START, this._onClassRecordStart.bind(this));//课堂开始录制 | 98 | _confer_ape.on(MessageTypes.CLASS_RECORD_START, this._onClassRecordStart.bind(this));//课堂开始录制 |
| 98 | _confer_ape.on(MessageTypes.CLASS_RECORD_SUCCESS, this._onClassRecordSuccess.bind(this));//课堂开启录制成功 | 99 | _confer_ape.on(MessageTypes.CLASS_RECORD_SUCCESS, this._onClassRecordSuccess.bind(this));//课堂开启录制成功 |
| 99 | _confer_ape.on(MessageTypes.SWITCH_MS_IP, this._switchMsIpHandler.bind(this));//MS动态选点 | 100 | _confer_ape.on(MessageTypes.SWITCH_MS_IP, this._switchMsIpHandler.bind(this));//MS动态选点 |
| 100 | - | 101 | + _confer_ape.on(MessageTypes.STOP_ALL_MEDIA_PUBLISH, this._stopAllMediaPublishHandler.bind(this));//课堂状态发生改变,需要停止当前的所有推流 |
| 101 | 102 | ||
| 102 | _chat_ape = new ChatApe(); | 103 | _chat_ape = new ChatApe(); |
| 103 | _chat_ape.on('*', (type, data) => this._emit(type, data)); | 104 | _chat_ape.on('*', (type, data) => this._emit(type, data)); |
| @@ -863,6 +864,19 @@ export default class MessageEntrance extends Emiter { | @@ -863,6 +864,19 @@ export default class MessageEntrance extends Emiter { | ||
| 863 | }); | 864 | }); |
| 864 | } | 865 | } |
| 865 | 866 | ||
| 867 | + //课堂状态发生改变,需要停止当前的所有推流 | ||
| 868 | + _stopAllMediaPublishHandler(_data){ | ||
| 869 | + let allChannels=MediaModule.allMediaChannelsList; | ||
| 870 | + let channl=null; | ||
| 871 | + for(let i in allChannels){ | ||
| 872 | + channl=allChannels[i]; | ||
| 873 | + if(channl&&channl.status==ApeConsts.CHANNEL_STATUS_OPENING&&channl.fromNodeId==GlobalConfig.nodeId){ | ||
| 874 | + this._emit(MessageTypes.MEDIA_STOP_PUBLISH); | ||
| 875 | + return; | ||
| 876 | + } | ||
| 877 | + } | ||
| 878 | + } | ||
| 879 | + | ||
| 866 | //切换MS ->_param->{reConnect:false} //reConnect(是否立即替换当前的ip并且重新连接) | 880 | //切换MS ->_param->{reConnect:false} //reConnect(是否立即替换当前的ip并且重新连接) |
| 867 | _switchMsIpHandler(_param) { | 881 | _switchMsIpHandler(_param) { |
| 868 | if (GlobalConfig.isRecordPlayBack) { | 882 | if (GlobalConfig.isRecordPlayBack) { |
| @@ -31,14 +31,19 @@ MessageTypes.CLASS_STATUS_INFO_CHANGE="class_status_info_change";// 'class.statu | @@ -31,14 +31,19 @@ MessageTypes.CLASS_STATUS_INFO_CHANGE="class_status_info_change";// 'class.statu | ||
| 31 | 31 | ||
| 32 | MessageTypes.CLASS_UPDATE_TIMER="class_update_timer";//'class.update.timer';//更新当前上课的时间 | 32 | MessageTypes.CLASS_UPDATE_TIMER="class_update_timer";//'class.update.timer';//更新当前上课的时间 |
| 33 | 33 | ||
| 34 | +MessageTypes.CLASS_RECORD_STOP="class_record_stop";//;//停止录制 | ||
| 34 | MessageTypes.CLASS_RECORD_START="class_record_start";//;//开始录制 | 35 | MessageTypes.CLASS_RECORD_START="class_record_start";//;//开始录制 |
| 35 | -MessageTypes.CLASS_RECORD_SUCCESS="class_record_success";////开启录制成功 | 36 | +MessageTypes.CLASS_RECORD_SUCCESS="class_record_success";////操作录制状态成功 |
| 37 | + | ||
| 38 | + | ||
| 36 | 39 | ||
| 37 | 40 | ||
| 38 | //聊天模块事件定义 | 41 | //聊天模块事件定义 |
| 39 | MessageTypes.CHAT_RECEIVE ="chat_receive_message";// 'chat.receive'; | 42 | MessageTypes.CHAT_RECEIVE ="chat_receive_message";// 'chat.receive'; |
| 40 | 43 | ||
| 41 | //视频模块事件定义 | 44 | //视频模块事件定义 |
| 45 | +MessageTypes.STOP_ALL_MEDIA_PUBLISH= "stop_all_media_publish";//停止所有音视频推流 | ||
| 46 | +MessageTypes.MEDIA_STOP_PUBLISH= "media_stop_publish";//发送给应用层的停止推流消息 | ||
| 42 | MessageTypes.USER_DEVICE_STATUS_CHAANGE ="user_device_status_change";// 'video.play';//播放视频 | 47 | MessageTypes.USER_DEVICE_STATUS_CHAANGE ="user_device_status_change";// 'video.play';//播放视频 |
| 43 | MessageTypes.VIDEO_PLAY ="video_play";// 'video.play';//播放视频 | 48 | MessageTypes.VIDEO_PLAY ="video_play";// 'video.play';//播放视频 |
| 44 | MessageTypes.VIDEO_STOP ="video_stop"; //'video.stop';//停止视频 | 49 | MessageTypes.VIDEO_STOP ="video_stop"; //'video.stop';//停止视频 |
| @@ -255,7 +255,6 @@ class ConferApe extends Ape { | @@ -255,7 +255,6 @@ class ConferApe extends Ape { | ||
| 255 | GlobalConfig.classStopTime = EngineUtils.creatTimestampStr(); | 255 | GlobalConfig.classStopTime = EngineUtils.creatTimestampStr(); |
| 256 | this.sendConferRecordMsg({"recordStatus": true}); | 256 | this.sendConferRecordMsg({"recordStatus": true}); |
| 257 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | 257 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); |
| 258 | - this._emit(MessageTypes.CLASS_RECORD_START);//课堂开始录制 | ||
| 259 | } | 258 | } |
| 260 | } | 259 | } |
| 261 | 260 | ||
| @@ -321,7 +320,7 @@ class ConferApe extends Ape { | @@ -321,7 +320,7 @@ class ConferApe extends Ape { | ||
| 321 | GlobalConfig.classStopTime = EngineUtils.creatTimestampStr(); | 320 | GlobalConfig.classStopTime = EngineUtils.creatTimestampStr(); |
| 322 | this.stopRecord(); | 321 | this.stopRecord(); |
| 323 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | 322 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); |
| 324 | - this.sendUpdaterClassStatusInfo({"actionType": 0}); | 323 | + this.sendUpdaterClassStatusInfo({"actionType": 0,isStopAllPublishMedia:true}); |
| 325 | loger.log('restorClass'); | 324 | loger.log('restorClass'); |
| 326 | } | 325 | } |
| 327 | 326 | ||
| @@ -349,12 +348,12 @@ class ConferApe extends Ape { | @@ -349,12 +348,12 @@ class ConferApe extends Ape { | ||
| 349 | //课堂状态改变 | 348 | //课堂状态改变 |
| 350 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | 349 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); |
| 351 | //同步课堂状态 | 350 | //同步课堂状态 |
| 352 | - this.sendUpdaterClassStatusInfo({"actionType": 1}); | 351 | + this.sendUpdaterClassStatusInfo({"actionType": 1,isStopAllPublishMedia:true}); |
| 353 | 352 | ||
| 354 | //开始计时 | 353 | //开始计时 |
| 355 | this.startTimerCounter(); | 354 | this.startTimerCounter(); |
| 356 | } else { | 355 | } else { |
| 357 | - loger.warn('没有权限'); | 356 | + loger.warn('没有开始课堂的权限'); |
| 358 | } | 357 | } |
| 359 | } | 358 | } |
| 360 | 359 | ||
| @@ -369,7 +368,7 @@ class ConferApe extends Ape { | @@ -369,7 +368,7 @@ class ConferApe extends Ape { | ||
| 369 | 368 | ||
| 370 | this.stopRecord(); | 369 | this.stopRecord(); |
| 371 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE,_param); | 370 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE,_param); |
| 372 | - this.sendUpdaterClassStatusInfo({"actionType": 2}); | 371 | + this.sendUpdaterClassStatusInfo({"actionType": 2,isStopAllPublishMedia:true}); |
| 373 | this.stopTimerCounter(); | 372 | this.stopTimerCounter(); |
| 374 | } | 373 | } |
| 375 | 374 | ||
| @@ -415,19 +414,18 @@ class ConferApe extends Ape { | @@ -415,19 +414,18 @@ class ConferApe extends Ape { | ||
| 415 | 414 | ||
| 416 | //更新课堂信息 | 415 | //更新课堂信息 |
| 417 | sendUpdaterClassStatusInfo(_param) { | 416 | sendUpdaterClassStatusInfo(_param) { |
| 418 | - loger.log('更新课堂信息->'); | 417 | + //{"actionType": 1,isStopAllPublishMedia:false} //actionType课堂状态 isStopAllPublishMedia是否停止当前的所有推流 |
| 418 | + loger.log('发送更新课堂信息->'); | ||
| 419 | if (_param == null || EngineUtils.isEmptyObject(_param)) { | 419 | if (_param == null || EngineUtils.isEmptyObject(_param)) { |
| 420 | - loger.log('更新课堂信息->参数错误'); | 420 | + loger.log('发送更新课堂信息->参数错误'); |
| 421 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 421 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 422 | return; | 422 | return; |
| 423 | } | 423 | } |
| 424 | itemIdx = ApeConsts.CONFERENCE_OBJ_TABLE_ID;// itemIdx=_param.itemIdx; | 424 | itemIdx = ApeConsts.CONFERENCE_OBJ_TABLE_ID;// itemIdx=_param.itemIdx; |
| 425 | let modelPdu = this.packPdu(_param, itemIdx); | 425 | let modelPdu = this.packPdu(_param, itemIdx); |
| 426 | - //loger.log('sendUpdaterClassStatusInfo----2------'); | ||
| 427 | loger.log(modelPdu); | 426 | loger.log(modelPdu); |
| 428 | - | ||
| 429 | if (modelPdu == null) { | 427 | if (modelPdu == null) { |
| 430 | - loger.log('更新课堂信息->参数错误'); | 428 | + loger.log('发送更新课堂信息->参数错误'); |
| 431 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 429 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 432 | return; | 430 | return; |
| 433 | } | 431 | } |
| @@ -461,7 +459,6 @@ class ConferApe extends Ape { | @@ -461,7 +459,6 @@ class ConferApe extends Ape { | ||
| 461 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 459 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 462 | adapterPdu.item.push(adapterItemPdu); | 460 | adapterPdu.item.push(adapterItemPdu); |
| 463 | 461 | ||
| 464 | - loger.log("更新课堂信息->发送更新数据"); | ||
| 465 | this.sendUniform(adapterPdu, true); | 462 | this.sendUniform(adapterPdu, true); |
| 466 | } | 463 | } |
| 467 | 464 | ||
| @@ -532,7 +529,7 @@ class ConferApe extends Ape { | @@ -532,7 +529,7 @@ class ConferApe extends Ape { | ||
| 532 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | 529 | this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); |
| 533 | 530 | ||
| 534 | //同步消息给其他人 | 531 | //同步消息给其他人 |
| 535 | - this.sendUpdaterClassStatusInfo({"actionType": 1}); | 532 | + this.sendUpdaterClassStatusInfo({"actionType": 1,isStopAllPublishMedia:false}); |
| 536 | } | 533 | } |
| 537 | } | 534 | } |
| 538 | 535 | ||
| @@ -545,12 +542,17 @@ class ConferApe extends Ape { | @@ -545,12 +542,17 @@ class ConferApe extends Ape { | ||
| 545 | tableUpdateHandler(owner, itemIdx, itemData) { | 542 | tableUpdateHandler(owner, itemIdx, itemData) { |
| 546 | try { | 543 | try { |
| 547 | let model = this.unPackPdu(owner, itemIdx, itemData); | 544 | let model = this.unPackPdu(owner, itemIdx, itemData); |
| 548 | - loger.log('tableUpdateHandler'); | 545 | + loger.log('课堂数据更新'); |
| 549 | loger.log(model); | 546 | loger.log(model); |
| 550 | 547 | ||
| 551 | //处理课堂更新的信息 | 548 | //处理课堂更新的信息 |
| 552 | if (model && model.classStatusInfo) { | 549 | if (model && model.classStatusInfo) { |
| 553 | GlobalConfig.setClassStatusInfo(model.classStatusInfo); | 550 | GlobalConfig.setClassStatusInfo(model.classStatusInfo); |
| 551 | + | ||
| 552 | + if( model.classStatusInfo.isStopAllPublishMedia){ | ||
| 553 | + //课堂状态发送改变 需要对当前正在推的流进行停止,因为录制的问题; | ||
| 554 | + this._emit(MessageTypes.STOP_ALL_MEDIA_PUBLISH); | ||
| 555 | + } | ||
| 554 | } | 556 | } |
| 555 | //通知应用层更新课堂状态 | 557 | //通知应用层更新课堂状态 |
| 556 | this._emit(MessageTypes.CLASS_UPTATE_STATUS, GlobalConfig.classStatusInfo); | 558 | this._emit(MessageTypes.CLASS_UPTATE_STATUS, GlobalConfig.classStatusInfo); |
| @@ -616,19 +618,19 @@ class ConferApe extends Ape { | @@ -616,19 +618,19 @@ class ConferApe extends Ape { | ||
| 616 | try { | 618 | try { |
| 617 | let conferRecordSendPdu = pdu['RCConferenceRecordRequestPdu'].decode(_data); | 619 | let conferRecordSendPdu = pdu['RCConferenceRecordRequestPdu'].decode(_data); |
| 618 | // {"initiator":820461225,"record":false,"classTime":3213,"filename":"h5dev/20170410/1437784290_20170410.rec"} | 620 | // {"initiator":820461225,"record":false,"classTime":3213,"filename":"h5dev/20170410/1437784290_20170410.rec"} |
| 619 | - loger.log("onSendConferRecordRequestHandler->",conferRecordSendPdu); | 621 | + loger.log("录制回放控制操作成功->",conferRecordSendPdu); |
| 620 | if(conferRecordSendPdu&&conferRecordSendPdu.record==true||conferRecordSendPdu.record=="true"){ | 622 | if(conferRecordSendPdu&&conferRecordSendPdu.record==true||conferRecordSendPdu.record=="true"){ |
| 621 | //每次开启录制的时候,需要把当前显示的文档数据更新一次,否则无法录制已经显示的文件 | 623 | //每次开启录制的时候,需要把当前显示的文档数据更新一次,否则无法录制已经显示的文件 |
| 622 | this._emit(MessageTypes.CLASS_RECORD_SUCCESS); | 624 | this._emit(MessageTypes.CLASS_RECORD_SUCCESS); |
| 623 | } | 625 | } |
| 624 | } catch (err) { | 626 | } catch (err) { |
| 625 | - loger.warn("onSendConferRecordRequestHandler err", err.message); | 627 | + loger.warn("录制回放控制操作错误->", err.message); |
| 626 | } | 628 | } |
| 627 | 629 | ||
| 628 | } | 630 | } |
| 629 | 631 | ||
| 630 | rosterInsertHandler(nodeId, nodeData) { | 632 | rosterInsertHandler(nodeId, nodeData) { |
| 631 | - loger.log("rosterInsertHandler--->"); | 633 | + //loger.log("人员进入--->"); |
| 632 | if (GlobalConfig.nodeId == nodeId) { | 634 | if (GlobalConfig.nodeId == nodeId) { |
| 633 | 635 | ||
| 634 | } else { | 636 | } else { |
| @@ -834,8 +836,9 @@ class ConferApe extends Ape { | @@ -834,8 +836,9 @@ class ConferApe extends Ape { | ||
| 834 | classStatusInfo.serverTimestamp = GlobalConfig.serverTimestamp;//当前的系统时间戳 | 836 | classStatusInfo.serverTimestamp = GlobalConfig.serverTimestamp;//当前的系统时间戳 |
| 835 | classStatusInfo.activeDocId = GlobalConfig.activeDocId;//当前激活的文档id | 837 | classStatusInfo.activeDocId = GlobalConfig.activeDocId;//当前激活的文档id |
| 836 | classStatusInfo.activeDocCurPage = GlobalConfig.activeDocCurPage;//当前激活的文档的当前页 | 838 | classStatusInfo.activeDocCurPage = GlobalConfig.activeDocCurPage;//当前激活的文档的当前页 |
| 839 | + classStatusInfo.isStopAllPublishMedia=_param.isStopAllPublishMedia||false; | ||
| 837 | 840 | ||
| 838 | - loger.log("classStatusInfo--->", classStatusInfo); | 841 | + //loger.log("classStatusInfo--->", classStatusInfo); |
| 839 | 842 | ||
| 840 | /* | 843 | /* |
| 841 | optional uint32 item_idx=1; | 844 | optional uint32 item_idx=1; |
| @@ -855,7 +858,7 @@ class ConferApe extends Ape { | @@ -855,7 +858,7 @@ class ConferApe extends Ape { | ||
| 855 | } | 858 | } |
| 856 | 859 | ||
| 857 | unPackPdu(owner, itemIdx, itemData) { | 860 | unPackPdu(owner, itemIdx, itemData) { |
| 858 | - loger.log("课堂===unPackPdu "); | 861 | + loger.log("课堂数据->unPackPdu "); |
| 859 | if (owner == null || itemIdx == null || itemData == null) { | 862 | if (owner == null || itemIdx == null || itemData == null) { |
| 860 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 863 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 861 | return null; | 864 | return null; |
| @@ -956,6 +956,7 @@ message RCClassStatusInfoPdu { | @@ -956,6 +956,7 @@ message RCClassStatusInfoPdu { | ||
| 956 | optional uint32 server_timestamp=19;//当前的系统时间戳 | 956 | optional uint32 server_timestamp=19;//当前的系统时间戳 |
| 957 | optional uint32 active_doc_id=20;//当前激活的文档id | 957 | optional uint32 active_doc_id=20;//当前激活的文档id |
| 958 | optional uint32 active_doc_cur_page=21;//当前激活的文档的当前页 | 958 | optional uint32 active_doc_cur_page=21;//当前激活的文档的当前页 |
| 959 | + optional bool isStopAllPublishMedia=22;//是否停止推流 | ||
| 959 | } | 960 | } |
| 960 | 961 | ||
| 961 | message RCConferenceRecordRequestPdu { | 962 | message RCConferenceRecordRequestPdu { |
-
请 注册 或 登录 后发表评论