1.修复nodeId比较大小踢人的逻辑,改为加入课堂时间戳来比较;2,修复音视频禁用状态同步的问题;3.修复视频界面名字显示不出的问题
正在显示
9 个修改的文件
包含
80 行增加
和
59 行删除
| @@ -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.34.5.20171127"; | 66 | + GlobalConfig.sdkVersion = "v2.34.16.20171128"; |
| 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 | //设置 |
| @@ -101,9 +101,9 @@ export default class MessageEntrance extends Emiter { | @@ -101,9 +101,9 @@ export default class MessageEntrance extends Emiter { | ||
| 101 | _webRtc.on('*', (type, data) => this._emit(type, data)); | 101 | _webRtc.on('*', (type, data) => this._emit(type, data)); |
| 102 | _webRtc.on(MessageTypes.USER_DEVICE_STATUS_CHAANGE, this.userDeviecStatusChange.bind(this)); //监听摄像头和麦克风的开启状态 | 102 | _webRtc.on(MessageTypes.USER_DEVICE_STATUS_CHAANGE, this.userDeviecStatusChange.bind(this)); //监听摄像头和麦克风的开启状态 |
| 103 | _webRtc.on(MessageTypes.MEDIA_PUBLISH_STATUS_CHANGE, this.mediaPublishStatusChange.bind(this)); //webRtc推流状态发生改变 | 103 | _webRtc.on(MessageTypes.MEDIA_PUBLISH_STATUS_CHANGE, this.mediaPublishStatusChange.bind(this)); //webRtc推流状态发生改变 |
| 104 | - _webRtc.on(WebRtcApe.RE_JOIN_CHANNEL, this._webRtcRejoinChannel.bind(this)); //重先加入音视频频道 | ||
| 105 | _webRtc.on(MessageTypes.MEDIA_ENABLED_CHANGE, this._mediaEnabledChange.bind(this)); //音视频禁用状态改变 广播消息 | 104 | _webRtc.on(MessageTypes.MEDIA_ENABLED_CHANGE, this._mediaEnabledChange.bind(this)); //音视频禁用状态改变 广播消息 |
| 106 | - _webRtc.on(MessageTypes.UPDATE_USER_MEDIA_MUTED_STATUS, this._updateUserMediaMutedStatus.bind(this)); //音视频禁用状态改变(自己),同步更新 | 105 | + _webRtc.on(WebRtcApe.RE_JOIN_CHANNEL, this._webRtcRejoinChannel.bind(this)); //重先加入音视频频道 |
| 106 | + _webRtc.on(WebRtcApe.UPDATE_USER_MEDIA_MUTED_STATUS, this._updateUserMediaMutedStatus.bind(this)); //音视频禁用状态改变(自己),同步更新 | ||
| 107 | 107 | ||
| 108 | // Sass平台层 | 108 | // Sass平台层 |
| 109 | _sass = Sass; | 109 | _sass = Sass; |
| @@ -647,23 +647,23 @@ export default class MessageEntrance extends Emiter { | @@ -647,23 +647,23 @@ export default class MessageEntrance extends Emiter { | ||
| 647 | 647 | ||
| 648 | 648 | ||
| 649 | //如果没有名字的时候需要随机生成 | 649 | //如果没有名字的时候需要随机生成 |
| 650 | - let randUserId =parseInt(Math.random()*1000)+"_"+parseInt(Math.random()*1000)+"_"+parseInt(Math.random()*1000); | 650 | + let randUserId =EngineUtils.creatRandomNum(3,".");//parseInt(Math.random()*1000)+"_"+parseInt(Math.random()*1000)+"_"+parseInt(Math.random()*1000); |
| 651 | let randUserName=EngineUtils.creatRandomNum(2,"."); | 651 | let randUserName=EngineUtils.creatRandomNum(2,"."); |
| 652 | if (GlobalConfig.userRole == ApeConsts.host) { | 652 | if (GlobalConfig.userRole == ApeConsts.host) { |
| 653 | - randUserId = "T" + randUserId; | ||
| 654 | - randUserName= "T" + randUserName; | 653 | + randUserId = "1_" + randUserId; |
| 654 | + randUserName= "1_" + randUserName; | ||
| 655 | } else if (GlobalConfig.userRole == ApeConsts.assistant) { | 655 | } else if (GlobalConfig.userRole == ApeConsts.assistant) { |
| 656 | - randUserId = "A" + randUserId; | ||
| 657 | - randUserName= "A" + randUserName; | 656 | + randUserId = "2_" + randUserId; |
| 657 | + randUserName= "2_" + randUserName; | ||
| 658 | } else if (GlobalConfig.userRole == ApeConsts.presenter) { | 658 | } else if (GlobalConfig.userRole == ApeConsts.presenter) { |
| 659 | - randUserId = "P" + randUserId; | ||
| 660 | - randUserName= "O" + randUserName; | 659 | + randUserId = "2_" + randUserId; |
| 660 | + randUserName= "2_" + randUserName; | ||
| 661 | } else if (GlobalConfig.userRole == ApeConsts.invisible) { | 661 | } else if (GlobalConfig.userRole == ApeConsts.invisible) { |
| 662 | - randUserId = "I" + randUserId; | ||
| 663 | - randUserName= "I" + randUserName; | 662 | + randUserId = "32_" + randUserId; |
| 663 | + randUserName= "32_" + randUserName; | ||
| 664 | } else { | 664 | } else { |
| 665 | - randUserId = "S" + randUserId; | ||
| 666 | - randUserName= "S" + randUserName; | 665 | + randUserId = "8_" + randUserId; |
| 666 | + randUserName= "8_" + randUserName; | ||
| 667 | } | 667 | } |
| 668 | 668 | ||
| 669 | //如果没有名字,随机起一个名字 | 669 | //如果没有名字,随机起一个名字 |
| @@ -1240,6 +1240,8 @@ export default class MessageEntrance extends Emiter { | @@ -1240,6 +1240,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1240 | joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId; | 1240 | joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId; |
| 1241 | joinClassSuccessCallBackData.password = GlobalConfig.password; | 1241 | joinClassSuccessCallBackData.password = GlobalConfig.password; |
| 1242 | joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true | 1242 | joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true |
| 1243 | + joinClassSuccessCallBackData.joinTimestamp = GlobalConfig.joinTimestamp; | ||
| 1244 | + | ||
| 1243 | //GlobalConfig.passwordRequired 老师的默认是true | 1245 | //GlobalConfig.passwordRequired 老师的默认是true |
| 1244 | //GlobalConfig.portal=_data.portal; | 1246 | //GlobalConfig.portal=_data.portal; |
| 1245 | joinClassSuccessCallBackData.role = GlobalConfig.role; | 1247 | joinClassSuccessCallBackData.role = GlobalConfig.role; |
| @@ -36,7 +36,11 @@ class EngineUtils { | @@ -36,7 +36,11 @@ class EngineUtils { | ||
| 36 | static creatRandomNum(_part = 3, splitStr = "") { | 36 | static creatRandomNum(_part = 3, splitStr = "") { |
| 37 | let randNumStr = ""; | 37 | let randNumStr = ""; |
| 38 | for (let i = 0; i < _part; i++) { | 38 | for (let i = 0; i < _part; i++) { |
| 39 | - randNumStr += splitStr + parseInt(Math.random() * 1000); | 39 | + if(i==0){ |
| 40 | + randNumStr += ""+parseInt(Math.random() * 1000); | ||
| 41 | + }else{ | ||
| 42 | + randNumStr +=splitStr+parseInt(Math.random() * 1000); | ||
| 43 | + } | ||
| 40 | } | 44 | } |
| 41 | return randNumStr; | 45 | return randNumStr; |
| 42 | } | 46 | } |
| @@ -177,6 +177,30 @@ class GlobalConfig { | @@ -177,6 +177,30 @@ class GlobalConfig { | ||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| 180 | + * 根据nodeId获取用户的身份 | ||
| 181 | + * */ | ||
| 182 | + static getUserRoleToString(userRole) { | ||
| 183 | + let userRoleName="学生"; | ||
| 184 | + switch (userRole){ | ||
| 185 | + case ApeConsts.NR_HOST: | ||
| 186 | + userRoleName="老师"; | ||
| 187 | + break; | ||
| 188 | + case ApeConsts.NR_PRESENTER: | ||
| 189 | + userRoleName="助教"; | ||
| 190 | + break; | ||
| 191 | + case ApeConsts.NR_INVISIBLE: | ||
| 192 | + userRoleName="监客"; | ||
| 193 | + break; | ||
| 194 | + case ApeConsts.NR_NORMAL: | ||
| 195 | + userRoleName="学生"; | ||
| 196 | + break; | ||
| 197 | + default : | ||
| 198 | + break; | ||
| 199 | + } | ||
| 200 | + return userRoleName; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /* | ||
| 180 | * 根据nodeId获取用户的信息 | 204 | * 根据nodeId获取用户的信息 |
| 181 | * */ | 205 | * */ |
| 182 | static getUserInfoFromeNodeId(_nodeId) { | 206 | static getUserInfoFromeNodeId(_nodeId) { |
| @@ -585,6 +609,7 @@ GlobalConfig.videoRecords = []; | @@ -585,6 +609,7 @@ GlobalConfig.videoRecords = []; | ||
| 585 | GlobalConfig.status = 0 | 609 | GlobalConfig.status = 0 |
| 586 | GlobalConfig.mobileDirection = 0; | 610 | GlobalConfig.mobileDirection = 0; |
| 587 | 611 | ||
| 612 | +GlobalConfig.joinTimestamp = 0; //加入课堂的时间戳 | ||
| 588 | GlobalConfig.nodeId = 0; //随机生成 mcu中的唯一ID | 613 | GlobalConfig.nodeId = 0; //随机生成 mcu中的唯一ID |
| 589 | GlobalConfig.passwordRequired = false; | 614 | GlobalConfig.passwordRequired = false; |
| 590 | GlobalConfig.password = ""; | 615 | GlobalConfig.password = ""; |
| @@ -101,6 +101,7 @@ class ConferApe extends Ape { | @@ -101,6 +101,7 @@ class ConferApe extends Ape { | ||
| 101 | getNodeInfo() { | 101 | getNodeInfo() { |
| 102 | let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu']; | 102 | let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu']; |
| 103 | nodeInfoRecordPdu.nodeId = GlobalConfig.nodeId; | 103 | nodeInfoRecordPdu.nodeId = GlobalConfig.nodeId; |
| 104 | + nodeInfoRecordPdu.joinTimestamp= GlobalConfig.joinTimestamp||EngineUtils.creatSoleNumberFromTimestamp(); | ||
| 104 | nodeInfoRecordPdu.selfSilence = JSON.stringify(GlobalConfig.selfSilence) || ""; | 105 | nodeInfoRecordPdu.selfSilence = JSON.stringify(GlobalConfig.selfSilence) || ""; |
| 105 | nodeInfoRecordPdu.name = GlobalConfig.userName; | 106 | nodeInfoRecordPdu.name = GlobalConfig.userName; |
| 106 | nodeInfoRecordPdu.role = ApeConsts.userTypesToId[GlobalConfig.userRole] || 1; //NR_NORMAL用户的身份,根据用户登录时的身份设置; | 107 | nodeInfoRecordPdu.role = ApeConsts.userTypesToId[GlobalConfig.userRole] || 1; //NR_NORMAL用户的身份,根据用户登录时的身份设置; |
| @@ -1001,7 +1002,7 @@ class ConferApe extends Ape { | @@ -1001,7 +1002,7 @@ class ConferApe extends Ape { | ||
| 1001 | //新加入的人员不是自己 | 1002 | //新加入的人员不是自己 |
| 1002 | //1.判断进入的用户身份,如果进入的人身份是host,助教,监课,并且和自己的身份冲突,自己会被踢掉 | 1003 | //1.判断进入的用户身份,如果进入的人身份是host,助教,监课,并且和自己的身份冲突,自己会被踢掉 |
| 1003 | //2.最后进入的人会踢掉之前进入的人,nodeId是按时间戳生成的,最后进入的人nodeId的值比之前进入的人大 | 1004 | //2.最后进入的人会踢掉之前进入的人,nodeId是按时间戳生成的,最后进入的人nodeId的值比之前进入的人大 |
| 1004 | - if (parseInt(nodeId) > GlobalConfig.nodeId) { | 1005 | + if (parseInt(nodeData.joinTimestamp) > GlobalConfig.joinTimestamp) { |
| 1005 | let newUserInfo = { | 1006 | let newUserInfo = { |
| 1006 | userId: nodeData.userId, | 1007 | userId: nodeData.userId, |
| 1007 | userName: nodeData.name, | 1008 | userName: nodeData.name, |
| @@ -1010,11 +1011,11 @@ class ConferApe extends Ape { | @@ -1010,11 +1011,11 @@ class ConferApe extends Ape { | ||
| 1010 | deviceType: nodeData.deviceType | 1011 | deviceType: nodeData.deviceType |
| 1011 | } | 1012 | } |
| 1012 | if (nodeData.role == ApeConsts.NR_HOST && GlobalConfig.isHost) { | 1013 | if (nodeData.role == ApeConsts.NR_HOST && GlobalConfig.isHost) { |
| 1013 | - loger.warn("相同身份的人进入->自己被踢出->进入的人员信息", "userName:" + nodeData.name, "userId:" + nodeData.userId, "userRole:" + nodeData.userRole, "nodeId:" + nodeData.nodeId, "deviceType:" + nodeData.deviceType); | 1014 | + loger.warn("相同身份的人进入->自己被踢出->进入的人员信息", "userName:" + nodeData.name, "userId:" + nodeData.userId, "userRole:" + nodeData.userRole, "nodeId:" + nodeData.nodeId, "deviceType:" + nodeData.deviceType,"joinTimestamp:"+nodeData.joinTimestamp); |
| 1014 | this.kickOutRoster(newUserInfo); | 1015 | this.kickOutRoster(newUserInfo); |
| 1015 | return; | 1016 | return; |
| 1016 | } else if (nodeData.userId == GlobalConfig.userId && GlobalConfig.userId != "0") { | 1017 | } else if (nodeData.userId == GlobalConfig.userId && GlobalConfig.userId != "0") { |
| 1017 | - loger.warn("异地登陆->userId->", GlobalConfig.userId); | 1018 | + loger.warn("异地登陆->自己被踢出->进入的人员信息", "userName:" + nodeData.name, "userId:" + nodeData.userId, "userRole:" + nodeData.userRole, "nodeId:" + nodeData.nodeId, "deviceType:" + nodeData.deviceType,"joinTimestamp:"+nodeData.joinTimestamp); |
| 1018 | this._emit(MessageTypes.MCU_ERROR, {type: MessageTypes.ERR_CLASS_REMOTE_LANDING, data: newUserInfo}); | 1019 | this._emit(MessageTypes.MCU_ERROR, {type: MessageTypes.ERR_CLASS_REMOTE_LANDING, data: newUserInfo}); |
| 1019 | this._emit(MessageTypes.CLASS_RUN_EXIT, {'type': 1}); | 1020 | this._emit(MessageTypes.CLASS_RUN_EXIT, {'type': 1}); |
| 1020 | } | 1021 | } |
| @@ -751,6 +751,8 @@ class VideoApe extends Ape { | @@ -751,6 +751,8 @@ class VideoApe extends Ape { | ||
| 751 | } else { | 751 | } else { |
| 752 | GlobalConfig.openCamera = 0; | 752 | GlobalConfig.openCamera = 0; |
| 753 | GlobalConfig.openMicrophones = 0; | 753 | GlobalConfig.openMicrophones = 0; |
| 754 | + GlobalConfig.videoEnabled=true; | ||
| 755 | + GlobalConfig.audioEnabled=true; | ||
| 754 | } | 756 | } |
| 755 | 757 | ||
| 756 | //更新用户的摄像头和麦克风状态 | 758 | //更新用户的摄像头和麦克风状态 |
| @@ -36,7 +36,6 @@ class WebRtcApe extends Emiter { | @@ -36,7 +36,6 @@ class WebRtcApe extends Emiter { | ||
| 36 | this.channelId = ""; | 36 | this.channelId = ""; |
| 37 | this.uid = 0; | 37 | this.uid = 0; |
| 38 | this.info = "" | 38 | this.info = "" |
| 39 | - this.videAndAudioMutedStatusData={};//记录当前自己的摄像头和麦克风禁用状态 | ||
| 40 | 39 | ||
| 41 | this.reAddRemoteStreamDelay = 0;//重连远程视频的计时器 | 40 | this.reAddRemoteStreamDelay = 0;//重连远程视频的计时器 |
| 42 | this.rePublishDelay = 0;//重新推流的间隔 | 41 | this.rePublishDelay = 0;//重新推流的间隔 |
| @@ -203,7 +202,14 @@ class WebRtcApe extends Emiter { | @@ -203,7 +202,14 @@ class WebRtcApe extends Emiter { | ||
| 203 | }); | 202 | }); |
| 204 | this.client.on("active-speaker", (evt)=> { | 203 | this.client.on("active-speaker", (evt)=> { |
| 205 | let uid = evt.uid; | 204 | let uid = evt.uid; |
| 206 | - loger.log("当前正在讲话的uid:" + uid); | 205 | + let user=GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); |
| 206 | + //console.log("active-speaker",user); | ||
| 207 | + if(user){ | ||
| 208 | + let roleRole=GlobalConfig.getUserRoleToString(user.role); | ||
| 209 | + loger.log("当前正在讲话的 ["+roleRole+"] name:"+user.name+" uid:" + uid); | ||
| 210 | + }else{ | ||
| 211 | + loger.log("当前正在讲话的uid:" + uid); | ||
| 212 | + } | ||
| 207 | }); | 213 | }); |
| 208 | 214 | ||
| 209 | } | 215 | } |
| @@ -237,25 +243,24 @@ class WebRtcApe extends Emiter { | @@ -237,25 +243,24 @@ class WebRtcApe extends Emiter { | ||
| 237 | if(user&&user.audioEnabled==true){ | 243 | if(user&&user.audioEnabled==true){ |
| 238 | audioMutedDiv = `<div class="audioAndVideMuted microphoneOn " id=${this.audioMutedIdName + uid} title="${this.closeMicrophoneTitle}"></div>`; | 244 | audioMutedDiv = `<div class="audioAndVideMuted microphoneOn " id=${this.audioMutedIdName + uid} title="${this.closeMicrophoneTitle}"></div>`; |
| 239 | }else{ | 245 | }else{ |
| 240 | - audioMutedDiv = `<div class="audioAndVideMuted microphoneff " id=${this.audioMutedIdName + uid} title="${this.closeMicrophoneTitle}"></div>`; | 246 | + audioMutedDiv = `<div class="audioAndVideMuted microphoneOff " id=${this.audioMutedIdName + uid} title="${this.closeMicrophoneTitle}"></div>`; |
| 241 | } | 247 | } |
| 242 | videoAndAudioBox=`<div class="audioAndVideBox unOpenVideo">${videoMutedDiv+audioMutedDiv}</div>`; | 248 | videoAndAudioBox=`<div class="audioAndVideBox unOpenVideo">${videoMutedDiv+audioMutedDiv}</div>`; |
| 243 | } | 249 | } |
| 244 | - | ||
| 245 | if (userRole == ApeConsts.invisible) { | 250 | if (userRole == ApeConsts.invisible) { |
| 246 | - let nameDiv = `<div style=${this.invisibleVideoWidth}px;height:22px; position: absolute;bottom: 2px; right:4px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align: middle;background-color: #2926251a;color: #e7e7e7display:${this.nameDisplay}">${userName}</div>`; | 251 | + let nameDiv = `<div style="${this.invisibleVideoWidth}px;height:22px; position: absolute;bottom: 2px; right:4px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align: middle;color: #e7e7e7display:${this.nameDisplay}">${userName}</div>`; |
| 247 | //把远程视频添加到监课列表 | 252 | //把远程视频添加到监课列表 |
| 248 | loger.log("获取远程视频流成功->监课:" + userName + "->" + uid, new Date().getTime()); | 253 | loger.log("获取远程视频流成功->监课:" + userName + "->" + uid, new Date().getTime()); |
| 249 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.invisibleWebRtcVideoClass}" style="width:${this.invisibleVideoWidth * this.videoScale}px;height:${this.invisibleVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; | 254 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.invisibleWebRtcVideoClass}" style="width:${this.invisibleVideoWidth * this.videoScale}px;height:${this.invisibleVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; |
| 250 | $(this.invisibleViewId).append(viewDiv); | 255 | $(this.invisibleViewId).append(viewDiv); |
| 251 | } else if (userRole == ApeConsts.host || userRole == ApeConsts.assistant || userRole == ApeConsts.presenter) { | 256 | } else if (userRole == ApeConsts.host || userRole == ApeConsts.assistant || userRole == ApeConsts.presenter) { |
| 252 | - let nameDiv = `<div style="width:${this.hostRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px z-index: 1;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle; background-color: #2926251a;color: #e7e7e7;display:${this.nameDisplay}">${userName }</div>`; | 257 | + let nameDiv = `<div style="width:${this.hostRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}">${userName }</div>`; |
| 253 | //把远程视图添加到老师列表 | 258 | //把远程视图添加到老师列表 |
| 254 | loger.log("获取远程视频流成功->userRole:" + userRole + ":" + userName + "->" + uid, new Date().getTime()); | 259 | loger.log("获取远程视频流成功->userRole:" + userRole + ":" + userName + "->" + uid, new Date().getTime()); |
| 255 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.hostWebRtcVideoClass}" style="width:${this.hostRemoteVideoWidth * this.videoScale}px;height:${this.hostRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; | 260 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.hostWebRtcVideoClass}" style="width:${this.hostRemoteVideoWidth * this.videoScale}px;height:${this.hostRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; |
| 256 | $(this.hostRemoteViewId).prepend(viewDiv); | 261 | $(this.hostRemoteViewId).prepend(viewDiv); |
| 257 | } else { | 262 | } else { |
| 258 | - let nameDiv = `<div style="width:${this.normalRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px z-index: 1;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;background-color: #2926251a;color: #e7e7e7;display:${this.nameDisplay}">${userName}</div>`; | 263 | + let nameDiv = `<div style="width:${this.normalRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}">${userName}</div>`; |
| 259 | //把视图添加到学生列表 | 264 | //把视图添加到学生列表 |
| 260 | loger.log("获取远程视频流成功->学生:" + userName + "->" + uid, new Date().getTime()); | 265 | loger.log("获取远程视频流成功->学生:" + userName + "->" + uid, new Date().getTime()); |
| 261 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.normalWebRtcVideoClass}" style="width:${this.normalRemoteVideoWidth * this.videoScale}px;height:${this.normalRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; | 266 | let viewDiv = `<div id="${this.xdyRemote + uid}" class="${this.normalWebRtcVideoClass}" style="width:${this.normalRemoteVideoWidth * this.videoScale}px;height:${this.normalRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;">${nameDiv + videoAndAudioBox}</div>`; |
| @@ -279,6 +284,7 @@ class WebRtcApe extends Emiter { | @@ -279,6 +284,7 @@ class WebRtcApe extends Emiter { | ||
| 279 | $("#" + this.xdyRemote + uid).remove(); | 284 | $("#" + this.xdyRemote + uid).remove(); |
| 280 | } | 285 | } |
| 281 | } | 286 | } |
| 287 | + $("#player_" + uid).css("pointer-events","none"); | ||
| 282 | if (user && (user.deviceType == GlobalConfig.deviceIOS || user.deviceType == GlobalConfig.deviceAndroid)) { | 288 | if (user && (user.deviceType == GlobalConfig.deviceIOS || user.deviceType == GlobalConfig.deviceAndroid)) { |
| 283 | this.remoteVideoList[user.nodeId] = stream; | 289 | this.remoteVideoList[user.nodeId] = stream; |
| 284 | } | 290 | } |
| @@ -593,7 +599,7 @@ class WebRtcApe extends Emiter { | @@ -593,7 +599,7 @@ class WebRtcApe extends Emiter { | ||
| 593 | videoAndAudioBox=`<div class="audioAndVideBox openVideo">${videoMutedDiv+audioMutedDiv}</div>`; | 599 | videoAndAudioBox=`<div class="audioAndVideBox openVideo">${videoMutedDiv+audioMutedDiv}</div>`; |
| 594 | } | 600 | } |
| 595 | 601 | ||
| 596 | - let nameDiv = `<div id="${"videoOwnerName_" + this.uid}" class="localVideoOwnerName" style="width:${this.localVideoWidth}px;height:26px; position: absolute;bottom: 2px;right:4px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align:bottom;color: #e7e7e7;display:${this.nameDisplay}">${videoAndAudioBox+userName}</div>`; | 602 | + let nameDiv = `<div id="${"videoOwnerName_" + this.uid}" class="localVideoOwnerName" style="width:${this.localVideoWidth}px;height:26px; position: absolute;bottom: 2px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align:bottom;color: #e7e7e7;display:${this.nameDisplay}">${userName+videoAndAudioBox}</div>`; |
| 597 | $(this.localViewId).prepend(nameDiv); | 603 | $(this.localViewId).prepend(nameDiv); |
| 598 | 604 | ||
| 599 | $("#" + this.videoMutedIdName + this.uid).off("click", this._clickVideoMuted.bind(this)); | 605 | $("#" + this.videoMutedIdName + this.uid).off("click", this._clickVideoMuted.bind(this)); |
| @@ -864,7 +870,6 @@ class WebRtcApe extends Emiter { | @@ -864,7 +870,6 @@ class WebRtcApe extends Emiter { | ||
| 864 | * */ | 870 | * */ |
| 865 | _clickVideoMuted(evt) { | 871 | _clickVideoMuted(evt) { |
| 866 | let className = evt.currentTarget.className; | 872 | let className = evt.currentTarget.className; |
| 867 | - loger.log("点击禁用和开启视频", evt.currentTarget.id); | ||
| 868 | let idArr = (evt.currentTarget.id).split("_"); | 873 | let idArr = (evt.currentTarget.id).split("_"); |
| 869 | let uid = 10000000;//默认设置一个不存在的uid | 874 | let uid = 10000000;//默认设置一个不存在的uid |
| 870 | if (idArr && idArr.length > 1) { | 875 | if (idArr && idArr.length > 1) { |
| @@ -873,21 +878,9 @@ class WebRtcApe extends Emiter { | @@ -873,21 +878,9 @@ class WebRtcApe extends Emiter { | ||
| 873 | if (className.indexOf("cameraOn") > 0) { | 878 | if (className.indexOf("cameraOn") > 0) { |
| 874 | loger.log("点击禁用视频->" + uid); | 879 | loger.log("点击禁用视频->" + uid); |
| 875 | this.sendChangeUserMediaEnabled({nodeId: uid, video: false, audio: true}); | 880 | this.sendChangeUserMediaEnabled({nodeId: uid, video: false, audio: true}); |
| 876 | - /*if (uid != GlobalConfig.nodeId) { | ||
| 877 | - this.sendChangeUserMediaEnabled({nodeId: uid, video: false, audio: true}); | ||
| 878 | - this.setUidVideoEnabledStatus(uid,false); | ||
| 879 | - } else { | ||
| 880 | - this.disableVideo(uid); | ||
| 881 | - }*/ | ||
| 882 | } else { | 881 | } else { |
| 883 | - loger.log("点击开启视频"); | 882 | + loger.log("点击解除视频禁用->"+uid); |
| 884 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | 883 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); |
| 885 | - /* if (uid != GlobalConfig.nodeId) { | ||
| 886 | - this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | ||
| 887 | - this.setUidVideoEnabledStatus(uid,true); | ||
| 888 | - } else { | ||
| 889 | - this.enableVideo(uid); | ||
| 890 | - }*/ | ||
| 891 | } | 884 | } |
| 892 | } | 885 | } |
| 893 | /* | 886 | /* |
| @@ -895,7 +888,6 @@ class WebRtcApe extends Emiter { | @@ -895,7 +888,6 @@ class WebRtcApe extends Emiter { | ||
| 895 | * */ | 888 | * */ |
| 896 | _clickAudioMuted(evt) { | 889 | _clickAudioMuted(evt) { |
| 897 | let className = evt.currentTarget.className; | 890 | let className = evt.currentTarget.className; |
| 898 | - loger.log("点击禁音和开启按钮切换", evt.currentTarget.id); | ||
| 899 | let idArr = (evt.currentTarget.id).split("_"); | 891 | let idArr = (evt.currentTarget.id).split("_"); |
| 900 | let uid = 10000000;//默认设置一个不存在的uid | 892 | let uid = 10000000;//默认设置一个不存在的uid |
| 901 | if (idArr && idArr.length > 1) { | 893 | if (idArr && idArr.length > 1) { |
| @@ -904,21 +896,9 @@ class WebRtcApe extends Emiter { | @@ -904,21 +896,9 @@ class WebRtcApe extends Emiter { | ||
| 904 | if (className.indexOf("microphoneOn") > 0) { | 896 | if (className.indexOf("microphoneOn") > 0) { |
| 905 | loger.log("点击禁音->" + uid); | 897 | loger.log("点击禁音->" + uid); |
| 906 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: false}); | 898 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: false}); |
| 907 | - /*if (uid != GlobalConfig.nodeId) { | ||
| 908 | - this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: false}); | ||
| 909 | - this.setUidAudioEnabledStatus(uid,false); | ||
| 910 | - } else { | ||
| 911 | - this.disableAudio(uid); | ||
| 912 | - }*/ | ||
| 913 | } else { | 899 | } else { |
| 914 | - loger.log("点击开启声音"); | 900 | + loger.log("点击解除禁音"); |
| 915 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | 901 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); |
| 916 | - /*if (uid != GlobalConfig.nodeId) { | ||
| 917 | - this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | ||
| 918 | - this.setUidAudioEnabledStatus(uid,true); | ||
| 919 | - } else { | ||
| 920 | - this.enableAudio(uid); | ||
| 921 | - }*/ | ||
| 922 | } | 902 | } |
| 923 | } | 903 | } |
| 924 | 904 | ||
| @@ -938,7 +918,7 @@ class WebRtcApe extends Emiter { | @@ -938,7 +918,7 @@ class WebRtcApe extends Emiter { | ||
| 938 | if (!_data) { | 918 | if (!_data) { |
| 939 | return; | 919 | return; |
| 940 | } | 920 | } |
| 941 | - this.videAndAudioMutedStatusData=_data; | 921 | + |
| 942 | if (_data.nodeId != GlobalConfig.nodeId) { | 922 | if (_data.nodeId != GlobalConfig.nodeId) { |
| 943 | //不是自己的只设置状态显示即可 | 923 | //不是自己的只设置状态显示即可 |
| 944 | //音频 | 924 | //音频 |
| @@ -975,8 +955,9 @@ class WebRtcApe extends Emiter { | @@ -975,8 +955,9 @@ class WebRtcApe extends Emiter { | ||
| 975 | this.enableVideo(_data.nodeId); | 955 | this.enableVideo(_data.nodeId); |
| 976 | } | 956 | } |
| 977 | //更新同步用户的媒体禁用状态 | 957 | //更新同步用户的媒体禁用状态 |
| 978 | - if(this.videAndAudioMutedStatusData){ | ||
| 979 | - this._emit(WebRtcApe.UPDATE_USER_MEDIA_MUTED_STATUS,this.videAndAudioMutedStatusData); | 958 | + loger.log("更新同步用户的媒体禁用状态",_data); |
| 959 | + if(_data){ | ||
| 960 | + this._emit(WebRtcApe.UPDATE_USER_MEDIA_MUTED_STATUS,_data); | ||
| 980 | } | 961 | } |
| 981 | } | 962 | } |
| 982 | } | 963 | } |
| @@ -438,10 +438,10 @@ class WhiteBoardApe extends Ape { | @@ -438,10 +438,10 @@ class WhiteBoardApe extends Ape { | ||
| 438 | case TYPE_RECT: | 438 | case TYPE_RECT: |
| 439 | break; | 439 | break; |
| 440 | case TYPE_CIRCLE: | 440 | case TYPE_CIRCLE: |
| 441 | - whiteBoardModelPdu.radius = parseInt(_param.radius); | 441 | + whiteBoardModelPdu.radius = parseInt(parseFloat(_param.radius)*100);//外部传入的值有可能是小数,放大100倍,收到数据后再转换 |
| 442 | break; | 442 | break; |
| 443 | case TYPE_TEXT: | 443 | case TYPE_TEXT: |
| 444 | - whiteBoardModelPdu.fontSize = parseInt(_param.fontSize); | 444 | + whiteBoardModelPdu.fontSize = parseInt(parseFloat(_param.fontSize)*100);//外部传入的值有可能是小数,放大100倍,收到数据后再转换 |
| 445 | whiteBoardModelPdu.fontName = _param.fontName || null; | 445 | whiteBoardModelPdu.fontName = _param.fontName || null; |
| 446 | whiteBoardModelPdu.text = _param.text || null; | 446 | whiteBoardModelPdu.text = _param.text || null; |
| 447 | break; | 447 | break; |
| @@ -475,6 +475,9 @@ class WhiteBoardApe extends Ape { | @@ -475,6 +475,9 @@ class WhiteBoardApe extends Ape { | ||
| 475 | //let _pointGroup = EngineUtils.arrayFromJsonString(whiteBoardModelPdu.pointGroup); | 475 | //let _pointGroup = EngineUtils.arrayFromJsonString(whiteBoardModelPdu.pointGroup); |
| 476 | let pointGroup=EngineUtils.unPackOptimizePoint(whiteBoardModelPdu.pointGroup);//还原压缩后的数据 | 476 | let pointGroup=EngineUtils.unPackOptimizePoint(whiteBoardModelPdu.pointGroup);//还原压缩后的数据 |
| 477 | whiteBoardModelPdu.pointGroup = pointGroup; | 477 | whiteBoardModelPdu.pointGroup = pointGroup; |
| 478 | + | ||
| 479 | + whiteBoardModelPdu.radius =whiteBoardModelPdu.radius*0.01;//发送的时候放大100倍,接收的时候需要除100; | ||
| 480 | + whiteBoardModelPdu.fontSize=whiteBoardModelPdu.fontSize*0.01;//发送的时候放大100倍,接收的时候需要除100; | ||
| 478 | this.annoInfos[itemIdx] = whiteBoardModelPdu; | 481 | this.annoInfos[itemIdx] = whiteBoardModelPdu; |
| 479 | return whiteBoardModelPdu; | 482 | return whiteBoardModelPdu; |
| 480 | } catch (err) { | 483 | } catch (err) { |
| @@ -232,6 +232,7 @@ class MCU extends Emiter { | @@ -232,6 +232,7 @@ class MCU extends Emiter { | ||
| 232 | randNodeId=parseInt(randNodeId); | 232 | randNodeId=parseInt(randNodeId); |
| 233 | 233 | ||
| 234 | this.classInfo.nodeId =randNodeId; //EngineUtils.creatSoleNumberFromTimestamp(); | 234 | this.classInfo.nodeId =randNodeId; //EngineUtils.creatSoleNumberFromTimestamp(); |
| 235 | + GlobalConfig.joinTimestamp=EngineUtils.creatSoleNumberFromTimestamp(); | ||
| 235 | GlobalConfig.nodeId = this.classInfo.nodeId; //这是标识自己身份的id | 236 | GlobalConfig.nodeId = this.classInfo.nodeId; //这是标识自己身份的id |
| 236 | console.log("创建nodeId",GlobalConfig.nodeId); | 237 | console.log("创建nodeId",GlobalConfig.nodeId); |
| 237 | 238 | ||
| @@ -240,6 +241,7 @@ class MCU extends Emiter { | @@ -240,6 +241,7 @@ class MCU extends Emiter { | ||
| 240 | nodeInfoRecordPdu.nodeId = this.classInfo.nodeId; | 241 | nodeInfoRecordPdu.nodeId = this.classInfo.nodeId; |
| 241 | nodeInfoRecordPdu.userId = this.classInfo.userId; | 242 | nodeInfoRecordPdu.userId = this.classInfo.userId; |
| 242 | nodeInfoRecordPdu.role = ApeConsts.userTypesToId[this.classInfo.userRole] || 1; //NR_NORMAL用户的身份,根据用户登录时的身份设置 | 243 | nodeInfoRecordPdu.role = ApeConsts.userTypesToId[this.classInfo.userRole] || 1; //NR_NORMAL用户的身份,根据用户登录时的身份设置 |
| 244 | + nodeInfoRecordPdu.joinTimestamp= GlobalConfig.joinTimestamp||EngineUtils.creatSoleNumberFromTimestamp(); | ||
| 243 | nodeInfoRecordPdu.level = 0; | 245 | nodeInfoRecordPdu.level = 0; |
| 244 | nodeInfoRecordPdu.handUpTime = 0; | 246 | nodeInfoRecordPdu.handUpTime = 0; |
| 245 | nodeInfoRecordPdu.selfDisEnableDrawTime = 1; | 247 | nodeInfoRecordPdu.selfDisEnableDrawTime = 1; |
| @@ -938,6 +938,7 @@ message RCNodeInfoRecordPdu { | @@ -938,6 +938,7 @@ message RCNodeInfoRecordPdu { | ||
| 938 | optional uint32 selfDisEnableDrawTime = 39; | 938 | optional uint32 selfDisEnableDrawTime = 39; |
| 939 | optional bool videoEnabled=40; | 939 | optional bool videoEnabled=40; |
| 940 | optional bool audioEnabled=41; | 940 | optional bool audioEnabled=41; |
| 941 | + optional uint32 joinTimestamp=42; | ||
| 941 | } | 942 | } |
| 942 | 943 | ||
| 943 | message RCVotingPollSettingsPdu { | 944 | message RCVotingPollSettingsPdu { |
-
请 注册 或 登录 后发表评论