李勇

1.课堂模块-》如果老师上课时候异常退出,会从当前的课堂中选择一个人员来做暂停课堂和停止录制的操作

此 diff 太大无法显示。
... ... @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil';
import UTF8 from 'utf-8';
let loger = Loger.getLoger('MessageEntrance');
let _sdkInfo = {"version": "v.1.8.5.20170331-1", "author": "www.3mang.com"};
let _sdkInfo = {"version": "v.1.8.6.20170401-2", "author": "www.3mang.com"};
//APE
let _sass;
... ...
... ... @@ -144,9 +144,6 @@ class ConferApe extends Ape {
loger.warn(GlobalConfig.getCurrentStatus());
return {"code": ApeConsts.RETURN_FAILED, "data": "已经断开连接"};
}
// to, message
loger.log('发送录制消息.', _param);
if (_param == null) {
loger.warn("控制录制状的消息发送失败,参数错误", _param);
return;
... ... @@ -172,6 +169,8 @@ class ConferApe extends Ape {
conferRecordSendPdu.classTime = GlobalConfig.classTimestamp;
conferRecordSendPdu.filename = GlobalConfig.recordFileName || GlobalConfig.classId + "_" + EngineUtils.creatTimestampYMD() + ".rec";
this.sendChatUniform(conferRecordSendPdu);
// to, message
loger.warn('发送录制消息-》', _param);
}
//开启录制
... ... @@ -193,13 +192,22 @@ class ConferApe extends Ape {
}
//停止录制
stopRecord() {
stopRecord(isForce) {
loger.log('stopRecord', "isHost", GlobalConfig.isHost, "recordStatus", GlobalConfig.recordStatus);
//如果是host,并且当前正在录制中
if (GlobalConfig.isHost && GlobalConfig.recordStatus) {
GlobalConfig.classStopTime = EngineUtils.creatTimestampStr();
this.sendConferRecordMsg({"recordStatus": false});
this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
if(isForce&&isForce==true){
//强制停止,可以是host之外的身份(比如当前课堂老师异常退出,没有老师,会随机选择一个人来做释放操作)
if (GlobalConfig.recordStatus) {
GlobalConfig.classStopTime = EngineUtils.creatTimestampStr();
this.sendConferRecordMsg({"recordStatus": false});
this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
}
}else {
//身份是host,并且当前正在录制中
if (GlobalConfig.isHost && GlobalConfig.recordStatus) {
GlobalConfig.classStopTime = EngineUtils.creatTimestampStr();
this.sendConferRecordMsg({"recordStatus": false});
this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE);
}
}
}
... ... @@ -288,7 +296,6 @@ class ConferApe extends Ape {
loger.warn('还没有开始,不能点暂停');
return;
}
GlobalConfig.classStatus = ApeConsts.CLASS_STATUS_PAUSE;
GlobalConfig.classStopTime = EngineUtils.creatTimestampStr();
... ... @@ -584,7 +591,10 @@ class ConferApe extends Ape {
// 自己退出
this._emit(MessageTypes.CLASS_EXIT);
} else {
loger.log(nodeId, "离开课堂");
let user=this.rosters[nodeId];
if(user){
loger.log(nodeId, "->离开课堂->身份->",user.role);
}
delete this.rosters[nodeId];
this.emitRosterChange();
this._emit(MessageTypes.CLASS_DELETE_ROSTER, {"nodeId": nodeId});
... ... @@ -592,12 +602,21 @@ class ConferApe extends Ape {
//当前人员列表中抽一个人来检查离开人员是否占用频道
for (let key in this.rosters) {
let randNodeId = parseInt(key);
//如果抽到的人是自己就处理以下操作
if (randNodeId == GlobalConfig.nodeId) {
loger.log(randNodeId, "有权限检查离开的人员是否占用channel");
this._emit(MessageTypes.CLASS_NONENTITY_ROSTER, {"nodeId": nodeId});
//如果离开的人员是老师,需要暂停当前的课堂
if(user&&user.role==ApeConsts.NR_HOST){
this.pauseClass();
//强制停止录制
this.stopRecord(true);
}
} else {
loger.warn(GlobalConfig.nodeId, "没有权限检查离开的人员是否占用channel");
}
//查找到一个就跳出操作
return;
}
}
... ...