正在显示
6 个修改的文件
包含
60 行增加
和
62 行删除
| @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | ||
| 63 | super(); | 63 | super(); |
| 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 | 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 |
| 65 | //sdk 信息 | 65 | //sdk 信息 |
| 66 | - GlobalConfig.sdkVersion = "v2.31.10.20171122"; | 66 | + GlobalConfig.sdkVersion = "v2.31.12.20171122"; |
| 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); | 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); |
| 69 | //设置 | 69 | //设置 |
| @@ -2571,54 +2571,6 @@ export default class MessageEntrance extends Emiter { | @@ -2571,54 +2571,6 @@ export default class MessageEntrance extends Emiter { | ||
| 2571 | } | 2571 | } |
| 2572 | } | 2572 | } |
| 2573 | 2573 | ||
| 2574 | - //文档加入频道成功,同步到MCU服务器上的数据 | ||
| 2575 | - docJoinChannelSuccess() { | ||
| 2576 | - let interval=new Date().getTime()-parseInt(this.lastClassActiveTime); | ||
| 2577 | - interval=interval/1000; | ||
| 2578 | - //loger.log("最后一次记录的时间->"+this.lastClassActiveTime,"当前时间:"+new Date().getTime(),"间隔:"+interval+"秒"); | ||
| 2579 | - loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); | ||
| 2580 | - | ||
| 2581 | - | ||
| 2582 | - /* //20171114 服务端已经做了处理,客户端不需要再做判断 | ||
| 2583 | - //如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制,设备不是H5 | ||
| 2584 | - if(GlobalConfig.rosterNumber<=1&&interval>=(6*60)&&GlobalConfig.deviceType!=3){ | ||
| 2585 | - setTimeout(()=>{ | ||
| 2586 | - //延迟3秒,检测一下当前是否有人在开着视频,如果有开启的就不能再停止了 | ||
| 2587 | - loger.log("当前开启音视频的人数->"+GlobalConfig.getPublishUser()); | ||
| 2588 | - if(GlobalConfig.getPublishUser()<1){ | ||
| 2589 | - loger.log("调用服务端音视频停止录制->interval:"+interval); | ||
| 2590 | - this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2}); | ||
| 2591 | - } | ||
| 2592 | - },3000); | ||
| 2593 | - }*/ | ||
| 2594 | - | ||
| 2595 | - //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 2596 | - if (GlobalConfig.docListPrepare && GlobalConfig.docListPrepare.length > 0) { | ||
| 2597 | - //如果当前身份是老师或者当前课堂内只有一个人并且不是H5,有权限同步文档到MCU | ||
| 2598 | - if (GlobalConfig.isHost || (GlobalConfig.rosterNumber <= 1&&GlobalConfig.deviceType!=GlobalConfig.deviceH5)) { | ||
| 2599 | - for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) { | ||
| 2600 | - let value = GlobalConfig.docListPrepare[i]; | ||
| 2601 | - if (value) { | ||
| 2602 | - //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | ||
| 2603 | - let paramInfo = { | ||
| 2604 | - "pageNum": value.pdfSize || value.pageNum, | ||
| 2605 | - "fileName": value.name, | ||
| 2606 | - "fileType": value.type||value.fileType, | ||
| 2607 | - "relativeUrl": value.relativeLocation || value.relativeUrl, | ||
| 2608 | - "url": value.absoluteLocation || value.url, | ||
| 2609 | - "creatUserId": value.createUserID || 0, | ||
| 2610 | - "docId": value.id || value.docId, | ||
| 2611 | - "md5": value.MD5 || "", | ||
| 2612 | - "visible": false, | ||
| 2613 | - "itemIdx": value.itemIdx || 0 | ||
| 2614 | - }; | ||
| 2615 | - this._sendDocumentUpload(paramInfo); | ||
| 2616 | - } | ||
| 2617 | - } | ||
| 2618 | - } | ||
| 2619 | - } | ||
| 2620 | - } | ||
| 2621 | - | ||
| 2622 | //媒体共享模块的接口 | 2574 | //媒体共享模块的接口 |
| 2623 | //上传 | 2575 | //上传 |
| 2624 | _sendMediaSharedUpload(_param) { | 2576 | _sendMediaSharedUpload(_param) { |
| @@ -2784,12 +2736,45 @@ export default class MessageEntrance extends Emiter { | @@ -2784,12 +2736,45 @@ export default class MessageEntrance extends Emiter { | ||
| 2784 | } | 2736 | } |
| 2785 | } | 2737 | } |
| 2786 | 2738 | ||
| 2739 | + | ||
| 2740 | + //文档加入频道成功,同步到MCU服务器上的数据 | ||
| 2741 | + docJoinChannelSuccess() { | ||
| 2742 | + let interval=new Date().getTime()-parseInt(this.lastClassActiveTime); | ||
| 2743 | + interval=interval/1000; | ||
| 2744 | + //loger.log("最后一次记录的时间->"+this.lastClassActiveTime,"当前时间:"+new Date().getTime(),"间隔:"+interval+"秒"); | ||
| 2745 | + loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); | ||
| 2746 | + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 2747 | + if (GlobalConfig.docListPrepare && GlobalConfig.docListPrepare.length > 0) { | ||
| 2748 | + //如果当前身份是老师或者当前课堂内只有一个人并且不是H5,有权限同步文档到MCU | ||
| 2749 | + if (GlobalConfig.isHost || (GlobalConfig.rosterNumber <= 1&&GlobalConfig.deviceType!=GlobalConfig.deviceH5)) { | ||
| 2750 | + for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) { | ||
| 2751 | + let value = GlobalConfig.docListPrepare[i]; | ||
| 2752 | + if (value) { | ||
| 2753 | + //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | ||
| 2754 | + let paramInfo = { | ||
| 2755 | + "pageNum": value.pdfSize || value.pageNum, | ||
| 2756 | + "fileName": value.name, | ||
| 2757 | + "fileType": value.type||value.fileType, | ||
| 2758 | + "relativeUrl": value.relativeLocation || value.relativeUrl, | ||
| 2759 | + "url": value.absoluteLocation || value.url, | ||
| 2760 | + "creatUserId": value.createUserID || 0, | ||
| 2761 | + "docId": value.id || value.docId, | ||
| 2762 | + "md5": value.MD5 || "", | ||
| 2763 | + "visible": false, | ||
| 2764 | + "itemIdx": value.itemIdx || 0 | ||
| 2765 | + }; | ||
| 2766 | + this._sendDocumentUpload(paramInfo); | ||
| 2767 | + } | ||
| 2768 | + } | ||
| 2769 | + } | ||
| 2770 | + } | ||
| 2771 | + } | ||
| 2772 | + | ||
| 2787 | //音乐共享模块加入频道成功,同步到MCU服务器上的数据 | 2773 | //音乐共享模块加入频道成功,同步到MCU服务器上的数据 |
| 2788 | musicShareApeJoinChannelSuccess() { | 2774 | musicShareApeJoinChannelSuccess() { |
| 2789 | - //loger.log("伴音MUSIC模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.musicListPrepare.length); | ||
| 2790 | - //console.log("伴音MUSIC模块共享模数据->", GlobalConfig.musicListPrepare); | ||
| 2791 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | 2775 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 |
| 2792 | - if (GlobalConfig.isHost && GlobalConfig.musicListPrepare.length > 0&&GlobalConfig.deviceType!=GlobalConfig.deviceH5) { | 2776 | + if (GlobalConfig.musicListPrepare&& GlobalConfig.musicListPrepare.length > 0) { |
| 2777 | + if (GlobalConfig.isHost || (GlobalConfig.rosterNumber <= 1&&GlobalConfig.deviceType!=GlobalConfig.deviceH5)) { | ||
| 2793 | for (let i = 0; i < GlobalConfig.musicListPrepare.length; i++) { | 2778 | for (let i = 0; i < GlobalConfig.musicListPrepare.length; i++) { |
| 2794 | let value = GlobalConfig.musicListPrepare[i]; | 2779 | let value = GlobalConfig.musicListPrepare[i]; |
| 2795 | if (value) { | 2780 | if (value) { |
| @@ -2806,21 +2791,21 @@ export default class MessageEntrance extends Emiter { | @@ -2806,21 +2791,21 @@ export default class MessageEntrance extends Emiter { | ||
| 2806 | }; | 2791 | }; |
| 2807 | //外部接口上传的伴音文件返回的地址有的不正确,需要特殊处理,检测是否有DocSharing目录 | 2792 | //外部接口上传的伴音文件返回的地址有的不正确,需要特殊处理,检测是否有DocSharing目录 |
| 2808 | if(paramInfo.url&¶mInfo.url.indexOf("/DocSharing/")<0){ | 2793 | if(paramInfo.url&¶mInfo.url.indexOf("/DocSharing/")<0){ |
| 2809 | - loger.log("替换MP3路径地址",paramInfo.url); | ||
| 2810 | paramInfo.url=paramInfo.url.replace("/data/","/DocSharing/data/"); | 2794 | paramInfo.url=paramInfo.url.replace("/data/","/DocSharing/data/"); |
| 2811 | } | 2795 | } |
| 2796 | + loger.log("MP3路径地址:"+paramInfo.url,"fileId:"+paramInfo.fileId); | ||
| 2812 | this._sendMusicSharedUpload(paramInfo); | 2797 | this._sendMusicSharedUpload(paramInfo); |
| 2813 | } | 2798 | } |
| 2814 | } | 2799 | } |
| 2815 | } | 2800 | } |
| 2816 | } | 2801 | } |
| 2802 | + } | ||
| 2817 | 2803 | ||
| 2818 | //媒体共享模块加入频道成功,同步到MCU服务器上的数据 | 2804 | //媒体共享模块加入频道成功,同步到MCU服务器上的数据 |
| 2819 | mediaShareApeJoinChannelSuccess() { | 2805 | mediaShareApeJoinChannelSuccess() { |
| 2820 | - //loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMediaList.length); | ||
| 2821 | - //console.log("媒体共享模数据->", GlobalConfig.sharedMediaList); | ||
| 2822 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | 2806 | //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 |
| 2823 | - if (GlobalConfig.isHost && GlobalConfig.sharedMediaList.length > 0&&GlobalConfig.deviceType!=GlobalConfig.deviceH5) { | 2807 | + if (GlobalConfig.sharedMediaList&& GlobalConfig.sharedMediaList.length > 0) { |
| 2808 | + if (GlobalConfig.isHost || (GlobalConfig.rosterNumber <= 1&&GlobalConfig.deviceType!=GlobalConfig.deviceH5)) { | ||
| 2824 | for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) { | 2809 | for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) { |
| 2825 | let value = GlobalConfig.sharedMediaList[i]; | 2810 | let value = GlobalConfig.sharedMediaList[i]; |
| 2826 | if (value) { | 2811 | if (value) { |
| @@ -2837,15 +2822,17 @@ export default class MessageEntrance extends Emiter { | @@ -2837,15 +2822,17 @@ export default class MessageEntrance extends Emiter { | ||
| 2837 | }; | 2822 | }; |
| 2838 | //外部接口上传的伴音文件返回的地址有的不正确,需要特殊处理,检测是否有DocSharing目录 | 2823 | //外部接口上传的伴音文件返回的地址有的不正确,需要特殊处理,检测是否有DocSharing目录 |
| 2839 | if(paramInfo.url&¶mInfo.url.indexOf("/DocSharing/")<0){ | 2824 | if(paramInfo.url&¶mInfo.url.indexOf("/DocSharing/")<0){ |
| 2840 | - loger.log("替换MP4路径地址",paramInfo.url); | ||
| 2841 | paramInfo.url=paramInfo.url.replace("/data/","/DocSharing/data/"); | 2825 | paramInfo.url=paramInfo.url.replace("/data/","/DocSharing/data/"); |
| 2842 | } | 2826 | } |
| 2827 | + loger.log("MP4路径地址:"+paramInfo.url,"fileId:"+paramInfo.fileId); | ||
| 2843 | this._sendMediaSharedUpload(paramInfo); | 2828 | this._sendMediaSharedUpload(paramInfo); |
| 2844 | } | 2829 | } |
| 2845 | } | 2830 | } |
| 2846 | } | 2831 | } |
| 2847 | } | 2832 | } |
| 2848 | 2833 | ||
| 2834 | + } | ||
| 2835 | + | ||
| 2849 | //录制回放相关的处理------------------------------------------------ | 2836 | //录制回放相关的处理------------------------------------------------ |
| 2850 | //录制回放初始化 | 2837 | //录制回放初始化 |
| 2851 | _initRecordPlayback(_param) { | 2838 | _initRecordPlayback(_param) { |
| @@ -28,6 +28,17 @@ class EngineUtils{ | @@ -28,6 +28,17 @@ class EngineUtils{ | ||
| 28 | return []; | 28 | return []; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | + /* | ||
| 32 | + * 生成随机数 _part 段数 默认3段; splitStr分隔符 | ||
| 33 | + * */ | ||
| 34 | + static creatRandomNum(_part=3,splitStr=""){ | ||
| 35 | + let randNumStr=""; | ||
| 36 | + for(let i=0;i<_part;i++){ | ||
| 37 | + randNumStr+=splitStr+parseInt(Math.random()*1000); | ||
| 38 | + } | ||
| 39 | + return randNumStr; | ||
| 40 | + } | ||
| 41 | + | ||
| 31 | //生成时间戳后9位 保证唯一 | 42 | //生成时间戳后9位 保证唯一 |
| 32 | static creatSoleNumberFromTimestamp(){ | 43 | static creatSoleNumberFromTimestamp(){ |
| 33 | let time = new Date().getTime(); | 44 | let time = new Date().getTime(); |
| @@ -98,7 +98,7 @@ class EverSocket extends Emiter { | @@ -98,7 +98,7 @@ class EverSocket extends Emiter { | ||
| 98 | * */ | 98 | * */ |
| 99 | send2mcu(len,type){ | 99 | send2mcu(len,type){ |
| 100 | this.sendToMcuList.push(""+len+":"+type); | 100 | this.sendToMcuList.push(""+len+":"+type); |
| 101 | - if(this.sendToMcuList.length>=50){ | 101 | + if(this.sendToMcuList.length>=100){ |
| 102 | loger.log("发送到MCU数据统计->",this.sendToMcuList); | 102 | loger.log("发送到MCU数据统计->",this.sendToMcuList); |
| 103 | this.sendToMcuList=[]; | 103 | this.sendToMcuList=[]; |
| 104 | } | 104 | } |
| @@ -111,7 +111,7 @@ class EverSocket extends Emiter { | @@ -111,7 +111,7 @@ class EverSocket extends Emiter { | ||
| 111 | * */ | 111 | * */ |
| 112 | mcu2client(len,type){ | 112 | mcu2client(len,type){ |
| 113 | this.receiveFromMcuList.push(""+len+":"+type); | 113 | this.receiveFromMcuList.push(""+len+":"+type); |
| 114 | - if(this.receiveFromMcuList.length>50){ | 114 | + if(this.receiveFromMcuList.length>100){ |
| 115 | loger.log("收到MCU数据统计->",this.receiveFromMcuList); | 115 | loger.log("收到MCU数据统计->",this.receiveFromMcuList); |
| 116 | this.receiveFromMcuList=[]; | 116 | this.receiveFromMcuList=[]; |
| 117 | } | 117 | } |
| @@ -56,7 +56,7 @@ class DocApe extends Ape { | @@ -56,7 +56,7 @@ class DocApe extends Ape { | ||
| 56 | let itemIdx =parseInt(paramInfo.itemIdx||0);//使用外部指定的itemIdx | 56 | let itemIdx =parseInt(paramInfo.itemIdx||0);//使用外部指定的itemIdx |
| 57 | if(itemIdx<=0){ | 57 | if(itemIdx<=0){ |
| 58 | //外部指定的值无效就使用时间戳 | 58 | //外部指定的值无效就使用时间戳 |
| 59 | - itemIdx = EngineUtils.creatSoleNumberFromTimestamp(); | 59 | + itemIdx =parseInt(EngineUtils.creatRandomNum(3));//生成唯一的标识 int32; |
| 60 | } | 60 | } |
| 61 | let docDataModelPdu = this.packPdu(paramInfo, itemIdx); | 61 | let docDataModelPdu = this.packPdu(paramInfo, itemIdx); |
| 62 | //数据无效或地址无效的不做处理 | 62 | //数据无效或地址无效的不做处理 |
| @@ -42,7 +42,7 @@ class MediaSharedApe extends Ape { | @@ -42,7 +42,7 @@ class MediaSharedApe extends Ape { | ||
| 42 | return; | 42 | return; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | - let itemIdx = EngineUtils.creatSoleNumberFromTimestamp();// | 45 | + let itemIdx = parseInt(EngineUtils.creatRandomNum(3));//生成唯一的标识 int32 |
| 46 | let pduDataModel = this.packPdu(paramInfo, itemIdx); | 46 | let pduDataModel = this.packPdu(paramInfo, itemIdx); |
| 47 | if (pduDataModel == null) { | 47 | if (pduDataModel == null) { |
| 48 | loger.log('上传媒体文件->失败->数据无效'); | 48 | loger.log('上传媒体文件->失败->数据无效'); |
| @@ -43,7 +43,7 @@ class MusicSharedApe extends Ape { | @@ -43,7 +43,7 @@ class MusicSharedApe extends Ape { | ||
| 43 | return; | 43 | return; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | - let itemIdx = EngineUtils.creatSoleNumberFromTimestamp(); // | 46 | + let itemIdx = parseInt(EngineUtils.creatRandomNum(3));//生成唯一的标识 int32 |
| 47 | let pduDataModel = this.packPdu(paramInfo, itemIdx); | 47 | let pduDataModel = this.packPdu(paramInfo, itemIdx); |
| 48 | if (pduDataModel == null) { | 48 | if (pduDataModel == null) { |
| 49 | loger.log('上传伴音文件->失败->数据无效'); | 49 | loger.log('上传伴音文件->失败->数据无效'); |
-
请 注册 或 登录 后发表评论